Qualified exports and inheritance for Closure (fixes core.Object issue)
diff --git a/lib/runtime/dart/_interceptors.js b/lib/runtime/dart/_interceptors.js
index 832fe83..bf94b7c 100644
--- a/lib/runtime/dart/_interceptors.js
+++ b/lib/runtime/dart/_interceptors.js
@@ -476,6 +476,11 @@
return JSExtendableArray;
});
let JSExtendableArray = JSExtendableArray$();
+ let _isInt32 = Symbol('_isInt32');
+ let _tdivSlow = Symbol('_tdivSlow');
+ let _shlPositive = Symbol('_shlPositive');
+ let _shrOtherPositive = Symbol('_shrOtherPositive');
+ let _shrBothPositive = Symbol('_shrBothPositive');
class Interceptor extends core.Object {
Interceptor() {
}
@@ -483,11 +488,6 @@
dart.setSignature(Interceptor, {
constructors: () => ({Interceptor: [Interceptor, []]})
});
- let _isInt32 = Symbol('_isInt32');
- let _tdivSlow = Symbol('_tdivSlow');
- let _shlPositive = Symbol('_shlPositive');
- let _shrOtherPositive = Symbol('_shrOtherPositive');
- let _shrBothPositive = Symbol('_shrBothPositive');
dart.defineExtensionNames([
'compareTo',
'isNegative',
diff --git a/lib/runtime/dart/_native_typed_data.js b/lib/runtime/dart/_native_typed_data.js
index 96b08e7..d64a1b8 100644
--- a/lib/runtime/dart/_native_typed_data.js
+++ b/lib/runtime/dart/_native_typed_data.js
@@ -1,14 +1,14 @@
dart_library.library('dart/_native_typed_data', null, /* Imports */[
"dart/_runtime",
- 'dart/core',
'dart/typed_data',
+ 'dart/core',
'dart/_js_helper',
'dart/collection',
'dart/_internal',
'dart/_interceptors',
'dart/math'
], /* Lazy imports */[
-], function(exports, dart, core, typed_data, _js_helper, collection, _internal, _interceptors, math) {
+], function(exports, dart, typed_data, core, _js_helper, collection, _internal, _interceptors, math) {
'use strict';
let dartx = dart.dartx;
class NativeByteBuffer extends core.Object {
diff --git a/lib/runtime/dart/async.js b/lib/runtime/dart/async.js
index 79f09ce..68192c2 100644
--- a/lib/runtime/dart/async.js
+++ b/lib/runtime/dart/async.js
@@ -63,6 +63,10 @@
names: ['_getBestStackTrace']
});
let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(dart.dynamic, [dart.dynamic]));
+ let _controller = Symbol('_controller');
+ let _subscribe = Symbol('_subscribe');
+ let _createSubscription = Symbol('_createSubscription');
+ let _onListen = Symbol('_onListen');
let _add = Symbol('_add');
let _closeUnchecked = Symbol('_closeUnchecked');
let _addError = Symbol('_addError');
@@ -763,8 +767,6 @@
return Stream;
});
let Stream = Stream$();
- let _createSubscription = Symbol('_createSubscription');
- let _onListen = Symbol('_onListen');
let _StreamImpl$ = dart.generic(function(T) {
class _StreamImpl extends Stream$(T) {
_StreamImpl() {
@@ -798,8 +800,6 @@
return _StreamImpl;
});
let _StreamImpl = _StreamImpl$();
- let _controller = Symbol('_controller');
- let _subscribe = Symbol('_subscribe');
let _ControllerStream$ = dart.generic(function(T) {
class _ControllerStream extends _StreamImpl$(T) {
_ControllerStream(controller) {
@@ -855,6 +855,18 @@
this[_previous] = null;
}
}
+ let _eventState = Symbol('_eventState');
+ let _expectsEvent = Symbol('_expectsEvent');
+ let _toggleEventId = Symbol('_toggleEventId');
+ let _isFiring = Symbol('_isFiring');
+ let _setRemoveAfterFiring = Symbol('_setRemoveAfterFiring');
+ let _removeAfterFiring = Symbol('_removeAfterFiring');
+ let _onPause = Symbol('_onPause');
+ let _onResume = Symbol('_onResume');
+ let _recordCancel = Symbol('_recordCancel');
+ let _onCancel = Symbol('_onCancel');
+ let _recordPause = Symbol('_recordPause');
+ let _recordResume = Symbol('_recordResume');
let _zone = Symbol('_zone');
let _state = Symbol('_state');
let _onData = Symbol('_onData');
@@ -869,17 +881,14 @@
let _isInputPaused = Symbol('_isInputPaused');
let _inCallback = Symbol('_inCallback');
let _guardCallback = Symbol('_guardCallback');
- let _onPause = Symbol('_onPause');
let _decrementPauseCount = Symbol('_decrementPauseCount');
let _hasPending = Symbol('_hasPending');
let _mayResumeInput = Symbol('_mayResumeInput');
- let _onResume = Symbol('_onResume');
let _cancel = Symbol('_cancel');
let _isClosed = Symbol('_isClosed');
let _waitsForCancel = Symbol('_waitsForCancel');
let _canFire = Symbol('_canFire');
let _cancelOnError = Symbol('_cancelOnError');
- let _onCancel = Symbol('_onCancel');
let _incrementPauseCount = Symbol('_incrementPauseCount');
let _sendData = Symbol('_sendData');
let _addPending = Symbol('_addPending');
@@ -1220,9 +1229,6 @@
return _BufferingStreamSubscription;
});
let _BufferingStreamSubscription = _BufferingStreamSubscription$();
- let _recordCancel = Symbol('_recordCancel');
- let _recordPause = Symbol('_recordPause');
- let _recordResume = Symbol('_recordResume');
let _ControllerSubscription$ = dart.generic(function(T) {
class _ControllerSubscription extends _BufferingStreamSubscription$(T) {
_ControllerSubscription(controller, onData, onError, onDone, cancelOnError) {
@@ -1245,12 +1251,6 @@
return _ControllerSubscription;
});
let _ControllerSubscription = _ControllerSubscription$();
- let _eventState = Symbol('_eventState');
- let _expectsEvent = Symbol('_expectsEvent');
- let _toggleEventId = Symbol('_toggleEventId');
- let _isFiring = Symbol('_isFiring');
- let _setRemoveAfterFiring = Symbol('_setRemoveAfterFiring');
- let _removeAfterFiring = Symbol('_removeAfterFiring');
let _BroadcastSubscription$ = dart.generic(function(T) {
class _BroadcastSubscription extends _ControllerSubscription$(T) {
_BroadcastSubscription(controller, onData, onError, onDone, cancelOnError) {
@@ -3543,6 +3543,7 @@
return _GeneratedStreamImpl;
});
let _GeneratedStreamImpl = _GeneratedStreamImpl$();
+ let _iterator = Symbol('_iterator');
let _eventScheduled = Symbol('_eventScheduled');
class _PendingEvents extends core.Object {
_PendingEvents() {
@@ -3583,7 +3584,6 @@
cancelSchedule: [dart.void, []]
})
});
- let _iterator = Symbol('_iterator');
let _IterablePendingEvents$ = dart.generic(function(T) {
class _IterablePendingEvents extends _PendingEvents {
_IterablePendingEvents(data) {
@@ -5133,18 +5133,6 @@
}),
names: ['_enter', '_leave']
});
- class _Zone extends core.Object {
- _Zone() {
- }
- inSameErrorZone(otherZone) {
- return dart.notNull(core.identical(this, otherZone)) || dart.notNull(core.identical(this.errorZone, otherZone.errorZone));
- }
- }
- _Zone[dart.implements] = () => [Zone];
- dart.setSignature(_Zone, {
- constructors: () => ({_Zone: [_Zone, []]}),
- methods: () => ({inSameErrorZone: [core.bool, [Zone]]})
- });
let _run = Symbol('_run');
let _runUnary = Symbol('_runUnary');
let _runBinary = Symbol('_runBinary');
@@ -5160,6 +5148,18 @@
let _handleUncaughtError = Symbol('_handleUncaughtError');
let _map = Symbol('_map');
let _delegate = Symbol('_delegate');
+ class _Zone extends core.Object {
+ _Zone() {
+ }
+ inSameErrorZone(otherZone) {
+ return dart.notNull(core.identical(this, otherZone)) || dart.notNull(core.identical(this.errorZone, otherZone.errorZone));
+ }
+ }
+ _Zone[dart.implements] = () => [Zone];
+ dart.setSignature(_Zone, {
+ constructors: () => ({_Zone: [_Zone, []]}),
+ methods: () => ({inSameErrorZone: [core.bool, [Zone]]})
+ });
class _RootZone extends _Zone {
_RootZone() {
super._Zone();
diff --git a/lib/runtime/dart/collection.js b/lib/runtime/dart/collection.js
index a10566c..c581df2 100644
--- a/lib/runtime/dart/collection.js
+++ b/lib/runtime/dart/collection.js
@@ -113,11 +113,9 @@
return HashMap;
});
let HashMap = HashMap$();
+ let _newSet = Symbol('_newSet');
let SetMixin$ = dart.generic(function(E) {
class SetMixin extends core.Object {
- [Symbol.iterator]() {
- return new dart.JsIterator(this.iterator);
- }
get isEmpty() {
return this.length == 0;
}
@@ -381,6 +379,9 @@
}
dart.throw(core.RangeError.index(index, this, "index", null, elementIndex));
}
+ [Symbol.iterator]() {
+ return new dart.JsIterator(this.iterator);
+ }
}
SetMixin[dart.implements] = () => [core.Set$(E)];
dart.setSignature(SetMixin, {
@@ -456,7 +457,6 @@
return SetBase;
});
let SetBase = SetBase$();
- let _newSet = Symbol('_newSet');
let _HashSetBase$ = dart.generic(function(E) {
class _HashSetBase extends SetBase$(E) {
difference(other) {
@@ -1624,9 +1624,6 @@
get iterator() {
return new (_internal.ListIterator$(E))(this);
}
- [Symbol.iterator]() {
- return new dart.JsIterator(this.iterator);
- }
elementAt(index) {
return this.get(index);
}
@@ -2101,6 +2098,9 @@
toString() {
return IterableBase.iterableToFullString(this, '[', ']');
}
+ [Symbol.iterator]() {
+ return new dart.JsIterator(this.iterator);
+ }
}
ListMixin[dart.implements] = () => [core.List$(E)];
dart.setSignature(ListMixin, {
diff --git a/lib/runtime/dart/convert.js b/lib/runtime/dart/convert.js
index b88f897..659e532 100644
--- a/lib/runtime/dart/convert.js
+++ b/lib/runtime/dart/convert.js
@@ -9,6 +9,7 @@
], function(exports, dart, core, async, typed_data, _internal, collection) {
'use strict';
let dartx = dart.dartx;
+ let _allowInvalid = Symbol('_allowInvalid');
let Codec$ = dart.generic(function(S, T) {
class Codec extends core.Object {
Codec() {
@@ -63,7 +64,6 @@
statics: () => ({getByName: [Encoding, [core.String]]}),
names: ['getByName']
});
- let _allowInvalid = Symbol('_allowInvalid');
class AsciiCodec extends Encoding {
AsciiCodec(opts) {
let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : false;
@@ -96,6 +96,7 @@
});
let ASCII = dart.const(new AsciiCodec());
let _ASCII_MASK = 127;
+ let _subsetMask = Symbol('_subsetMask');
let Converter$ = dart.generic(function(S, T) {
class Converter extends core.Object {
Converter() {
@@ -125,7 +126,6 @@
return Converter;
});
let Converter = Converter$();
- let _subsetMask = Symbol('_subsetMask');
class _UnicodeSubsetEncoder extends Converter$(core.String, core.List$(core.int)) {
_UnicodeSubsetEncoder(subsetMask) {
this[_subsetMask] = subsetMask;
@@ -177,6 +177,7 @@
dart.setSignature(AsciiEncoder, {
constructors: () => ({AsciiEncoder: [AsciiEncoder, []]})
});
+ let _sink = Symbol('_sink');
class StringConversionSinkMixin extends core.Object {
add(str) {
return this.addSlice(str, 0, str[dartx.length], false);
@@ -197,7 +198,6 @@
})
});
class StringConversionSinkBase extends StringConversionSinkMixin {}
- let _sink = Symbol('_sink');
class _UnicodeSubsetEncoderSink extends StringConversionSinkBase {
_UnicodeSubsetEncoderSink(subsetMask, sink) {
this[_subsetMask] = subsetMask;
@@ -300,6 +300,7 @@
constructors: () => ({AsciiDecoder: [AsciiDecoder, [], {allowInvalid: core.bool}]}),
methods: () => ({startChunkedConversion: [ByteConversionSink, [core.Sink$(core.String)]]})
});
+ let _utf8Sink = Symbol('_utf8Sink');
let ChunkedConversionSink$ = dart.generic(function(T) {
class ChunkedConversionSink extends core.Object {
ChunkedConversionSink() {
@@ -349,7 +350,6 @@
dart.setSignature(ByteConversionSinkBase, {
methods: () => ({addSlice: [dart.void, [core.List$(core.int), core.int, core.int, core.bool]]})
});
- let _utf8Sink = Symbol('_utf8Sink');
class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase {
_ErrorHandlingAsciiDecoderSink(utf8Sink) {
this[_utf8Sink] = utf8Sink;
diff --git a/lib/runtime/dart/core.js b/lib/runtime/dart/core.js
index d46c142..b270b32 100644
--- a/lib/runtime/dart/core.js
+++ b/lib/runtime/dart/core.js
@@ -1272,9 +1272,6 @@
return new (_internal.EmptyIterable$(E))();
return new (exports._GeneratorIterable$(E))(count, generator);
}
- [dart.JsSymbol.iterator]() {
- return new dart.JsIterator(this[dartx.iterator]);
- }
[dartx.join](separator) {
if (separator === void 0)
separator = "";
@@ -1282,6 +1279,9 @@
buffer.writeAll(this, separator);
return dart.toString(buffer);
}
+ [dart.JsSymbol.iterator]() {
+ return new dart.JsIterator(this[dartx.iterator]);
+ }
}
dart.setSignature(Iterable, {
constructors: () => ({
diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart
index 0c46fb0..34139dd 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -50,6 +50,54 @@
const DCALL = 'dcall';
const DSEND = 'dsend';
+/// Type for builder of statements that need to refer to a companion class.
+/// [classRef] will either be a simple identifier or a qualified one, depending
+/// on the context in which the class is emitted (generics or not, exported or
+/// not...).
+typedef JS.Statement _ClassRefStatementBuilder(JS.Expression classRef);
+
+/// Helper class used to build class declarations.
+class _ClassBuilder {
+ final _ClassInfo info;
+
+ /// Statements that should appear before the class declaration.
+ final List<JS.Statement> prelude = [];
+ /// Members of the class declaration.
+ final List<JS.Method> body = [];
+ /// Builders for statements that should appear just after the class
+ /// declaration. These builders will get a local or qualified reference to the
+ /// class as argument so they can refer to it if they so wish.
+ ///
+ /// Note that these statements may be wrapped in generic or lazy classes
+ /// definitions, so they might not be top-level.
+ final List<_ClassRefStatementBuilder> statements = [];
+ /// Statements for extension classes are treated separately, as they need to
+ /// be at the top-level.
+ final List<JS.Statement> topLevelStatements = [];
+
+ _ClassBuilder(this.info);
+}
+
+/// Class info helper that provides member declarations.
+class _ClassInfo {
+ final ClassElement element;
+ final ClassDeclaration declaration;
+ final String jsPeerName;
+ final List<ConstructorDeclaration> ctors = [];
+ final List<FieldDeclaration> instanceFields = [];
+ final List<MethodDeclaration> methods = [];
+
+ _ClassInfo(this.element, [this.declaration, this.jsPeerName]) {
+ if (declaration != null) {
+ for (var m in declaration.members) {
+ if (m is ConstructorDeclaration) ctors.add(m);
+ else if (m is FieldDeclaration && !m.isStatic) instanceFields.add(m);
+ else if (m is MethodDeclaration) methods.add(m);
+ }
+ }
+ }
+}
+
class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator {
final AbstractCompiler compiler;
final CodegenOptions options;
@@ -87,8 +135,8 @@
/// The name for the library's exports inside itself.
/// `exports` was chosen as the most similar to ES module patterns.
+ final _exportsVar = new JS.Identifier('exports');
final _dartxVar = new JS.Identifier('dartx');
- final _exportsVar = new JS.TemporaryId('exports');
final _runtimeLibVar = new JS.Identifier('dart');
final _namedArgTemp = new JS.TemporaryId('opts');
@@ -121,6 +169,17 @@
_objectMembers = getObjectMemberMap(types);
}
+ /// Whether to always refer to current library's exported types as if they
+ /// were external types (i.e. within library 'foo', refer to local class 'Bar'
+ /// as 'foo.Bar'). This helps compile the 'core' library with Closure, as it
+ /// defines classes such as 'Object' or 'Error' that conflict with their JS
+ /// homonyms.
+ bool get _qualifyExports => options.closure;
+
+ /// Whether class parent needs to be a qualified identifier
+ /// (as opposed to an expression such as `dart.mixin(...)`).
+ bool get _needsQualifiedHeritage => options.closure;
+
TypeProvider get types => rules.provider;
JS.Program emitLibrary(LibraryUnit library) {
@@ -365,15 +424,16 @@
var type = element.type;
var name = element.name;
- var fnType = annotateTypeDef(
- js.statement('let # = dart.typedef(#, () => #);', [
- name,
- js.string(name, "'"),
- _emitTypeName(type, lowerTypedef: true)
- ]),
+ return annotateTypeDef(
+ _finishType(type, ({bool isExportable}) {
+ return _emitDecl(name,
+ js.call('dart.typedef(#, () => #)', [
+ js.string(name, "'"),
+ _emitTypeName(type, lowerTypedef: true)
+ ]),
+ isExportable: isExportable);
+ }),
node.element);
-
- return _finishClassDef(type, fnType);
}
@override
@@ -384,7 +444,7 @@
var element = node.element;
// Forward all generative constructors from the base class.
- var body = <JS.Method>[];
+ var builder = new _ClassBuilder(new _ClassInfo(element));
var supertype = element.supertype;
if (!supertype.isObject) {
@@ -392,14 +452,11 @@
var parentCtor = supertype.lookUpConstructor(ctor.name, ctor.library);
var fun = js.call('function() { super.#(...arguments); }',
[_constructorName(parentCtor)]) as JS.Fun;
- body.add(new JS.Method(_constructorName(ctor), fun));
+ builder.body.add(new JS.Method(_constructorName(ctor), fun));
}
}
- var classDecl = new JS.ClassDeclaration(new JS.ClassExpression(
- new JS.Identifier(element.name), _classHeritage(element), body));
-
- return _finishClassDef(element.type, classDecl);
+ return _finishClass(builder);
}
JS.Statement _emitJsType(String dartClassName, DartObject jsName) {
@@ -411,65 +468,118 @@
// `dom.InputElement` to actually be HTMLInputElement.
// TODO(jmesserly): if we had the JsName on the Element, we could just
// generate it correctly when we refer to it.
- if (isPublic(dartClassName)) _addExport(dartClassName);
- return js.statement('let # = #;', [dartClassName, jsTypeName]);
+ return _emitDecl(dartClassName, new JS.Identifier(jsTypeName));
}
return null;
}
+ /// Emit declaration, exporting it if [isExportable] and if the name is
+ /// public.
+ JS.Statement _emitDecl(String name, JS.Expression expr,
+ {bool isExportable: true}) {
+ var shouldExport = isExportable && isPublic(name);
+ if (shouldExport && _qualifyExports) {
+ return js.statement('#.# = #;', [_exportsVar, name, expr]);
+ } else {
+ if (shouldExport) _addExport(name);
+
+ if (expr is JS.ClassExpression) {
+ return new JS.ClassDeclaration(expr);
+ } else {
+ return js.statement('let # = #;', [name, expr]);
+ }
+ }
+ }
+
@override
JS.Statement visitClassDeclaration(ClassDeclaration node) {
var classElem = node.element;
- var type = classElem.type;
+ var classType = classElem.type;
var jsName = findAnnotation(classElem, isJsNameAnnotation);
-
if (jsName != null) return _emitJsType(node.name.name, jsName);
- var ctors = <ConstructorDeclaration>[];
- var fields = <FieldDeclaration>[];
- var methods = <MethodDeclaration>[];
+ var info = new _ClassInfo(classElem, node, _getJsPeerName(classElem));
+ var builder = new _ClassBuilder(info);
+
+ _addClassJsPeerSetup(builder);
+ _addClassInterfaces(builder);
+
+ // Iff no constructor is specified for a class C, it implicitly has a
+ // default constructor `C() : super() {}`, unless C is class Object.
+ if (info.ctors.isEmpty && !classType.isObject) {
+ builder.body.add(_emitImplicitConstructor(node, info.instanceFields));
+ }
+
for (var member in node.members) {
if (member is ConstructorDeclaration) {
- ctors.add(member);
+ builder.body.add(_emitConstructor(
+ member, classType, info.instanceFields, classType.isObject));
+ // Named constructors
+ if (member.name != null && member.factoryKeyword == null) {
+ builder.statements.add((classRef) =>
+ js.statement('dart.defineNamedConstructor(#, #);', [
+ classRef,
+ _emitMemberName(member.name.name, isStatic: true)
+ ]));
+ }
} else if (member is FieldDeclaration && !member.isStatic) {
- fields.add(member);
+ /// Instance fields, if they override getter/setter pairs
+ for (VariableDeclaration fieldDecl in member.fields.variables) {
+ var field = fieldDecl.element as FieldElement;
+ if (_fieldsNeedingStorage.contains(field)) {
+ builder.statements.add((classRef) =>
+ js.statement('dart.virtualField(#, #)',
+ [classRef, _emitMemberName(field.name, type: classType)]));
+ }
+ }
} else if (member is MethodDeclaration) {
- methods.add(member);
+ builder.body.add(_emitMethodDeclaration(classType, member));
}
}
- var classExpr = new JS.ClassExpression(new JS.Identifier(type.name),
- _classHeritage(classElem), _emitClassMethods(node, ctors, fields));
+ _addClassExtensionNames(builder);
+ _addClassIterableSupport(builder);
+ _addClassMemberSignatures(builder);
+ _addClassMetadata(builder);
- String jsPeerName;
- var jsPeer = findAnnotation(classElem, isJsPeerInterface);
- if (jsPeer != null) {
- jsPeerName =
- getConstantField(jsPeer, 'name', types.stringType)?.toStringValue();
+ return _finishClass(builder);
+ }
+
+ void _addClassExtensionNames(_ClassBuilder builder) {
+ var classElem = builder.info.element;
+ if (!_extensionTypes.contains(classElem)) return;
+
+ var dartxNames = <JS.Expression>[];
+ for (MethodDeclaration m in builder.info.methods) {
+ if (!m.isAbstract && !m.isStatic && m.element.isPublic) {
+ dartxNames.add(_elementMemberName(m.element, allowExtensions: false));
+ }
}
- var body = _finishClassMembers(classElem, classExpr, ctors, fields, methods,
- node.metadata, jsPeerName);
-
- var result = _finishClassDef(type, body);
-
- if (jsPeerName != null) {
- // This class isn't allowed to be lazy, because we need to set up
- // the native JS type eagerly at this point.
- // If we wanted to support laziness, we could defer the hookup until
- // the end of the Dart library cycle load.
- assert(_loader.isLoaded(classElem));
-
- // TODO(jmesserly): this copies the dynamic members.
- // Probably fine for objects coming from JS, but not if we actually
- // want to support construction of instances with generic types other
- // than dynamic. See issue #154 for Array and List<E> related bug.
- var copyMembers = js.statement(
- 'dart.registerExtension(dart.global.#, #);',
- [_propertyName(jsPeerName), classElem.name]);
- return _statement([result, copyMembers]);
+ if (dartxNames.isNotEmpty) {
+ builder.prelude.add(js.statement('dart.defineExtensionNames(#)',
+ [new JS.ArrayInitializer(dartxNames, multiline: true)]));
}
- return result;
+ }
+
+ void _addClassIterableSupport(_ClassBuilder builder) {
+ if (builder.info.jsPeerName != null) return;
+
+ var classType = builder.info.element.type;
+ bool hasIteratorMethod = builder.info.methods
+ .any((m) => m.isGetter && m.name.name == 'iterator');
+
+ // If the type doesn't have an `iterator`, but claims to implement Iterable,
+ // we inject the adaptor method here, as it's less code size to put the
+ // helper on a parent class. This pattern is common in the core libraries
+ // (e.g. IterableMixin<E> and IterableBase<E>).
+ //
+ // (We could do this same optimization for any interface with an `iterator`
+ // method, but that's more expensive to check for, so it doesn't seem worth
+ // it. The above case for an explicit `iterator` method will catch those.)
+ if (hasIteratorMethod || _implementsIterable(classType)) {
+ builder.body.add(_emitIterable(classType));
+ }
}
@override
@@ -519,51 +629,95 @@
return _statement(result);
}
- /// Given a class element and body, complete the class declaration.
- /// This handles generic type parameters, laziness (in library-cycle cases),
- /// and ensuring dependencies are loaded first.
- JS.Statement _finishClassDef(ParameterizedType type, JS.Statement body) {
- var name = type.name;
- var genericName = '$name\$';
+ static bool _isQualifiedName(JS.Expression expr) =>
+ expr is JS.Identifier
+ || (expr is JS.PropertyAccess
+ && expr.selector is JS.LiteralString
+ && _isQualifiedName(expr.receiver));
- JS.Statement genericDef = null;
- if (type.typeParameters.isNotEmpty) {
- genericDef = _emitGenericClassDef(type, body);
+ /// Builds the class.
+ JS.Statement _finishClass(_ClassBuilder builder) {
+ var element = builder.info.element;
+ var name = element.name;
+
+ var heritage = _classHeritage(element);
+ /// Closure expects qualified identifiers for superclasses.
+ if (_needsQualifiedHeritage && !_isQualifiedName(heritage)) {
+ var alias = new JS.TemporaryId("$name\$super");
+ builder.prelude.add(js.statement('let # = #', [alias, heritage]));
+ heritage = alias;
}
- // The base class and all mixins must be declared before this class.
- if (!_loader.isLoaded(type.element)) {
- // TODO(jmesserly): the lazy class def is a simple solution for now.
- // We may want to consider other options in the future.
+ var classExpr = new JS.ClassExpression(
+ new JS.Identifier(name),
+ heritage,
+ builder.body.where((m) => m != null).toList(growable: false));
+ var result = _finishType(element.type, ({bool isExportable}) {
+ var classRef = isExportable
+ ? _maybeQualifiedLocalType(element)
+ : new JS.Identifier(name);
- if (genericDef != null) {
- return js.statement(
- '{ #; dart.defineLazyClassGeneric(#, #, { get: # }); }',
- [genericDef, _exportsVar, _propertyName(name), genericName]);
- }
-
- return js.statement(
- 'dart.defineLazyClass(#, { get #() { #; return #; } });',
- [_exportsVar, _propertyName(name), body, name]);
- }
-
- if (isPublic(name)) _addExport(name);
-
- if (genericDef != null) {
- var dynType = fillDynamicTypeArgs(type, types);
- var genericInst = _emitTypeName(dynType, lowerGeneric: true);
- return js.statement('{ #; let # = #; }', [genericDef, name, genericInst]);
- }
- return body;
+ return _statement([]
+ ..addAll(builder.prelude)
+ ..add(_emitDecl(name, classExpr, isExportable: isExportable))
+ ..addAll(builder.statements.map((statementBuilder) {
+ return statementBuilder(classRef);
+ })));
+ });
+ return _statement([result]..addAll(builder.topLevelStatements));
}
- JS.Statement _emitGenericClassDef(ParameterizedType type, JS.Statement body) {
+ /// Given a class definition statement factory, completes its declaration.
+ /// This handles generic type parameters, laziness (in library-cycle cases),
+ /// and ensuring dependencies are loaded first.
+ JS.Statement _finishType(ParameterizedType type,
+ JS.Statement getStatement({bool isExportable})) {
+ // The base class and all mixins must be declared before this class.
+ // TODO(jmesserly): the lazy class def is a simple solution for now.
+ // We may want to consider other options in the future.
+ bool isLoaded = _loader.isLoaded(type.element);
var name = type.name;
- var genericName = '$name\$';
- var typeParams = type.typeParameters.map((p) => p.name);
- if (isPublic(name)) _exports.add(genericName);
- return js.statement('let # = dart.generic(function(#) { #; return #; });',
- [genericName, typeParams, body, name]);
+
+ if (type.typeParameters.isEmpty) {
+ if (isLoaded) {
+ return getStatement(isExportable: true);
+ } else {
+ return js.statement(
+ 'dart.defineLazyClass(#, { get #() { #; return #; } });', [
+ _exportsVar,
+ _propertyName(name),
+ getStatement(isExportable: false),
+ name
+ ]);
+ }
+ } else {
+ var genericName = '$name\$';
+ var genericDef = _emitDecl(
+ genericName,
+ js.call('dart.generic(function(#) { #; return #; })', [
+ type.typeParameters.map((p) => p.name),
+ getStatement(isExportable: false),
+ name
+ ]),
+ isExportable: true);
+
+ if (isLoaded) {
+ var genericInst = _emitTypeName(
+ fillDynamicTypeArgs(type, types), lowerGeneric: true);
+ return js.statement('{ #; #; }', [
+ genericDef,
+ _emitDecl(name, genericInst)
+ ]);
+ } else {
+ return js.statement(
+ '{ #; dart.defineLazyClassGeneric(#, #, { get: # }); }', [
+ genericDef,
+ _exportsVar,
+ _propertyName(name),
+ _maybeQualifiedLocalType(type.element, genericName)
+ ]);
+ }
+ }
}
JS.Expression _classHeritage(ClassElement element) {
@@ -584,50 +738,6 @@
return heritage;
}
- List<JS.Method> _emitClassMethods(ClassDeclaration node,
- List<ConstructorDeclaration> ctors, List<FieldDeclaration> fields) {
- var element = node.element;
- var type = element.type;
- var isObject = type.isObject;
-
- // Iff no constructor is specified for a class C, it implicitly has a
- // default constructor `C() : super() {}`, unless C is class Object.
- var jsMethods = <JS.Method>[];
- if (ctors.isEmpty && !isObject) {
- jsMethods.add(_emitImplicitConstructor(node, fields));
- }
-
- bool hasJsPeer = findAnnotation(element, isJsPeerInterface) != null;
-
- bool hasIterator = false;
- for (var m in node.members) {
- if (m is ConstructorDeclaration) {
- jsMethods.add(_emitConstructor(m, type, fields, isObject));
- } else if (m is MethodDeclaration) {
- jsMethods.add(_emitMethodDeclaration(type, m));
-
- if (!hasJsPeer && m.isGetter && m.name.name == 'iterator') {
- hasIterator = true;
- jsMethods.add(_emitIterable(type));
- }
- }
- }
-
- // If the type doesn't have an `iterator`, but claims to implement Iterable,
- // we inject the adaptor method here, as it's less code size to put the
- // helper on a parent class. This pattern is common in the core libraries
- // (e.g. IterableMixin<E> and IterableBase<E>).
- //
- // (We could do this same optimization for any interface with an `iterator`
- // method, but that's more expensive to check for, so it doesn't seem worth
- // it. The above case for an explicit `iterator` method will catch those.)
- if (!hasJsPeer && !hasIterator && _implementsIterable(type)) {
- jsMethods.add(_emitIterable(type));
- }
-
- return jsMethods.where((m) => m != null).toList(growable: false);
- }
-
bool _implementsIterable(InterfaceType t) =>
t.interfaces.any((i) => i.element.type == types.iterableType);
@@ -666,67 +776,63 @@
}
}
- /// Emit class members that need to come after the class declaration, such
- /// as static fields. See [_emitClassMethods] for things that are emitted
- /// inside the ES6 `class { ... }` node.
- JS.Statement _finishClassMembers(
- ClassElement classElem,
- JS.ClassExpression cls,
- List<ConstructorDeclaration> ctors,
- List<FieldDeclaration> fields,
- List<MethodDeclaration> methods,
- List<Annotation> metadata,
- String jsPeerName) {
- var name = classElem.name;
- var body = <JS.Statement>[];
+ String _getJsPeerName(ClassElement classElem) {
+ var jsPeer = findAnnotation(classElem, isJsPeerInterface);
+ return jsPeer == null ? null
+ : getConstantField(jsPeer, 'name', types.stringType) as String;
+ }
- if (_extensionTypes.contains(classElem)) {
- var dartxNames = <JS.Expression>[];
- for (var m in methods) {
- if (!m.isAbstract && !m.isStatic && m.element.isPublic) {
- dartxNames.add(_elementMemberName(m.element, allowExtensions: false));
- }
- }
- if (dartxNames.isNotEmpty) {
- body.add(js.statement('dart.defineExtensionNames(#)',
- [new JS.ArrayInitializer(dartxNames, multiline: true)]));
- }
- }
+ void _addClassJsPeerSetup(_ClassBuilder builder) {
+ var jsPeerName = builder.info.jsPeerName;
+ if (jsPeerName == null) return;
- body.add(new JS.ClassDeclaration(cls));
+ ClassElement classElem = builder.info.element;
// TODO(jmesserly): we should really just extend native Array.
- if (jsPeerName != null && classElem.typeParameters.isNotEmpty) {
- body.add(js.statement('dart.setBaseClass(#, dart.global.#);',
- [classElem.name, _propertyName(jsPeerName)]));
+ if (classElem.typeParameters.isNotEmpty) {
+ builder.statements.add((classRef) =>
+ js.statement('dart.setBaseClass(#, dart.global.#);',
+ [classRef, _propertyName(jsPeerName)]));
}
- // Interfaces
+ // This class isn't allowed to be lazy, because we need to set up
+ // the native JS type eagerly at this point.
+ // If we wanted to support laziness, we could defer the hookup until
+ // the end of the Dart library cycle load.
+ assert(_loader.isLoaded(classElem));
+
+ // TODO(jmesserly): this copies the dynamic members.
+ // Probably fine for objects coming from JS, but not if we actually
+ // want to support construction of instances with generic types other
+ // than dynamic. See issue #154 for Array and List<E> related bug.
+ builder.topLevelStatements.add(
+ js.statement(
+ 'dart.registerExtension(dart.global.#, #);', [
+ _propertyName(jsPeerName),
+ classElem.name
+ ]));
+ }
+ void _addClassInterfaces(_ClassBuilder builder) {
+ ClassElement classElem = builder.info.element;
if (classElem.interfaces.isNotEmpty) {
- body.add(js.statement('#[dart.implements] = () => #;', [
- name,
- new JS.ArrayInitializer(new List<JS.Expression>.from(
- classElem.interfaces.map(_emitTypeName)))
- ]));
+ builder.statements.add((classRef) =>
+ js.statement('#[dart.implements] = () => #;', [
+ classRef,
+ new JS.ArrayInitializer(new List<JS.Expression>.from(
+ classElem.interfaces.map(_emitTypeName)))
+ ]));
}
+ }
- // Named constructors
- for (ConstructorDeclaration member in ctors) {
- if (member.name != null && member.factoryKeyword == null) {
- body.add(js.statement('dart.defineNamedConstructor(#, #);',
- [name, _emitMemberName(member.name.name, isStatic: true)]));
- }
- }
+ /// Emit statements for members that need to come after the class declaration,
+ /// such as static fields. See [_emitClassMethods] for things that are emitted
+ /// inside the ES6 `class { ... }` node.
+ void _addClassMemberSignatures(_ClassBuilder builder) {
- // Instance fields, if they override getter/setter pairs
- for (FieldDeclaration member in fields) {
- for (VariableDeclaration fieldDecl in member.fields.variables) {
- var field = fieldDecl.element as FieldElement;
- if (_fieldsNeedingStorage.contains(field)) {
- body.add(_overrideField(field));
- }
- }
- }
+ var ctors = builder.info.ctors;
+ var methods = builder.info.methods;
+
+ ClassElement classElem = builder.info.element;
// Emit the signature on the class recording the runtime type information
{
@@ -782,8 +888,8 @@
}
if (!sigFields.isEmpty) {
var sig = new JS.ObjectInitializer(sigFields);
- var classExpr = new JS.Identifier(name);
- body.add(js.statement('dart.setSignature(#, #);', [classExpr, sig]));
+ builder.statements.add((classRef) =>
+ js.statement('dart.setSignature(#, #);', [classRef, sig]));
}
}
@@ -795,23 +901,27 @@
for (var e in extensions) {
methodNames.add(_elementMemberName(e));
}
- body.add(js.statement('dart.defineExtensionMembers(#, #);', [
- name,
- new JS.ArrayInitializer(methodNames, multiline: methodNames.length > 4)
- ]));
+ builder.statements.add((classRef) =>
+ js.statement('dart.defineExtensionMembers(#, #);', [
+ classRef,
+ new JS.ArrayInitializer(methodNames,
+ multiline: methodNames.length > 4)
+ ]));
}
+ }
+ void _addClassMetadata(_ClassBuilder builder) {
+ var metadata = builder.info.declaration?.metadata ?? const [];
// TODO(vsm): Make this optional per #268.
// Metadata
if (metadata.isNotEmpty) {
- body.add(js.statement('#[dart.metadata] = () => #;', [
- name,
- new JS.ArrayInitializer(
- new List<JS.Expression>.from(metadata.map(_instantiateAnnotation)))
- ]));
+ builder.statements.add((classRef) =>
+ js.statement('#[dart.metadata] = () => #;', [
+ classRef,
+ new JS.ArrayInitializer(
+ new List<JS.Expression>.from(metadata.map(_instantiateAnnotation)))
+ ]));
}
-
- return _statement(body);
}
List<ExecutableElement> _extensionsToImplement(ClassElement element) {
@@ -856,12 +966,6 @@
_collectExtensions(type.superclass, types);
}
- JS.Statement _overrideField(FieldElement e) {
- var cls = e.enclosingElement;
- return js.statement('dart.virtualField(#, #)',
- [cls.name, _emitMemberName(e.name, type: cls.type)]);
- }
-
/// Generates the implicit default constructor for class C of the form
/// `C() : super() {}`.
JS.Method _emitImplicitConstructor(
@@ -1071,7 +1175,7 @@
/// 3. constructor field initializers,
/// 4. initialize fields not covered in 1-3
JS.Statement _initializeFields(
- ClassDeclaration cls, List<FieldDeclaration> fieldDecls,
+ ClassDeclaration cls, Iterable<FieldDeclaration> fieldDecls,
[ConstructorDeclaration ctor]) {
var unit = cls.getAncestor((a) => a is CompilationUnit) as CompilationUnit;
var constField = new ConstFieldVisitor(types, unit);
@@ -1638,15 +1742,26 @@
return _maybeQualifiedName(element);
}
+ JS.Expression _maybeQualifiedLocalType(Element e, [String name]) {
+ name ??= e.name;
+ return isPublic(name) && _qualifyExports
+ ? _maybeQualifiedName(e, name)
+ : new JS.Identifier(name);
+ }
+
JS.Expression _maybeQualifiedName(Element e, [String name]) {
var libName = _libraryName(e.library);
var nameExpr = _propertyName(name ?? e.name);
+ // bool isPrivate = name is JS.LiteralString
+ // && !isPublic(name.valueWithoutQuotes);
+
// Always qualify:
// * mutable top-level fields
// * elements from other libraries
bool mutableTopLevel = e is TopLevelVariableElement && !e.isConst;
bool fromAnotherLibrary = e.library != currentLibrary;
+
if (mutableTopLevel || fromAnotherLibrary) {
return new JS.PropertyAccess(libName, nameExpr);
}
@@ -1654,6 +1769,23 @@
var id = new JS.MaybeQualifiedId(libName, nameExpr);
_qualifiedIds.add(new Tuple2(e, id));
return id;
+
+ // if (name is JS.LiteralString
+ // && !fromAnotherLibrary
+ // && !mutableTopLevel
+ // && (isPrivate || !_qualifyExports)) {
+ // return new JS.Identifier(name.valueWithoutQuotes);
+ // }
+ // var libName = _libraryName(e.library);
+
+ // if (!isCurrentLibrary
+ // || _qualifyExports && !isPrivate
+ // || mutableTopLevel) {
+ // return new JS.PropertyAccess(libName, name);
+ // }
+
+ // return (idTable ?? _qualifiedIds)
+ // .putIfAbsent(e, () => new JS.MaybeQualifiedId(libName, name));
}
@override
@@ -2078,7 +2210,7 @@
JS.Expression objExpr = _exportsVar;
var target = _lazyFields[0].element.enclosingElement;
if (target is ClassElement) {
- objExpr = new JS.Identifier(target.type.name);
+ objExpr = _maybeQualifiedLocalType(target);
}
return js.statement(
diff --git a/test/codegen/closure.dart b/test/codegen/closure.dart
index d40e8a7..dea593d 100644
--- a/test/codegen/closure.dart
+++ b/test/codegen/closure.dart
@@ -15,7 +15,7 @@
factory Foo.build() => new Foo(1, null);
untyped_method(a, b) {}
-
+
T pass(T t) => t;
String typed_method(
@@ -52,8 +52,10 @@
Baz(int i) : super(i, 123);
}
+class _Bam<M> {}
+
void main(args) {}
const String some_top_level_constant = "abc";
final String some_top_level_final = "abc";
-String some_top_level_var = "abc";
\ No newline at end of file
+String some_top_level_var = "abc";
diff --git a/test/codegen/expect/closure.js b/test/codegen/expect/closure.js
index d89bed7..2886527 100644
--- a/test/codegen/expect/closure.js
+++ b/test/codegen/expect/closure.js
@@ -7,8 +7,8 @@
'use strict';
let dartx = dart.dartx;
/** @typedef {function({i: (?number|undefined)}=)} */
- let Callback = dart.typedef('Callback', () => dart.functionType(dart.void, [], {i: core.int}));
- let Foo$ = dart.generic(function(T) {
+ exports.Callback = dart.typedef('Callback', () => dart.functionType(dart.void, [], {i: core.int}));
+ exports.Foo$ = dart.generic(function(T) {
class Foo extends core.Object {
/**
* @param {?number} i
@@ -111,23 +111,29 @@
});
return Foo;
});
- let Foo = Foo$();
+ exports.Foo = Foo$();
/** @final {string} */
Foo.some_static_constant = "abc";
/** @final {string} */
Foo.some_static_final = "abc";
/** @type {string} */
Foo.some_static_var = "abc";
- class Bar extends core.Object {}
- class Baz extends dart.mixin(Foo$(core.int), Bar) {
+ exports.Bar = class Bar extends core.Object {};
+ let Baz$super = dart.mixin(Foo$(core.int), Bar);
+ exports.Baz = class Baz extends Baz$super {
/** @param {?number} i */
Baz(i) {
super.Foo(i, 123);
}
- }
+ };
dart.setSignature(Baz, {
constructors: () => ({Baz: [Baz, [core.int]]})
});
+ let _Bam$ = dart.generic(function(M) {
+ class _Bam extends core.Object {}
+ return _Bam;
+ });
+ let _Bam = _Bam$();
/** @param {?} args */
function main(args) {
}
@@ -139,11 +145,6 @@
/** @type {string} */
exports.some_top_level_var = "abc";
// Exports:
- exports.Callback = Callback;
- exports.Foo$ = Foo$;
- exports.Foo = Foo;
- exports.Bar = Bar;
- exports.Baz = Baz;
exports.main = main;
exports.some_top_level_constant = some_top_level_constant;
});
diff --git a/test/codegen/expect/collection/equality.txt b/test/codegen/expect/collection/equality.txt
index a7e3f2f..85c9652 100644
--- a/test/codegen/expect/collection/equality.txt
+++ b/test/codegen/expect/collection/equality.txt
@@ -8,3 +8,5 @@
severe: [StaticTypeError] Type check failed: const DefaultEquality() (DefaultEquality) is not of type Equality<V> (package:collection/equality.dart, line 264, col 44)
warning: [DownCastComposite] it1.current (dynamic) will need runtime check to cast to type E (package:collection/equality.dart, line 87, col 36)
warning: [DownCastComposite] it2.current (dynamic) will need runtime check to cast to type E (package:collection/equality.dart, line 87, col 49)
+warning: [DownCastComposite] e (dynamic) will need runtime check to cast to type E (package:collection/equality.dart, line 171, col 14)
+warning: [DownCastComposite] e (dynamic) will need runtime check to cast to type E (package:collection/equality.dart, line 177, col 14)
diff --git a/test/codegen/expect/collection/iterable_zip.js b/test/codegen/expect/collection/iterable_zip.js
index f6500b0..aa68cef 100644
--- a/test/codegen/expect/collection/iterable_zip.js
+++ b/test/codegen/expect/collection/iterable_zip.js
@@ -1,9 +1,9 @@
dart_library.library('collection/iterable_zip', null, /* Imports */[
"dart/_runtime",
- 'dart/collection',
- 'dart/core'
+ 'dart/core',
+ 'dart/collection'
], /* Lazy imports */[
-], function(exports, dart, collection, core) {
+], function(exports, dart, core, collection) {
'use strict';
let dartx = dart.dartx;
let _iterables = Symbol('_iterables');
diff --git a/test/codegen/expect/collection/src/queue_list.txt b/test/codegen/expect/collection/src/queue_list.txt
index 675bafd..0d1232c 100644
--- a/test/codegen/expect/collection/src/queue_list.txt
+++ b/test/codegen/expect/collection/src/queue_list.txt
@@ -1,7 +1,5 @@
// Messages from compiling queue_list.dart
-warning: [DownCastComposite] source (Iterable<E>) will need runtime check to cast to type List<dynamic> (package:collection/src/queue_list.dart, line 44, col 25)
warning: [DownCastComposite] sourceList (List<dynamic>) will need runtime check to cast to type Iterable<E> (package:collection/src/queue_list.dart, line 45, col 40)
-warning: [DownCastComposite] elements (Iterable<E>) will need runtime check to cast to type List<dynamic> (package:collection/src/queue_list.dart, line 61, col 19)
warning: [DownCastComposite] list (List<dynamic>) will need runtime check to cast to type Iterable<E> (package:collection/src/queue_list.dart, line 67, col 52)
warning: [DownCastComposite] list (List<dynamic>) will need runtime check to cast to type Iterable<E> (package:collection/src/queue_list.dart, line 73, col 52)
warning: [DownCastComposite] list (List<dynamic>) will need runtime check to cast to type Iterable<E> (package:collection/src/queue_list.dart, line 77, col 52)
diff --git a/test/codegen/expect/collection/wrappers.txt b/test/codegen/expect/collection/wrappers.txt
index 41532dd..4f222ca 100644
--- a/test/codegen/expect/collection/wrappers.txt
+++ b/test/codegen/expect/collection/wrappers.txt
@@ -1,4 +1,16 @@
// Messages from compiling wrappers.dart
+severe: [AnalyzerMessage] Missing concrete implementation of 'Set.lookup' (package:collection/src/unmodifiable_wrappers.dart, line 132, col 7)
+severe: [InvalidMethodOverride] Mixin introduces an invalid override. The type of UnmodifiableMapMixin.remove ((K) → V) is not a subtype of DelegatingMap<K, V>.remove ((Object) → V). (package:collection/src/unmodifiable_wrappers.dart, line 205, col 38)
+severe: [InvalidMethodOverride] Invalid override. The type of UnmodifiableMapMixin.remove ((K) → V) is not a subtype of Map<K, V>.remove ((Object) → V). (package:collection/src/unmodifiable_wrappers.dart, line 240, col 3)
+severe: [InvalidMethodOverride] Invalid override. The type of DelegatingSet.lookup ((E) → E) is not a subtype of Set<E>.lookup ((Object) → E). (package:collection/wrappers.dart, line 237, col 3)
+severe: [InvalidMethodOverride] Invalid override. The type of MapValueSet.lookup ((V) → V) is not a subtype of Set<V>.lookup ((Object) → V). (package:collection/wrappers.dart, line 521, col 3)
+warning: [DownCastComposite] _throw() (dynamic) will need runtime check to cast to type E (package:collection/src/unmodifiable_wrappers.dart, line 84, col 28)
+warning: [DownCastComposite] _throw() (dynamic) will need runtime check to cast to type E (package:collection/src/unmodifiable_wrappers.dart, line 90, col 21)
+warning: [DownCastComposite] _throw() (dynamic) will need runtime check to cast to type V (package:collection/src/unmodifiable_wrappers.dart, line 228, col 41)
+warning: [DownCastComposite] _throw() (dynamic) will need runtime check to cast to type V (package:collection/src/unmodifiable_wrappers.dart, line 240, col 22)
+warning: [DownCastComposite] _base (Iterable<E>) will need runtime check to cast to type List<E> (package:collection/wrappers.dart, line 120, col 28)
+warning: [DownCastComposite] _base (Iterable<E>) will need runtime check to cast to type Set<E> (package:collection/wrappers.dart, line 219, col 26)
+warning: [DownCastComposite] _base (Iterable<E>) will need runtime check to cast to type Queue<E> (package:collection/wrappers.dart, line 272, col 30)
warning: [DownCastComposite] _keyForValue(value) (dynamic) will need runtime check to cast to type K (package:collection/wrappers.dart, line 483, col 13)
warning: [UninferredClosure] () {result = true; return value;} (() → dynamic) will need runtime check to cast to type () → V (package:collection/wrappers.dart, line 485, col 31)
warning: [DownCastComposite] value (dynamic) will need runtime check to cast to type V (package:collection/wrappers.dart, line 536, col 16)
diff --git a/test/codegen/expect/js_test.txt b/test/codegen/expect/js_test.txt
index 87f21ba..e8f7fb2 100644
--- a/test/codegen/expect/js_test.txt
+++ b/test/codegen/expect/js_test.txt
@@ -320,3 +320,5 @@
severe: [AnalyzerMessage] Undefined name 'document' (test/codegen/js_test.dart, line 694, col 32)
severe: [AnalyzerMessage] The name 'CanvasRenderingContext2D' is not a type and cannot be used in an 'as' expression (test/codegen/js_test.dart, line 695, col 46)
severe: [AnalyzerMessage] The function 'expect' is not defined (test/codegen/js_test.dart, line 698, col 9)
+warning: [MissingTypeError] type analysis didn't compute the type of: new Blob(fileParts, type: 'text/html') InstanceCreationExpression (test/codegen/js_test.dart, line 667, col 24)
+warning: [MissingTypeError] type analysis didn't compute the type of: new CustomEvent('test') InstanceCreationExpression (test/codegen/js_test.dart, line 683, col 24)
diff --git a/tool/sdk_expected_errors.txt b/tool/sdk_expected_errors.txt
index b63b40f..e69de29 100644
--- a/tool/sdk_expected_errors.txt
+++ b/tool/sdk_expected_errors.txt
@@ -1,270 +0,0 @@
-severe: [AnalyzerMessage] The redirected constructor '(dynamic) → JSArray<dynamic>' has incompatible parameters with '(dynamic) → JSArray<E>' (dart:_interceptors/js_array.dart, line 29, col 46)
-severe: [AnalyzerMessage] Missing concrete implementation of 'num.==' (dart:_interceptors/js_number.dart, line 12, col 7)
-severe: [AnalyzerMessage] Missing concrete implementation of 'String.==' (dart:_interceptors/js_string.dart, line 14, col 7)
-severe: [AnalyzerMessage] The redirected constructor '((Stream<dynamic>, bool) → StreamSubscription<dynamic>) → _StreamSubscriptionTransformer<dynamic, dynamic>' has incompatible parameters with '((Stream<S>, bool) → StreamSubscription<T>) → StreamTransformer<S, T>' (dart:async/stream.dart, line 1571, col 9)
-severe: [AnalyzerMessage] The redirected constructor '({handleData: (dynamic, EventSink<dynamic>) → void, handleError: (Object, StackTrace, EventSink<dynamic>) → void, handleDone: (EventSink<dynamic>) → void}) → _StreamHandlerTransformer<dynamic, dynamic>' has incompatible parameters with '({handleData: (S, EventSink<T>) → void, handleError: (Object, StackTrace, EventSink<T>) → void, handleDone: (EventSink<T>) → void}) → StreamTransformer<S, T>' (dart:async/stream.dart, line 1588, col 13)
-severe: [AnalyzerMessage] The redirected constructor '((List<dynamic>) → void) → _SimpleCallbackSink<dynamic>' has incompatible parameters with '((List<T>) → void) → ChunkedConversionSink<T>' (dart:convert/chunked_conversion.dart, line 23, col 45)
-severe: [AnalyzerMessage] The redirected constructor '(Iterable<E>) → LinkedHashSet<E>' has incompatible parameters with '(Iterable<dynamic>) → Set<E>' (dart:core/set.dart, line 75, col 41)
-warning: [DownCastComposite] doneHandlers (dynamic) will need runtime check to cast to type Iterable<SendPort> (dart:_isolate_helper, line 574, col 29)
-warning: [DownCastComposite] args (dynamic) will need runtime check to cast to type List<String> (dart:_isolate_helper, line 839, col 37)
-warning: [DownCastComposite] msg['args'] (dynamic) will need runtime check to cast to type List<String> (dart:_isolate_helper, line 886, col 11)
-warning: [DownCastComposite] JS('var', r'#.pop()', this) (dynamic) will need runtime check to cast to type E (dart:_interceptors/js_array.dart, line 80, col 12)
-warning: [DownCastComposite] JS('', '#[#]', this, i) (dynamic) will need runtime check to cast to type E (dart:_interceptors/js_array.dart, line 125, col 9)
-warning: [DownCastComposite] IterableMixinWorkaround.reduce(this, combine) (dynamic) will need runtime check to cast to type E (dart:_interceptors/js_array.dart, line 161, col 12)
-warning: [DownCastComposite] IterableMixinWorkaround.firstWhere(this, test, orElse) (dynamic) will need runtime check to cast to type E (dart:_interceptors/js_array.dart, line 169, col 12)
-warning: [DownCastComposite] IterableMixinWorkaround.lastWhereList(this, test, orElse) (dynamic) will need runtime check to cast to type E (dart:_interceptors/js_array.dart, line 173, col 12)
-warning: [DownCastComposite] IterableMixinWorkaround.singleWhere(this, test) (dynamic) will need runtime check to cast to type E (dart:_interceptors/js_array.dart, line 177, col 12)
-warning: [DownCastComposite] JS('var', '#[#]', this, index) (dynamic) will need runtime check to cast to type E (dart:_interceptors/js_array.dart, line 313, col 12)
-warning: [DownCastComposite] charCodes (dynamic) will need runtime check to cast to type List<int> (dart:_js_helper, line 264, col 31)
-warning: [DownCastComposite] JS('', '#.value', ret) (dynamic) will need runtime check to cast to type E (dart:_js_helper, line 779, col 16)
-warning: [DownCastComposite] JS('JSExtendableArray', r'#.split(#)', this, pattern) (dynamic) will need runtime check to cast to type List<String> (dart:_interceptors/js_string.dart, line 86, col 14)
-warning: [DownCastComposite] JS('JSExtendableArray', r'#.split(#)', this, re) (dynamic) will need runtime check to cast to type List<String> (dart:_interceptors/js_string.dart, line 89, col 14)
-warning: [DownCastComposite] JS('JSExtendableArray|Null', r'#.exec(#)', _nativeRegExp, checkString(string)) (dynamic) will need runtime check to cast to type List<String> (dart:_js_helper/regexp_helper.dart, line 108, col 22)
-warning: [DownCastComposite] match (List<dynamic>) will need runtime check to cast to type List<String> (dart:_js_helper/regexp_helper.dart, line 140, col 43)
-warning: [DownCastComposite] match (List<dynamic>) will need runtime check to cast to type List<String> (dart:_js_helper/regexp_helper.dart, line 152, col 43)
-warning: [DownCastComposite] pattern.allMatches(receiver) (dynamic) will need runtime check to cast to type Iterable<Match> (dart:_js_helper/string_helper.dart, line 137, col 23)
-warning: [DownCastComposite] controller (_StreamControllerLifecycle<dynamic>) will need runtime check to cast to type _StreamControllerLifecycle<T> (dart:async/broadcast_stream_controller.dart, line 8, col 67)
-warning: [DownCastComposite] controller (_StreamControllerLifecycle<dynamic>) will need runtime check to cast to type _StreamControllerLifecycle<T> (dart:async/broadcast_stream_controller.dart, line 36, col 15)
-warning: [DownCastComposite] subscription (StreamSubscription<dynamic>) will need runtime check to cast to type _BroadcastSubscription<T> (dart:async/broadcast_stream_controller.dart, line 196, col 18)
-warning: [DownCastComposite] subscription (StreamSubscription<dynamic>) will need runtime check to cast to type StreamSubscription<T> (dart:async/broadcast_stream_controller.dart, line 201, col 12)
-warning: [DownCastComposite] link (_BroadcastSubscriptionLink) will need runtime check to cast to type _BroadcastSubscription<T> (dart:async/broadcast_stream_controller.dart, line 310, col 48)
-warning: [UninferredClosure] (_BroadcastSubscription<T> subscription) {subscription._close();} ((_BroadcastSubscription<T>) → dynamic) will need runtime check to cast to type (_BufferingStreamSubscription<T>) → void (dart:async/broadcast_stream_controller.dart, line 373, col 24)
-warning: [DownCastComposite] link (_BroadcastSubscriptionLink) will need runtime check to cast to type _BroadcastSubscription<T> (dart:async/broadcast_stream_controller.dart, line 394, col 48)
-warning: [DownCastComposite] link (_BroadcastSubscriptionLink) will need runtime check to cast to type _BroadcastSubscription<T> (dart:async/broadcast_stream_controller.dart, line 403, col 48)
-warning: [DownCastComposite] link (_BroadcastSubscriptionLink) will need runtime check to cast to type _BroadcastSubscription<T> (dart:async/broadcast_stream_controller.dart, line 413, col 50)
-warning: [DownCastComposite] result (_Future<dynamic>) will need runtime check to cast to type Future<T> (dart:async/future.dart, line 123, col 12)
-warning: [DownCastComposite] result (_Future<dynamic>) will need runtime check to cast to type Future<T> (dart:async/future.dart, line 149, col 12)
-warning: [DownCastComposite] result (_Future<dynamic>) will need runtime check to cast to type Future<T> (dart:async/future.dart, line 233, col 12)
-warning: [DownCastComposite] callback (Function) will need runtime check to cast to type (dynamic) → bool (dart:async/future_impl.dart, line 117, col 12)
-warning: [DownCastComposite] result._zone.registerUnaryCallback(f) ((dynamic) → dynamic) will need runtime check to cast to type (T) → dynamic (dart:async/future_impl.dart, line 208, col 11)
-warning: [DownCastComposite] result._zone.registerUnaryCallback(test) ((dynamic) → dynamic) will need runtime check to cast to type (dynamic) → bool (dart:async/future_impl.dart, line 221, col 32)
-warning: [DownCastComposite] result (_Future<dynamic>) will need runtime check to cast to type Future<T> (dart:async/future_impl.dart, line 233, col 12)
-warning: [DownCastComposite] _resultOrListeners (dynamic) will need runtime check to cast to type T (dart:async/future_impl.dart, line 245, col 12)
-warning: [DownCastComposite] value (dynamic) will need runtime check to cast to type T (dart:async/future_impl.dart, line 347, col 17)
-warning: [DownCastComposite] value (dynamic) will need runtime check to cast to type T (dart:async/future_impl.dart, line 357, col 15)
-warning: [DownCastComposite] value (dynamic) will need runtime check to cast to type Future<T> (dart:async/future_impl.dart, line 386, col 31)
-warning: [DownCastComposite] value (dynamic) will need runtime check to cast to type T (dart:async/future_impl.dart, line 407, col 22)
-warning: [DownCastComposite] callback (dynamic) will need runtime check to cast to type () → void (dart:async/schedule_microtask.dart, line 66, col 61)
-warning: [DownCastComposite] callback (dynamic) will need runtime check to cast to type () → void (dart:async/schedule_microtask.dart, line 71, col 60)
-warning: [DownCastComposite] callback (dynamic) will need runtime check to cast to type () → void (dart:async/schedule_microtask.dart, line 84, col 55)
-warning: [DownCastComposite] value (dynamic) will need runtime check to cast to type T (dart:async/stream.dart, line 90, col 25)
-warning: [DownCastComposite] mapSink ((EventSink<T>) → EventSink<dynamic>) will need runtime check to cast to type (EventSink<dynamic>) → EventSink<dynamic> (dart:async/stream.dart, line 217, col 41)
-warning: [DownCastComposite] onListen ((StreamSubscription<T>) → void) will need runtime check to cast to type (StreamSubscription<dynamic>) → void (dart:async/stream.dart, line 249, col 44)
-warning: [DownCastComposite] onCancel ((StreamSubscription<T>) → void) will need runtime check to cast to type (StreamSubscription<dynamic>) → void (dart:async/stream.dart, line 249, col 54)
-warning: [DownCastComposite] _cancelAndErrorClosure(subscription, result) (dynamic) will need runtime check to cast to type (dynamic, StackTrace) → dynamic (dart:async/stream.dart, line 502, col 24)
-warning: [DownCastComposite] _cancelAndErrorClosure(subscription, result) (dynamic) will need runtime check to cast to type (dynamic, StackTrace) → dynamic (dart:async/stream.dart, line 535, col 11)
-warning: [DownCastComposite] _cancelAndErrorClosure(subscription, future) (dynamic) will need runtime check to cast to type (dynamic, StackTrace) → dynamic (dart:async/stream.dart, line 603, col 13)
-warning: [DownCastComposite] _cancelAndErrorClosure(subscription, future) (dynamic) will need runtime check to cast to type (dynamic, StackTrace) → dynamic (dart:async/stream.dart, line 629, col 13)
-warning: [DownCastComposite] _cancelAndErrorClosure(subscription, future) (dynamic) will need runtime check to cast to type (dynamic, StackTrace) → dynamic (dart:async/stream.dart, line 658, col 13)
-warning: [DownCastComposite] _cancelAndErrorClosure(subscription, future) (dynamic) will need runtime check to cast to type (dynamic, StackTrace) → dynamic (dart:async/stream.dart, line 695, col 13)
-warning: [DownCastComposite] _cancelAndErrorClosure(subscription, future) (dynamic) will need runtime check to cast to type (dynamic, StackTrace) → dynamic (dart:async/stream.dart, line 1037, col 11)
-warning: [DownCastComposite] _cancelAndErrorClosure(subscription, future) (dynamic) will need runtime check to cast to type (dynamic, StackTrace) → dynamic (dart:async/stream.dart, line 1078, col 11)
-warning: [DownCastComposite] _cancelAndErrorClosure(subscription, future) (dynamic) will need runtime check to cast to type (dynamic, StackTrace) → dynamic (dart:async/stream.dart, line 1130, col 11)
-warning: [DownCastComposite] timeout (Function) will need runtime check to cast to type () → void (dart:async/stream.dart, line 1220, col 43)
-warning: [DownCastComposite] timeout (Function) will need runtime check to cast to type () → void (dart:async/stream.dart, line 1228, col 43)
-warning: [DownCastComposite] zone.registerUnaryCallback(onTimeout) ((dynamic) → dynamic) will need runtime check to cast to type (EventSink<dynamic>) → void (dart:async/stream.dart, line 1246, col 21)
-warning: [DownCastComposite] timeout (Function) will need runtime check to cast to type () → void (dart:async/stream.dart, line 1257, col 43)
-warning: [DownCastComposite] timeout (Function) will need runtime check to cast to type () → void (dart:async/stream.dart, line 1276, col 53)
-warning: [DownCastComposite] sync ? new _NoCallbackSyncStreamController() : new _NoCallbackAsyncStreamController() (_StreamController<dynamic>) will need runtime check to cast to type StreamController<T> (dart:async/stream_controller.dart, line 83, col 14)
-warning: [DownCastComposite] subscription (_ControllerSubscription<dynamic>) will need runtime check to cast to type StreamSubscription<T> (dart:async/stream_controller.dart, line 516, col 12)
-warning: [DownCastComposite] controller (_StreamController<dynamic>) will need runtime check to cast to type _EventSink<T> (dart:async/stream_controller.dart, line 798, col 15)
-warning: [DownCastComposite] _nullDataHandler ((dynamic) → void) will need runtime check to cast to type (T) → void (dart:async/stream_impl.dart, line 153, col 42)
-warning: [DownCastComposite] _zone.registerUnaryCallback(handleData) ((dynamic) → dynamic) will need runtime check to cast to type (T) → void (dart:async/stream_impl.dart, line 154, col 15)
-warning: [DownCastComposite] subscription (StreamSubscription<dynamic>) will need runtime check to cast to type StreamSubscription<T> (dart:async/stream_impl.dart, line 476, col 12)
-warning: [DownCastComposite] new _BufferingStreamSubscription(onData, onError, onDone, cancelOnError).._setPendingEvents(_pending()) (_BufferingStreamSubscription<dynamic>) will need runtime check to cast to type StreamSubscription<T> (dart:async/stream_impl.dart, line 515, col 12)
-warning: [DownCastComposite] Zone.current.registerUnaryCallback(onListenHandler) ((dynamic) → dynamic) will need runtime check to cast to type (StreamSubscription<dynamic>) → void (dart:async/stream_impl.dart, line 813, col 28)
-warning: [DownCastComposite] Zone.current.registerUnaryCallback(onCancelHandler) ((dynamic) → dynamic) will need runtime check to cast to type (StreamSubscription<dynamic>) → void (dart:async/stream_impl.dart, line 814, col 28)
-warning: [DownCastComposite] _futureOrPrefetch (dynamic) will need runtime check to cast to type Future<bool> (dart:async/stream_impl.dart, line 1000, col 14)
-warning: [DownCastComposite] _futureOrPrefetch (dynamic) will need runtime check to cast to type T (dart:async/stream_impl.dart, line 1006, col 22)
-warning: [DownCastComposite] _futureOrPrefetch (dynamic) will need runtime check to cast to type _Future<bool> (dart:async/stream_impl.dart, line 1035, col 31)
-warning: [DownCastComposite] _futureOrPrefetch (dynamic) will need runtime check to cast to type _Future<bool> (dart:async/stream_impl.dart, line 1047, col 31)
-warning: [DownCastComposite] _futureOrPrefetch (dynamic) will need runtime check to cast to type _Future<bool> (dart:async/stream_impl.dart, line 1061, col 31)
-warning: [DownCastComposite] _futureOrPrefetch (dynamic) will need runtime check to cast to type _Future<bool> (dart:async/stream_impl.dart, line 1075, col 31)
-warning: [DownCastComposite] outputData (dynamic) will need runtime check to cast to type T (dart:async/stream_pipe.dart, line 104, col 15)
-warning: [DownCastComposite] _transform(inputEvent) (dynamic) will need runtime check to cast to type T (dart:async/stream_pipe.dart, line 235, col 21)
-warning: [DownCastComposite] _previous (Object) will need runtime check to cast to type T (dart:async/stream_pipe.dart, line 426, col 29)
-warning: [DownCastComposite] _sinkMapper ((EventSink<T>) → EventSink<S>) will need runtime check to cast to type (EventSink<dynamic>) → EventSink<dynamic> (dart:async/stream_transformers.dart, line 187, col 18)
-warning: [UninferredClosure] (EventSink<T> outputSink) {if (handleData == null) handleData = _defaultHandleData; if (handleError == null) handleError = _defaultHandleError; if (handleDone == null) handleDone = _defaultHandleDone; return new _HandlerEventSink<S, T>(handleData, handleError, handleDone, outputSink);} ((EventSink<T>) → dynamic) will need runtime check to cast to type (EventSink<T>) → EventSink<S> (dart:async/stream_transformers.dart, line 233, col 15)
-warning: [DownCastComposite] _defaultHandleData ((dynamic, EventSink<dynamic>) → void) will need runtime check to cast to type (S, EventSink<T>) → void (dart:async/stream_transformers.dart, line 234, col 48)
-warning: [DownCastComposite] _defaultHandleError ((dynamic, StackTrace, EventSink<dynamic>) → void) will need runtime check to cast to type (Object, StackTrace, EventSink<T>) → void (dart:async/stream_transformers.dart, line 235, col 50)
-warning: [DownCastComposite] Zone.current.bindUnaryCallback(callback, runGuarded: true) ((dynamic) → dynamic) will need runtime check to cast to type (Timer) → void (dart:async/timer.dart, line 80, col 19)
-warning: [DownCastComposite] zone.bindUnaryCallback(callback) ((dynamic) → dynamic) will need runtime check to cast to type (Timer) → void (dart:async/zone.dart, line 962, col 16)
-warning: [DownCastComposite] JS('var', '#.splice(#, 2)[1]', bucket, index) (dynamic) will need runtime check to cast to type V (dart:collection, line 179, col 12)
-warning: [DownCastComposite] key (dynamic) will need runtime check to cast to type K (dart:collection, line 193, col 14)
-warning: [DownCastComposite] _getTableEntry(table, key) (dynamic) will need runtime check to cast to type V (dart:collection, line 261, col 17)
-warning: [DownCastComposite] key (dynamic) will need runtime check to cast to type K (dart:collection, line 397, col 49)
-warning: [DownCastComposite] JS('var', '#[#]', bucket, i) (dynamic) will need runtime check to cast to type K (dart:collection, line 404, col 19)
-warning: [DownCastComposite] key (dynamic) will need runtime check to cast to type K (dart:collection, line 404, col 49)
-warning: [DownCastComposite] JS('var', '#[#]', keys, i) (dynamic) will need runtime check to cast to type E (dart:collection, line 430, col 9)
-warning: [DownCastComposite] JS('var', '#[#]', keys, offset) (dynamic) will need runtime check to cast to type E (dart:collection, line 456, col 18)
-warning: [DownCastComposite] cell._value (dynamic) will need runtime check to cast to type V (dart:collection, line 561, col 12)
-warning: [DownCastComposite] cell._value (dynamic) will need runtime check to cast to type V (dart:collection, line 627, col 12)
-warning: [DownCastComposite] cell._key (dynamic) will need runtime check to cast to type K (dart:collection, line 642, col 14)
-warning: [DownCastComposite] cell._value (dynamic) will need runtime check to cast to type V (dart:collection, line 642, col 25)
-warning: [DownCastComposite] cell._value (dynamic) will need runtime check to cast to type V (dart:collection, line 665, col 12)
-warning: [DownCastComposite] key (dynamic) will need runtime check to cast to type K (dart:collection, line 820, col 49)
-warning: [DownCastComposite] cell._key (dynamic) will need runtime check to cast to type K (dart:collection, line 828, col 19)
-warning: [DownCastComposite] key (dynamic) will need runtime check to cast to type K (dart:collection, line 828, col 30)
-warning: [DownCastComposite] cell._key (dynamic) will need runtime check to cast to type E (dart:collection, line 862, col 9)
-warning: [DownCastComposite] _cell._key (dynamic) will need runtime check to cast to type E (dart:collection, line 889, col 18)
-warning: [DownCastComposite] this.contains(object) ? object : null (Object) will need runtime check to cast to type E (dart:collection, line 951, col 14)
-warning: [DownCastComposite] bucket[index] (dynamic) will need runtime check to cast to type E (dart:collection, line 962, col 12)
-warning: [DownCastComposite] JS('var', '#[#]', bucket, i) (dynamic) will need runtime check to cast to type E (dart:collection, line 1202, col 21)
-warning: [DownCastComposite] element (dynamic) will need runtime check to cast to type E (dart:collection, line 1202, col 51)
-warning: [DownCastComposite] element (dynamic) will need runtime check to cast to type E (dart:collection, line 1212, col 47)
-warning: [DownCastComposite] JS('var', '#[#]', elements, offset) (dynamic) will need runtime check to cast to type E (dart:collection, line 1251, col 18)
-warning: [DownCastComposite] this.contains(object) ? object : null (Object) will need runtime check to cast to type E (dart:collection, line 1328, col 14)
-warning: [DownCastComposite] bucket[index]._element (dynamic) will need runtime check to cast to type E (dart:collection, line 1340, col 12)
-warning: [DownCastComposite] cell._element (dynamic) will need runtime check to cast to type E (dart:collection, line 1347, col 14)
-warning: [DownCastComposite] _first._element (dynamic) will need runtime check to cast to type E (dart:collection, line 1357, col 12)
-warning: [DownCastComposite] _last._element (dynamic) will need runtime check to cast to type E (dart:collection, line 1362, col 12)
-warning: [DownCastComposite] cell._element (dynamic) will need runtime check to cast to type E (dart:collection, line 1431, col 19)
-warning: [DownCastComposite] cell._element (dynamic) will need runtime check to cast to type E (dart:collection, line 1606, col 21)
-warning: [DownCastComposite] element (dynamic) will need runtime check to cast to type E (dart:collection, line 1606, col 36)
-warning: [DownCastComposite] element (dynamic) will need runtime check to cast to type E (dart:collection, line 1616, col 47)
-warning: [DownCastComposite] _cell._element (dynamic) will need runtime check to cast to type E (dart:collection, line 1678, col 18)
-warning: [DownCastComposite] k (dynamic) will need runtime check to cast to type K (dart:collection/hash_map.dart, line 112, col 35)
-warning: [DownCastComposite] v (dynamic) will need runtime check to cast to type V (dart:collection/hash_map.dart, line 112, col 40)
-warning: [DownCastComposite] elements (Iterable<dynamic>) will need runtime check to cast to type Iterable<E> (dart:collection/hash_set.dart, line 128, col 17)
-warning: [DownCastComposite] _iterator.current (dynamic) will need runtime check to cast to type E (dart:collection/iterator.dart, line 33, col 16)
-warning: [DownCastComposite] k (dynamic) will need runtime check to cast to type K (dart:collection/linked_hash_map.dart, line 99, col 35)
-warning: [DownCastComposite] v (dynamic) will need runtime check to cast to type V (dart:collection/linked_hash_map.dart, line 99, col 40)
-warning: [DownCastComposite] fillLiteralMap(keyValuePairs, new _LinkedHashMap<K, V>()) (dynamic) will need runtime check to cast to type LinkedHashMap<K, V> (dart:collection/linked_hash_map.dart, line 142, col 12)
-warning: [DownCastComposite] entry (dynamic) will need runtime check to cast to type E (dart:collection/linked_list.dart, line 65, col 56)
-warning: [DownCastComposite] next (_LinkedListLink) will need runtime check to cast to type E (dart:collection/linked_list.dart, line 93, col 17)
-warning: [DownCastComposite] _next (_LinkedListLink) will need runtime check to cast to type E (dart:collection/linked_list.dart, line 105, col 12)
-warning: [DownCastComposite] _previous (_LinkedListLink) will need runtime check to cast to type E (dart:collection/linked_list.dart, line 112, col 12)
-warning: [DownCastComposite] _next (_LinkedListLink) will need runtime check to cast to type E (dart:collection/linked_list.dart, line 122, col 12)
-warning: [DownCastComposite] current (_LinkedListLink) will need runtime check to cast to type E (dart:collection/linked_list.dart, line 134, col 14)
-warning: [DownCastComposite] _next (_LinkedListLink) will need runtime check to cast to type E (dart:collection/linked_list.dart, line 192, col 16)
-warning: [DownCastComposite] _next (_LinkedListLink) will need runtime check to cast to type E (dart:collection/linked_list.dart, line 249, col 16)
-warning: [DownCastComposite] iterable (Iterable<E>) will need runtime check to cast to type List<dynamic> (dart:collection/list.dart, line 365, col 19)
-warning: [DownCastComposite] otherList[otherStart + i] (dynamic) will need runtime check to cast to type E (dart:collection/list.dart, line 377, col 27)
-warning: [DownCastComposite] otherList[otherStart + i] (dynamic) will need runtime check to cast to type E (dart:collection/list.dart, line 381, col 27)
-warning: [DownCastComposite] _map[_map.keys.first] (dynamic) will need runtime check to cast to type V (dart:collection/maps.dart, line 122, col 18)
-warning: [DownCastComposite] _map[_map.keys.single] (dynamic) will need runtime check to cast to type V (dart:collection/maps.dart, line 123, col 19)
-warning: [DownCastComposite] _map[_map.keys.last] (dynamic) will need runtime check to cast to type V (dart:collection/maps.dart, line 124, col 17)
-warning: [DownCastComposite] _map[_keys.current] (dynamic) will need runtime check to cast to type V (dart:collection/maps.dart, line 144, col 18)
-warning: [DownCastComposite] elements (Iterable<dynamic>) will need runtime check to cast to type Iterable<E> (dart:collection/queue.dart, line 208, col 23)
-warning: [DownCastComposite] sourceList (List<dynamic>) will need runtime check to cast to type Iterable<E> (dart:collection/queue.dart, line 402, col 40)
-warning: [DownCastComposite] elements (Iterable<dynamic>) will need runtime check to cast to type Iterable<E> (dart:collection/queue.dart, line 411, col 31)
-warning: [DownCastComposite] elements (Iterable<E>) will need runtime check to cast to type List<dynamic> (dart:collection/queue.dart, line 474, col 19)
-warning: [DownCastComposite] list (List<dynamic>) will need runtime check to cast to type Iterable<E> (dart:collection/queue.dart, line 480, col 52)
-warning: [DownCastComposite] list (List<dynamic>) will need runtime check to cast to type Iterable<E> (dart:collection/queue.dart, line 486, col 52)
-warning: [DownCastComposite] list (List<dynamic>) will need runtime check to cast to type Iterable<E> (dart:collection/queue.dart, line 490, col 52)
-warning: [DownCastComposite] list (List<dynamic>) will need runtime check to cast to type Iterable<E> (dart:collection/queue.dart, line 491, col 40)
-warning: [DownCastComposite] _queue._table[_position] (dynamic) will need runtime check to cast to type E (dart:collection/queue.dart, line 738, col 16)
-warning: [DownCastComposite] current (_SplayTreeNode<dynamic>) will need runtime check to cast to type _SplayTreeNode<K> (dart:collection/splay_tree.dart, line 155, col 12)
-warning: [DownCastComposite] current (_SplayTreeNode<dynamic>) will need runtime check to cast to type _SplayTreeNode<K> (dart:collection/splay_tree.dart, line 171, col 12)
-warning: [DownCastComposite] (compare == null) ? Comparable.compare : compare (Function) will need runtime check to cast to type (K, K) → int (dart:collection/splay_tree.dart, line 269, col 23)
-warning: [DownCastComposite] k (dynamic) will need runtime check to cast to type K (dart:collection/splay_tree.dart, line 279, col 35)
-warning: [DownCastComposite] v (dynamic) will need runtime check to cast to type V (dart:collection/splay_tree.dart, line 279, col 40)
-warning: [DownCastComposite] key (Object) will need runtime check to cast to type K (dart:collection/splay_tree.dart, line 332, col 25)
-warning: [DownCastComposite] _root (_SplayTreeNode<K>) will need runtime check to cast to type _SplayTreeMapNode<dynamic, dynamic> (dart:collection/splay_tree.dart, line 334, col 37)
-warning: [DownCastComposite] mapRoot.value (dynamic) will need runtime check to cast to type V (dart:collection/splay_tree.dart, line 335, col 16)
-warning: [DownCastComposite] key (Object) will need runtime check to cast to type K (dart:collection/splay_tree.dart, line 343, col 41)
-warning: [DownCastComposite] mapRoot.value (dynamic) will need runtime check to cast to type V (dart:collection/splay_tree.dart, line 344, col 33)
-warning: [DownCastComposite] _root (_SplayTreeNode<K>) will need runtime check to cast to type _SplayTreeMapNode<dynamic, dynamic> (dart:collection/splay_tree.dart, line 354, col 35)
-warning: [DownCastComposite] _root (_SplayTreeNode<K>) will need runtime check to cast to type _SplayTreeMapNode<dynamic, dynamic> (dart:collection/splay_tree.dart, line 366, col 35)
-warning: [DownCastComposite] mapRoot.value (dynamic) will need runtime check to cast to type V (dart:collection/splay_tree.dart, line 367, col 14)
-warning: [DownCastComposite] key (Object) will need runtime check to cast to type K (dart:collection/splay_tree.dart, line 412, col 37)
-warning: [DownCastComposite] _root (_SplayTreeNode<K>) will need runtime check to cast to type _SplayTreeMapNode<dynamic, dynamic> (dart:collection/splay_tree.dart, line 429, col 18)
-warning: [DownCastComposite] _first.key (dynamic) will need runtime check to cast to type K (dart:collection/splay_tree.dart, line 445, col 12)
-warning: [DownCastComposite] _last.key (dynamic) will need runtime check to cast to type K (dart:collection/splay_tree.dart, line 453, col 12)
-warning: [DownCastComposite] node.key (dynamic) will need runtime check to cast to type K (dart:collection/splay_tree.dart, line 632, col 39)
-warning: [DownCastComposite] node.value (dynamic) will need runtime check to cast to type V (dart:collection/splay_tree.dart, line 637, col 42)
-warning: [DownCastComposite] node (_SplayTreeNode<dynamic>) will need runtime check to cast to type _SplayTreeNode<K> (dart:collection/splay_tree.dart, line 645, col 55)
-warning: [DownCastComposite] (compare == null) ? Comparable.compare : compare (Function) will need runtime check to cast to type (E, E) → int (dart:collection/splay_tree.dart, line 695, col 23)
-warning: [DownCastComposite] elements (Iterable<dynamic>) will need runtime check to cast to type Iterable<E> (dart:collection/splay_tree.dart, line 709, col 29)
-warning: [DownCastComposite] _first.key (dynamic) will need runtime check to cast to type E (dart:collection/splay_tree.dart, line 727, col 12)
-warning: [DownCastComposite] _last.key (dynamic) will need runtime check to cast to type E (dart:collection/splay_tree.dart, line 732, col 12)
-warning: [DownCastComposite] object (Object) will need runtime check to cast to type E (dart:collection/splay_tree.dart, line 743, col 40)
-warning: [DownCastComposite] object (Object) will need runtime check to cast to type E (dart:collection/splay_tree.dart, line 755, col 20)
-warning: [DownCastComposite] element (Object) will need runtime check to cast to type E (dart:collection/splay_tree.dart, line 769, col 39)
-warning: [DownCastComposite] object (Object) will need runtime check to cast to type E (dart:collection/splay_tree.dart, line 783, col 39)
-warning: [DownCastComposite] object (Object) will need runtime check to cast to type E (dart:collection/splay_tree.dart, line 795, col 23)
-warning: [DownCastComposite] result (List<dynamic>) will need runtime check to cast to type List<int> (dart:convert/ascii.dart, line 96, col 12)
-warning: [DownCastComposite] _first.encoder.fuse(_second.encoder) (Converter<S, dynamic>) will need runtime check to cast to type Converter<S, T> (dart:convert/codec.dart, line 87, col 34)
-warning: [DownCastComposite] _second.decoder.fuse(_first.decoder) (Converter<T, dynamic>) will need runtime check to cast to type Converter<T, S> (dart:convert/codec.dart, line 88, col 34)
-warning: [DownCastComposite] JS('JSExtendableArray', '#', keys) (dynamic) will need runtime check to cast to type List<String> (dart:convert, line 311, col 12)
-warning: [DownCastComposite] _second.convert(_first.convert(input)) (dynamic) will need runtime check to cast to type T (dart:convert/converter.dart, line 58, col 25)
-warning: [DownCastComposite] toEncodable ((dynamic) → dynamic) will need runtime check to cast to type (Object) → Object (dart:convert/json.dart, line 142, col 28)
-warning: [DownCastComposite] _toEncodable ((dynamic) → dynamic) will need runtime check to cast to type (Object) → Object (dart:convert/json.dart, line 147, col 28)
-warning: [DownCastComposite] _toEncodable (Function) will need runtime check to cast to type (Object) → dynamic (dart:convert/json.dart, line 270, col 42)
-warning: [DownCastComposite] _toEncodable (Function) will need runtime check to cast to type (Object) → dynamic (dart:convert/json.dart, line 352, col 36)
-warning: [DownCastComposite] _toEncodable (Function) will need runtime check to cast to type (Object) → dynamic (dart:convert/json.dart, line 455, col 53)
-warning: [DownCastComposite] object (dynamic) will need runtime check to cast to type Map<String, Object> (dart:convert/json.dart, line 715, col 16)
-warning: [DownCastComposite] _toEncodable (dynamic) will need runtime check to cast to type (Object) → Object (dart:convert/json.dart, line 817, col 60)
-warning: [DownCastComposite] toEncodable (dynamic) will need runtime check to cast to type (Object) → Object (dart:convert/json.dart, line 895, col 15)
-warning: [DownCastComposite] sink (Sink<dynamic>) will need runtime check to cast to type Sink<String> (dart:convert/line_splitter.dart, line 24, col 44)
-warning: [DownCastComposite] (generator != null) ? generator : _id (Function) will need runtime check to cast to type (int) → E (dart:core/iterable.dart, line 319, col 22)
-warning: [DownCastComposite] e (dynamic) will need runtime check to cast to type E (dart:core/list.dart, line 121, col 16)
-warning: [DownCastComposite] makeListFixedLength(list) (List<dynamic>) will need runtime check to cast to type List<E> (dart:core/list.dart, line 124, col 12)
-warning: [DownCastComposite] charCodes (Iterable<int>) will need runtime check to cast to type List<dynamic> (dart:core/string.dart, line 121, col 17)
-warning: [DownCastComposite] _userinfoTable (List<dynamic>) will need runtime check to cast to type List<int> (dart:core/uri.dart, line 1131, col 45)
-warning: [DownCastComposite] _pathCharOrSlashTable (List<dynamic>) will need runtime check to cast to type List<int> (dart:core/uri.dart, line 1144, col 45)
-warning: [DownCastComposite] _pathCharTable (List<dynamic>) will need runtime check to cast to type List<int> (dart:core/uri.dart, line 1146, col 51)
-warning: [DownCastComposite] _queryCharTable (List<dynamic>) will need runtime check to cast to type List<int> (dart:core/uri.dart, line 1163, col 61)
-warning: [DownCastComposite] _queryCharTable (List<dynamic>) will need runtime check to cast to type List<int> (dart:core/uri.dart, line 1183, col 45)
-warning: [DownCastComposite] codeUnits (List<dynamic>) will need runtime check to cast to type Iterable<int> (dart:core/uri.dart, line 1278, col 37)
-warning: [DownCastComposite] _unreserved2396Table (List<dynamic>) will need runtime check to cast to type List<int> (dart:core/uri.dart, line 1754, col 23)
-warning: [DownCastComposite] _unreservedTable (List<dynamic>) will need runtime check to cast to type List<int> (dart:core/uri.dart, line 1793, col 9)
-warning: [DownCastComposite] _encodeFullTable (List<dynamic>) will need runtime check to cast to type List<int> (dart:core/uri.dart, line 1837, col 23)
-warning: [DownCastComposite] query.split("&").fold({}, (map, element) {int index = element.indexOf("="); if (index == -1) {if (element != "") {map[decodeQueryComponent(element, encoding: encoding)] = "";}} else if (index != 0) {var key = element.substring(0, index); var value = element.substring(index + 1); map[Uri.decodeQueryComponent(key, encoding: encoding)] = decodeQueryComponent(value, encoding: encoding);} return map;}) (dynamic) will need runtime check to cast to type Map<String, String> (dart:core/uri.dart, line 1869, col 12)
-warning: [DownCastComposite] bytes.map((byteString) {int byte = int.parse(byteString); if (byte < 0 || byte > 255) {error('each part must be in the range of `0..255`');} return byte;}).toList() (List<dynamic>) will need runtime check to cast to type List<int> (dart:core/uri.dart, line 1901, col 12)
-warning: [DownCastComposite] bytes (List<dynamic>) will need runtime check to cast to type List<int> (dart:core/uri.dart, line 2023, col 12)
-warning: [DownCastComposite] result (List<dynamic>) will need runtime check to cast to type List<E> (dart:_internal/iterable.dart, line 310, col 12)
-warning: [DownCastComposite] iterable (Iterable<dynamic>) will need runtime check to cast to type Iterable<S> (dart:_internal/iterable.dart, line 357, col 39)
-warning: [DownCastComposite] iterable (Iterable<dynamic>) will need runtime check to cast to type Iterable<S> (dart:_internal/iterable.dart, line 378, col 17)
-warning: [DownCastComposite] _f ((dynamic) → Iterable<dynamic>) will need runtime check to cast to type (S) → Iterable<T> (dart:_internal/iterable.dart, line 454, col 76)
-warning: [DownCastComposite] _f(_iterator.current).iterator (Iterator<dynamic>) will need runtime check to cast to type Iterator<T> (dart:_internal/iterable.dart, line 481, col 29)
-warning: [DownCastComposite] iterable (Iterable<dynamic>) will need runtime check to cast to type Iterable<T> (dart:_internal/iterable.dart, line 961, col 33)
-warning: [DownCastComposite] f ((dynamic) → bool) will need runtime check to cast to type (T) → bool (dart:_internal/iterable.dart, line 961, col 43)
-warning: [DownCastComposite] list (List<dynamic>) will need runtime check to cast to type Iterable<T> (dart:_internal/iterable.dart, line 978, col 35)
-warning: [DownCastComposite] iterable (Iterable<dynamic>) will need runtime check to cast to type Iterable<T> (dart:_internal/iterable.dart, line 983, col 37)
-warning: [DownCastComposite] test ((dynamic) → bool) will need runtime check to cast to type (T) → bool (dart:_internal/iterable.dart, line 983, col 47)
-warning: [DownCastComposite] list (List<dynamic>) will need runtime check to cast to type Iterable<T> (dart:_internal/iterable.dart, line 988, col 35)
-warning: [DownCastComposite] iterable (Iterable<dynamic>) will need runtime check to cast to type Iterable<T> (dart:_internal/iterable.dart, line 993, col 37)
-warning: [DownCastComposite] test ((dynamic) → bool) will need runtime check to cast to type (T) → bool (dart:_internal/iterable.dart, line 993, col 47)
-warning: [DownCastComposite] list (List<dynamic>) will need runtime check to cast to type Iterable<T> (dart:_internal/iterable.dart, line 997, col 40)
-warning: [DownCastComposite] list (List<dynamic>) will need runtime check to cast to type Iterable<T> (dart:_internal/iterable.dart, line 1033, col 35)
-warning: [DownCastComposite] l (List<dynamic>) will need runtime check to cast to type List<T> (dart:_internal/iterable.dart, line 1115, col 31)
-warning: [DownCastComposite] _convertToJS ((dynamic) → dynamic) will need runtime check to cast to type (E) → dynamic (dart:js, line 325, col 44)
-warning: [DownCastComposite] super[index] (dynamic) will need runtime check to cast to type E (dart:js, line 358, col 12)
-warning: [DownCastComposite] callMethod('splice', [index, 1])[0] (dynamic) will need runtime check to cast to type E (dart:js, line 404, col 12)
-warning: [DownCastComposite] callMethod('pop') (dynamic) will need runtime check to cast to type E (dart:js, line 409, col 12)
-warning: [DownCastComposite] x + other.x (num) will need runtime check to cast to type T (dart:math/point.dart, line 37, col 25)
-warning: [DownCastComposite] y + other.y (num) will need runtime check to cast to type T (dart:math/point.dart, line 37, col 38)
-warning: [DownCastComposite] x - other.x (num) will need runtime check to cast to type T (dart:math/point.dart, line 46, col 25)
-warning: [DownCastComposite] y - other.y (num) will need runtime check to cast to type T (dart:math/point.dart, line 46, col 38)
-warning: [DownCastComposite] x * factor (num) will need runtime check to cast to type T (dart:math/point.dart, line 59, col 25)
-warning: [DownCastComposite] y * factor (num) will need runtime check to cast to type T (dart:math/point.dart, line 59, col 37)
-warning: [DownCastComposite] dx * dx + dy * dy (num) will need runtime check to cast to type T (dart:math/point.dart, line 86, col 12)
-warning: [DownCastComposite] left + width (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 33, col 18)
-warning: [DownCastComposite] top + height (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 35, col 19)
-warning: [DownCastComposite] x0 (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 68, col 33)
-warning: [DownCastComposite] y0 (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 68, col 37)
-warning: [DownCastComposite] x1 - x0 (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 68, col 41)
-warning: [DownCastComposite] y1 - y0 (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 68, col 50)
-warning: [DownCastComposite] left (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 95, col 29)
-warning: [DownCastComposite] top (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 95, col 35)
-warning: [DownCastComposite] right - left (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 95, col 40)
-warning: [DownCastComposite] bottom - top (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 95, col 54)
-warning: [DownCastComposite] this.left + this.width (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 119, col 41)
-warning: [DownCastComposite] this.left + this.width (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 120, col 44)
-warning: [DownCastComposite] this.top + this.height (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 121, col 7)
-warning: [DownCastComposite] this.top + this.height (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 123, col 7)
-warning: [DownCastComposite] (width < 0) ? -width * 0 : width (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 151, col 22)
-warning: [DownCastComposite] (height < 0) ? -height * 0 : height (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 152, col 23)
-warning: [DownCastComposite] min(a.x, b.x) (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 167, col 14)
-warning: [DownCastComposite] max(a.x, b.x) - left (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 168, col 15)
-warning: [DownCastComposite] min(a.y, b.y) (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 169, col 13)
-warning: [DownCastComposite] max(a.y, b.y) - top (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 170, col 16)
-warning: [DownCastComposite] (width < 0) ? _clampToZero(width) : width (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 212, col 23)
-warning: [DownCastComposite] (height < 0) ? _clampToZero(height) : height (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 213, col 24)
-warning: [DownCastComposite] min(a.x, b.x) (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 228, col 14)
-warning: [DownCastComposite] max(a.x, b.x) - left (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 229, col 15)
-warning: [DownCastComposite] min(a.y, b.y) (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 230, col 13)
-warning: [DownCastComposite] max(a.y, b.y) - top (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 231, col 16)
-warning: [DownCastComposite] _clampToZero(width) (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 247, col 28)
-warning: [DownCastComposite] _clampToZero(height) (num) will need runtime check to cast to type T (dart:math/rectangle.dart, line 263, col 30)