diff --git a/pkg/dev_compiler/lib/src/codegen/js_codegen.dart b/pkg/dev_compiler/lib/src/codegen/js_codegen.dart index 1f69fefc77ac..00d4ef8063de 100644 --- a/pkg/dev_compiler/lib/src/codegen/js_codegen.dart +++ b/pkg/dev_compiler/lib/src/codegen/js_codegen.dart @@ -34,7 +34,6 @@ const String _jsNamedParameterName = r'opt$'; class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor { final LibraryInfo libraryInfo; final TypeRules rules; - final String _libraryName; /// The variable for the target of the current `..` cascade expression. SimpleIdentifier _cascadeTarget; @@ -48,8 +47,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor { JSCodegenVisitor(LibraryInfo libraryInfo, TypeRules rules) : libraryInfo = libraryInfo, - rules = rules, - _libraryName = jsLibraryName(libraryInfo.library); + rules = rules; Element get currentLibrary => libraryInfo.library; @@ -71,18 +69,18 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor { // TODO(jmesserly): make these immutable in JS? for (var name in _exports) { - body.add(js.statement('#.# = #;', [_libraryName, name, name])); + body.add(js.statement('$_EXPORTS.# = #;', [name, name])); } - var name = _libraryName; + var name = jsLibraryName(libraryInfo.library); return new JS.Block([ js.statement('var #;', name), js.statement(''' - (function (#) { + (function ($_EXPORTS) { 'use strict'; #; })(# || (# = {})); - ''', [name, body, name, name]) + ''', [body, name, name]) ]); } @@ -641,7 +639,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor { var name = node.name; if (e.enclosingElement is CompilationUnitElement && (e.library != libraryInfo.library || _needsModuleGetter(e))) { - return js.call('#.#', [jsLibraryName(e.library), name]); + return js.call('#.#', [_libraryName(e.library), name]); } else if (currentClass != null && _needsImplicitThis(e)) { return js.call('this.#', name); } @@ -671,7 +669,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor { JS.Expression result; if (lib != currentLibrary && lib != null) { - result = js.call('#.#', [jsLibraryName(lib), name]); + result = js.call('#.#', [_libraryName(lib), name]); } else { result = new JS.VariableUse(name); } @@ -954,7 +952,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor { } void _flushLazyFields(List body) { - var code = _emitLazyFields(_libraryName, _lazyFields); + var code = _emitLazyFields(_EXPORTS, _lazyFields); if (code != null) body.add(code); _lazyFields.clear(); } @@ -984,8 +982,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor { void _flushLibraryProperties(List body) { if (_properties.isEmpty) return; - body.add(js.statement('dart.copyProperties(#, { # });', [ - _libraryName, + body.add(js.statement('dart.copyProperties($_EXPORTS, { # });', [ _properties.map(_emitTopLevelProperty) ])); _properties.clear(); @@ -1624,6 +1621,14 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor { FunctionBody _functionBody(node) => node is FunctionDeclaration ? node.functionExpression.body : node.body; + /// Choose a canonical name from the library element. + /// This never uses the library's name (the identifier in the `library` + /// declaration) as it doesn't have any meaningful rules enforced. + String _libraryName(LibraryElement library) { + if (library == libraryInfo.library) return _EXPORTS; + return jsLibraryName(library); + } + String _maybeBindThis(node) { if (currentClass == null) return ''; var visitor = _BindThisVisitor._instance; @@ -1632,6 +1637,12 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor { return visitor._bindThis ? '.bind(this)' : ''; } + /// The name for the library's exports inside itself. + /// This much be a constant because we interpolate it into template strings, + /// and otherwise it would break caching for them. + /// `exports` was chosen as the most similar to ES module patterns. + static const String _EXPORTS = 'exports'; + static bool _needsImplicitThis(Element e) => e is PropertyAccessorElement && !e.variable.isStatic || e is ClassMemberElement && !e.isStatic && e is! ConstructorElement; diff --git a/pkg/dev_compiler/test/codegen/expect/BenchmarkBase/BenchmarkBase.js b/pkg/dev_compiler/test/codegen/expect/BenchmarkBase/BenchmarkBase.js index 462a7fc35ad8..c579822eefeb 100644 --- a/pkg/dev_compiler/test/codegen/expect/BenchmarkBase/BenchmarkBase.js +++ b/pkg/dev_compiler/test/codegen/expect/BenchmarkBase/BenchmarkBase.js @@ -1,5 +1,5 @@ var BenchmarkBase; -(function(BenchmarkBase) { +(function(exports) { 'use strict'; class Expect extends dart.Object { static equals(expected, actual) { @@ -64,6 +64,6 @@ var BenchmarkBase; } } // Exports: - BenchmarkBase.Expect = Expect; - BenchmarkBase.BenchmarkBase = BenchmarkBase; + exports.Expect = Expect; + exports.BenchmarkBase = BenchmarkBase; })(BenchmarkBase || (BenchmarkBase = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/DeltaBlue/DeltaBlue.js b/pkg/dev_compiler/test/codegen/expect/DeltaBlue/DeltaBlue.js index cf0948c7358d..8c881ea6a6fe 100644 --- a/pkg/dev_compiler/test/codegen/expect/DeltaBlue/DeltaBlue.js +++ b/pkg/dev_compiler/test/codegen/expect/DeltaBlue/DeltaBlue.js @@ -1,5 +1,5 @@ var DeltaBlue; -(function(DeltaBlue) { +(function(exports) { 'use strict'; // Function main: () → dynamic function main() { @@ -48,7 +48,7 @@ var DeltaBlue; } addConstraint() { this.addToGraph(); - DeltaBlue.planner.incrementalAdd(this); + exports.planner.incrementalAdd(this); } satisfy(mark) { this.chooseMethod(dart.as(mark, core.int)); @@ -64,14 +64,14 @@ var DeltaBlue; if (overridden !== null) overridden.markUnsatisfied(); out.determinedBy = this; - if (!dart.notNull(DeltaBlue.planner.addPropagate(this, dart.as(mark, core.int)))) + if (!dart.notNull(exports.planner.addPropagate(this, dart.as(mark, core.int)))) core.print("Cycle encountered"); out.mark = dart.as(mark, core.int); return overridden; } destroyConstraint() { if (this.isSatisfied()) - DeltaBlue.planner.incrementalRemove(this); + exports.planner.incrementalRemove(this); this.removeFromGraph(); } isInput() { @@ -373,7 +373,7 @@ var DeltaBlue; } // Function chainTest: (int) → void function chainTest(n) { - DeltaBlue.planner = new Planner(); + exports.planner = new Planner(); let prev = null, first = null, last = null; for (let i = 0; i <= n; i++) { let v = new Variable("v", 0); @@ -387,7 +387,7 @@ var DeltaBlue; } new StayConstraint(last, STRONG_DEFAULT); let edit = new EditConstraint(first, PREFERRED); - let plan = DeltaBlue.planner.extractPlanFromConstraints(new List.from([edit])); + let plan = exports.planner.extractPlanFromConstraints(new List.from([edit])); for (let i = 0; i < 100; i++) { first.value = i; plan.execute(); @@ -399,7 +399,7 @@ var DeltaBlue; } // Function projectionTest: (int) → void function projectionTest(n) { - DeltaBlue.planner = new Planner(); + exports.planner = new Planner(); let scale = new Variable("scale", 10); let offset = new Variable("offset", 1000); let src = null, dst = null; @@ -431,39 +431,39 @@ var DeltaBlue; // Function change: (Variable, int) → void function change(v, newValue) { let edit = new EditConstraint(v, PREFERRED); - let plan = DeltaBlue.planner.extractPlanFromConstraints(new List.from([edit])); + let plan = exports.planner.extractPlanFromConstraints(new List.from([edit])); for (let i = 0; i < 10; i++) { v.value = newValue; plan.execute(); } edit.destroyConstraint(); } - DeltaBlue.planner = null; + exports.planner = null; // Exports: - DeltaBlue.main = main; - DeltaBlue.DeltaBlue = DeltaBlue; - DeltaBlue.Strength = Strength; - DeltaBlue.REQUIRED = REQUIRED; - DeltaBlue.STRONG_PREFERRED = STRONG_PREFERRED; - DeltaBlue.PREFERRED = PREFERRED; - DeltaBlue.STRONG_DEFAULT = STRONG_DEFAULT; - DeltaBlue.NORMAL = NORMAL; - DeltaBlue.WEAK_DEFAULT = WEAK_DEFAULT; - DeltaBlue.WEAKEST = WEAKEST; - DeltaBlue.Constraint = Constraint; - DeltaBlue.UnaryConstraint = UnaryConstraint; - DeltaBlue.StayConstraint = StayConstraint; - DeltaBlue.EditConstraint = EditConstraint; - DeltaBlue.NONE = NONE; - DeltaBlue.FORWARD = FORWARD; - DeltaBlue.BACKWARD = BACKWARD; - DeltaBlue.BinaryConstraint = BinaryConstraint; - DeltaBlue.ScaleConstraint = ScaleConstraint; - DeltaBlue.EqualityConstraint = EqualityConstraint; - DeltaBlue.Variable = Variable; - DeltaBlue.Planner = Planner; - DeltaBlue.Plan = Plan; - DeltaBlue.chainTest = chainTest; - DeltaBlue.projectionTest = projectionTest; - DeltaBlue.change = change; + exports.main = main; + exports.DeltaBlue = DeltaBlue; + exports.Strength = Strength; + exports.REQUIRED = REQUIRED; + exports.STRONG_PREFERRED = STRONG_PREFERRED; + exports.PREFERRED = PREFERRED; + exports.STRONG_DEFAULT = STRONG_DEFAULT; + exports.NORMAL = NORMAL; + exports.WEAK_DEFAULT = WEAK_DEFAULT; + exports.WEAKEST = WEAKEST; + exports.Constraint = Constraint; + exports.UnaryConstraint = UnaryConstraint; + exports.StayConstraint = StayConstraint; + exports.EditConstraint = EditConstraint; + exports.NONE = NONE; + exports.FORWARD = FORWARD; + exports.BACKWARD = BACKWARD; + exports.BinaryConstraint = BinaryConstraint; + exports.ScaleConstraint = ScaleConstraint; + exports.EqualityConstraint = EqualityConstraint; + exports.Variable = Variable; + exports.Planner = Planner; + exports.Plan = Plan; + exports.chainTest = chainTest; + exports.projectionTest = projectionTest; + exports.change = change; })(DeltaBlue || (DeltaBlue = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/_foreign_helper/_foreign_helper.js b/pkg/dev_compiler/test/codegen/expect/_foreign_helper/_foreign_helper.js index 0943610390d5..0ccb952a9110 100644 --- a/pkg/dev_compiler/test/codegen/expect/_foreign_helper/_foreign_helper.js +++ b/pkg/dev_compiler/test/codegen/expect/_foreign_helper/_foreign_helper.js @@ -1,5 +1,5 @@ var _foreign_helper; -(function(_foreign_helper) { +(function(exports) { 'use strict'; // Function JS: (String, String, [dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic]) → dynamic function JS(typeDescription, codeTemplate, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) { @@ -122,35 +122,35 @@ var _foreign_helper; return a + b; } // Exports: - _foreign_helper.JS = JS; - _foreign_helper.JS_CURRENT_ISOLATE_CONTEXT = JS_CURRENT_ISOLATE_CONTEXT; - _foreign_helper.IsolateContext = IsolateContext; - _foreign_helper.JS_CALL_IN_ISOLATE = JS_CALL_IN_ISOLATE; - _foreign_helper.DART_CLOSURE_TO_JS = DART_CLOSURE_TO_JS; - _foreign_helper.RAW_DART_FUNCTION_REF = RAW_DART_FUNCTION_REF; - _foreign_helper.JS_SET_CURRENT_ISOLATE = JS_SET_CURRENT_ISOLATE; - _foreign_helper.JS_CREATE_ISOLATE = JS_CREATE_ISOLATE; - _foreign_helper.JS_DART_OBJECT_CONSTRUCTOR = JS_DART_OBJECT_CONSTRUCTOR; - _foreign_helper.JS_INTERCEPTOR_CONSTANT = JS_INTERCEPTOR_CONSTANT; - _foreign_helper.JS_OPERATOR_IS_PREFIX = JS_OPERATOR_IS_PREFIX; - _foreign_helper.JS_OPERATOR_AS_PREFIX = JS_OPERATOR_AS_PREFIX; - _foreign_helper.JS_OBJECT_CLASS_NAME = JS_OBJECT_CLASS_NAME; - _foreign_helper.JS_NULL_CLASS_NAME = JS_NULL_CLASS_NAME; - _foreign_helper.JS_FUNCTION_CLASS_NAME = JS_FUNCTION_CLASS_NAME; - _foreign_helper.JS_IS_INDEXABLE_FIELD_NAME = JS_IS_INDEXABLE_FIELD_NAME; - _foreign_helper.JS_CURRENT_ISOLATE = JS_CURRENT_ISOLATE; - _foreign_helper.JS_SIGNATURE_NAME = JS_SIGNATURE_NAME; - _foreign_helper.JS_TYPEDEF_TAG = JS_TYPEDEF_TAG; - _foreign_helper.JS_FUNCTION_TYPE_TAG = JS_FUNCTION_TYPE_TAG; - _foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG = JS_FUNCTION_TYPE_VOID_RETURN_TAG; - _foreign_helper.JS_FUNCTION_TYPE_RETURN_TYPE_TAG = JS_FUNCTION_TYPE_RETURN_TYPE_TAG; - _foreign_helper.JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG = JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG; - _foreign_helper.JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG = JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG; - _foreign_helper.JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG = JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG; - _foreign_helper.JS_GET_NAME = JS_GET_NAME; - _foreign_helper.JS_EMBEDDED_GLOBAL = JS_EMBEDDED_GLOBAL; - _foreign_helper.JS_GET_FLAG = JS_GET_FLAG; - _foreign_helper.JS_EFFECT = JS_EFFECT; - _foreign_helper.JS_CONST = JS_CONST; - _foreign_helper.JS_STRING_CONCAT = JS_STRING_CONCAT; + exports.JS = JS; + exports.JS_CURRENT_ISOLATE_CONTEXT = JS_CURRENT_ISOLATE_CONTEXT; + exports.IsolateContext = IsolateContext; + exports.JS_CALL_IN_ISOLATE = JS_CALL_IN_ISOLATE; + exports.DART_CLOSURE_TO_JS = DART_CLOSURE_TO_JS; + exports.RAW_DART_FUNCTION_REF = RAW_DART_FUNCTION_REF; + exports.JS_SET_CURRENT_ISOLATE = JS_SET_CURRENT_ISOLATE; + exports.JS_CREATE_ISOLATE = JS_CREATE_ISOLATE; + exports.JS_DART_OBJECT_CONSTRUCTOR = JS_DART_OBJECT_CONSTRUCTOR; + exports.JS_INTERCEPTOR_CONSTANT = JS_INTERCEPTOR_CONSTANT; + exports.JS_OPERATOR_IS_PREFIX = JS_OPERATOR_IS_PREFIX; + exports.JS_OPERATOR_AS_PREFIX = JS_OPERATOR_AS_PREFIX; + exports.JS_OBJECT_CLASS_NAME = JS_OBJECT_CLASS_NAME; + exports.JS_NULL_CLASS_NAME = JS_NULL_CLASS_NAME; + exports.JS_FUNCTION_CLASS_NAME = JS_FUNCTION_CLASS_NAME; + exports.JS_IS_INDEXABLE_FIELD_NAME = JS_IS_INDEXABLE_FIELD_NAME; + exports.JS_CURRENT_ISOLATE = JS_CURRENT_ISOLATE; + exports.JS_SIGNATURE_NAME = JS_SIGNATURE_NAME; + exports.JS_TYPEDEF_TAG = JS_TYPEDEF_TAG; + exports.JS_FUNCTION_TYPE_TAG = JS_FUNCTION_TYPE_TAG; + exports.JS_FUNCTION_TYPE_VOID_RETURN_TAG = JS_FUNCTION_TYPE_VOID_RETURN_TAG; + exports.JS_FUNCTION_TYPE_RETURN_TYPE_TAG = JS_FUNCTION_TYPE_RETURN_TYPE_TAG; + exports.JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG = JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG; + exports.JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG = JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG; + exports.JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG = JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG; + exports.JS_GET_NAME = JS_GET_NAME; + exports.JS_EMBEDDED_GLOBAL = JS_EMBEDDED_GLOBAL; + exports.JS_GET_FLAG = JS_GET_FLAG; + exports.JS_EFFECT = JS_EFFECT; + exports.JS_CONST = JS_CONST; + exports.JS_STRING_CONCAT = JS_STRING_CONCAT; })(_foreign_helper || (_foreign_helper = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/_interceptors/_interceptors.js b/pkg/dev_compiler/test/codegen/expect/_interceptors/_interceptors.js index 3f32e631a5e7..cd9f47913602 100644 --- a/pkg/dev_compiler/test/codegen/expect/_interceptors/_interceptors.js +++ b/pkg/dev_compiler/test/codegen/expect/_interceptors/_interceptors.js @@ -1,5 +1,5 @@ var _interceptors; -(function(_interceptors) { +(function(exports) { 'use strict'; // Function _symbolToString: (Symbol) → String function _symbolToString(symbol) { @@ -83,16 +83,16 @@ var _interceptors; } return interceptor; } - dart.copyProperties(_interceptors, { + dart.copyProperties(exports, { get mapTypeToInterceptor() { return _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_names.MAP_TYPE_TO_INTERCEPTOR, core.String)); } }); // Function findIndexForNativeSubclassType: (Type) → int function findIndexForNativeSubclassType(type) { - if (_interceptors.mapTypeToInterceptor == null) + if (exports.mapTypeToInterceptor == null) return dart.as(null, core.int); - let map = dart.as(_interceptors.mapTypeToInterceptor, core.List); + let map = dart.as(exports.mapTypeToInterceptor, core.List); for (let i = 0; i + 1 < map.length; i = 3) { if (dart.equals(type, map.get(i))) { return i; @@ -105,7 +105,7 @@ var _interceptors; let index = findIndexForNativeSubclassType(type); if (index === null) return null; - let map = dart.as(_interceptors.mapTypeToInterceptor, core.List); + let map = dart.as(exports.mapTypeToInterceptor, core.List); return map.get(index + 1); } // Function findConstructorForNativeSubclassType: (Type, String) → dynamic @@ -113,7 +113,7 @@ var _interceptors; let index = findIndexForNativeSubclassType(type); if (index === null) return null; - let map = dart.as(_interceptors.mapTypeToInterceptor, core.List); + let map = dart.as(exports.mapTypeToInterceptor, core.List); let constructorMap = map.get(index + 2); let constructorFn = constructorMap[name]; return constructorFn; @@ -1360,42 +1360,42 @@ var _interceptors; } } // Exports: - _interceptors.getInterceptor = getInterceptor; - _interceptors.getDispatchProperty = getDispatchProperty; - _interceptors.setDispatchProperty = setDispatchProperty; - _interceptors.makeDispatchRecord = makeDispatchRecord; - _interceptors.dispatchRecordInterceptor = dispatchRecordInterceptor; - _interceptors.dispatchRecordProto = dispatchRecordProto; - _interceptors.dispatchRecordExtension = dispatchRecordExtension; - _interceptors.dispatchRecordIndexability = dispatchRecordIndexability; - _interceptors.getNativeInterceptor = getNativeInterceptor; - _interceptors.mapTypeToInterceptor = mapTypeToInterceptor; - _interceptors.findIndexForNativeSubclassType = findIndexForNativeSubclassType; - _interceptors.findInterceptorConstructorForType = findInterceptorConstructorForType; - _interceptors.findConstructorForNativeSubclassType = findConstructorForNativeSubclassType; - _interceptors.findInterceptorForType = findInterceptorForType; - _interceptors.Interceptor = Interceptor; - _interceptors.JSBool = JSBool; - _interceptors.JSNull = JSNull; - _interceptors.JSIndexable = JSIndexable; - _interceptors.JSMutableIndexable = JSMutableIndexable; - _interceptors.JSObject = JSObject; - _interceptors.JavaScriptObject = JavaScriptObject; - _interceptors.PlainJavaScriptObject = PlainJavaScriptObject; - _interceptors.UnknownJavaScriptObject = UnknownJavaScriptObject; - _interceptors.JSArray = JSArray; - _interceptors.JSArray$ = JSArray$; - _interceptors.JSMutableArray = JSMutableArray; - _interceptors.JSMutableArray$ = JSMutableArray$; - _interceptors.JSFixedArray = JSFixedArray; - _interceptors.JSFixedArray$ = JSFixedArray$; - _interceptors.JSExtendableArray = JSExtendableArray; - _interceptors.JSExtendableArray$ = JSExtendableArray$; - _interceptors.JSNumber = JSNumber; - _interceptors.JSInt = JSInt; - _interceptors.JSDouble = JSDouble; - _interceptors.JSPositiveInt = JSPositiveInt; - _interceptors.JSUInt32 = JSUInt32; - _interceptors.JSUInt31 = JSUInt31; - _interceptors.JSString = JSString; + exports.getInterceptor = getInterceptor; + exports.getDispatchProperty = getDispatchProperty; + exports.setDispatchProperty = setDispatchProperty; + exports.makeDispatchRecord = makeDispatchRecord; + exports.dispatchRecordInterceptor = dispatchRecordInterceptor; + exports.dispatchRecordProto = dispatchRecordProto; + exports.dispatchRecordExtension = dispatchRecordExtension; + exports.dispatchRecordIndexability = dispatchRecordIndexability; + exports.getNativeInterceptor = getNativeInterceptor; + exports.mapTypeToInterceptor = mapTypeToInterceptor; + exports.findIndexForNativeSubclassType = findIndexForNativeSubclassType; + exports.findInterceptorConstructorForType = findInterceptorConstructorForType; + exports.findConstructorForNativeSubclassType = findConstructorForNativeSubclassType; + exports.findInterceptorForType = findInterceptorForType; + exports.Interceptor = Interceptor; + exports.JSBool = JSBool; + exports.JSNull = JSNull; + exports.JSIndexable = JSIndexable; + exports.JSMutableIndexable = JSMutableIndexable; + exports.JSObject = JSObject; + exports.JavaScriptObject = JavaScriptObject; + exports.PlainJavaScriptObject = PlainJavaScriptObject; + exports.UnknownJavaScriptObject = UnknownJavaScriptObject; + exports.JSArray = JSArray; + exports.JSArray$ = JSArray$; + exports.JSMutableArray = JSMutableArray; + exports.JSMutableArray$ = JSMutableArray$; + exports.JSFixedArray = JSFixedArray; + exports.JSFixedArray$ = JSFixedArray$; + exports.JSExtendableArray = JSExtendableArray; + exports.JSExtendableArray$ = JSExtendableArray$; + exports.JSNumber = JSNumber; + exports.JSInt = JSInt; + exports.JSDouble = JSDouble; + exports.JSPositiveInt = JSPositiveInt; + exports.JSUInt32 = JSUInt32; + exports.JSUInt31 = JSUInt31; + exports.JSString = JSString; })(_interceptors || (_interceptors = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/_internal/_internal.js b/pkg/dev_compiler/test/codegen/expect/_internal/_internal.js index 1d9aa77db09d..4b4de1b4b383 100644 --- a/pkg/dev_compiler/test/codegen/expect/_internal/_internal.js +++ b/pkg/dev_compiler/test/codegen/expect/_internal/_internal.js @@ -1,5 +1,5 @@ var _internal; -(function(_internal) { +(function(exports) { 'use strict'; let POWERS_OF_TEN = /* Unimplemented const */new List.from([1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, 10000000.0, 100000000.0, 1000000000.0, 10000000000.0, 100000000000.0, 1000000000000.0, 10000000000000.0, 100000000000000.0, 1000000000000000.0, 10000000000000000.0, 100000000000000000.0, 1000000000000000000.0, 10000000000000000000.0, 100000000000000000000.0, 1e+21, 1e+22]); class EfficientLength extends dart.Object { @@ -1515,7 +1515,7 @@ var _internal; } } } - _internal.printToZone = null; + exports.printToZone = null; // Function printToConsole: (String) → void function printToConsole(line) { _js_primitives.printString(`${line}`); @@ -1793,76 +1793,76 @@ var _internal; } }); // Exports: - _internal.POWERS_OF_TEN = POWERS_OF_TEN; - _internal.EfficientLength = EfficientLength; - _internal.ListIterable = ListIterable; - _internal.ListIterable$ = ListIterable$; - _internal.SubListIterable = SubListIterable; - _internal.SubListIterable$ = SubListIterable$; - _internal.ListIterator = ListIterator; - _internal.ListIterator$ = ListIterator$; - _internal.MappedIterable = MappedIterable; - _internal.MappedIterable$ = MappedIterable$; - _internal.EfficientLengthMappedIterable = EfficientLengthMappedIterable; - _internal.EfficientLengthMappedIterable$ = EfficientLengthMappedIterable$; - _internal.MappedIterator = MappedIterator; - _internal.MappedIterator$ = MappedIterator$; - _internal.MappedListIterable = MappedListIterable; - _internal.MappedListIterable$ = MappedListIterable$; - _internal.WhereIterable = WhereIterable; - _internal.WhereIterable$ = WhereIterable$; - _internal.WhereIterator = WhereIterator; - _internal.WhereIterator$ = WhereIterator$; - _internal.ExpandIterable = ExpandIterable; - _internal.ExpandIterable$ = ExpandIterable$; - _internal.ExpandIterator = ExpandIterator; - _internal.ExpandIterator$ = ExpandIterator$; - _internal.TakeIterable = TakeIterable; - _internal.TakeIterable$ = TakeIterable$; - _internal.EfficientLengthTakeIterable = EfficientLengthTakeIterable; - _internal.EfficientLengthTakeIterable$ = EfficientLengthTakeIterable$; - _internal.TakeIterator = TakeIterator; - _internal.TakeIterator$ = TakeIterator$; - _internal.TakeWhileIterable = TakeWhileIterable; - _internal.TakeWhileIterable$ = TakeWhileIterable$; - _internal.TakeWhileIterator = TakeWhileIterator; - _internal.TakeWhileIterator$ = TakeWhileIterator$; - _internal.SkipIterable = SkipIterable; - _internal.SkipIterable$ = SkipIterable$; - _internal.EfficientLengthSkipIterable = EfficientLengthSkipIterable; - _internal.EfficientLengthSkipIterable$ = EfficientLengthSkipIterable$; - _internal.SkipIterator = SkipIterator; - _internal.SkipIterator$ = SkipIterator$; - _internal.SkipWhileIterable = SkipWhileIterable; - _internal.SkipWhileIterable$ = SkipWhileIterable$; - _internal.SkipWhileIterator = SkipWhileIterator; - _internal.SkipWhileIterator$ = SkipWhileIterator$; - _internal.EmptyIterable = EmptyIterable; - _internal.EmptyIterable$ = EmptyIterable$; - _internal.EmptyIterator = EmptyIterator; - _internal.EmptyIterator$ = EmptyIterator$; - _internal.BidirectionalIterator = BidirectionalIterator; - _internal.BidirectionalIterator$ = BidirectionalIterator$; - _internal.IterableMixinWorkaround = IterableMixinWorkaround; - _internal.IterableMixinWorkaround$ = IterableMixinWorkaround$; - _internal.IterableElementError = IterableElementError; - _internal.FixedLengthListMixin = FixedLengthListMixin; - _internal.FixedLengthListMixin$ = FixedLengthListMixin$; - _internal.UnmodifiableListMixin = UnmodifiableListMixin; - _internal.UnmodifiableListMixin$ = UnmodifiableListMixin$; - _internal.FixedLengthListBase = FixedLengthListBase; - _internal.FixedLengthListBase$ = FixedLengthListBase$; - _internal.UnmodifiableListBase = UnmodifiableListBase; - _internal.UnmodifiableListBase$ = UnmodifiableListBase$; - _internal.ListMapView = ListMapView; - _internal.ListMapView$ = ListMapView$; - _internal.ReversedListIterable = ReversedListIterable; - _internal.ReversedListIterable$ = ReversedListIterable$; - _internal.UnmodifiableListError = UnmodifiableListError; - _internal.NonGrowableListError = NonGrowableListError; - _internal.makeListFixedLength = makeListFixedLength; - _internal.Lists = Lists; - _internal.printToConsole = printToConsole; - _internal.Sort = Sort; - _internal.Symbol = Symbol; + exports.POWERS_OF_TEN = POWERS_OF_TEN; + exports.EfficientLength = EfficientLength; + exports.ListIterable = ListIterable; + exports.ListIterable$ = ListIterable$; + exports.SubListIterable = SubListIterable; + exports.SubListIterable$ = SubListIterable$; + exports.ListIterator = ListIterator; + exports.ListIterator$ = ListIterator$; + exports.MappedIterable = MappedIterable; + exports.MappedIterable$ = MappedIterable$; + exports.EfficientLengthMappedIterable = EfficientLengthMappedIterable; + exports.EfficientLengthMappedIterable$ = EfficientLengthMappedIterable$; + exports.MappedIterator = MappedIterator; + exports.MappedIterator$ = MappedIterator$; + exports.MappedListIterable = MappedListIterable; + exports.MappedListIterable$ = MappedListIterable$; + exports.WhereIterable = WhereIterable; + exports.WhereIterable$ = WhereIterable$; + exports.WhereIterator = WhereIterator; + exports.WhereIterator$ = WhereIterator$; + exports.ExpandIterable = ExpandIterable; + exports.ExpandIterable$ = ExpandIterable$; + exports.ExpandIterator = ExpandIterator; + exports.ExpandIterator$ = ExpandIterator$; + exports.TakeIterable = TakeIterable; + exports.TakeIterable$ = TakeIterable$; + exports.EfficientLengthTakeIterable = EfficientLengthTakeIterable; + exports.EfficientLengthTakeIterable$ = EfficientLengthTakeIterable$; + exports.TakeIterator = TakeIterator; + exports.TakeIterator$ = TakeIterator$; + exports.TakeWhileIterable = TakeWhileIterable; + exports.TakeWhileIterable$ = TakeWhileIterable$; + exports.TakeWhileIterator = TakeWhileIterator; + exports.TakeWhileIterator$ = TakeWhileIterator$; + exports.SkipIterable = SkipIterable; + exports.SkipIterable$ = SkipIterable$; + exports.EfficientLengthSkipIterable = EfficientLengthSkipIterable; + exports.EfficientLengthSkipIterable$ = EfficientLengthSkipIterable$; + exports.SkipIterator = SkipIterator; + exports.SkipIterator$ = SkipIterator$; + exports.SkipWhileIterable = SkipWhileIterable; + exports.SkipWhileIterable$ = SkipWhileIterable$; + exports.SkipWhileIterator = SkipWhileIterator; + exports.SkipWhileIterator$ = SkipWhileIterator$; + exports.EmptyIterable = EmptyIterable; + exports.EmptyIterable$ = EmptyIterable$; + exports.EmptyIterator = EmptyIterator; + exports.EmptyIterator$ = EmptyIterator$; + exports.BidirectionalIterator = BidirectionalIterator; + exports.BidirectionalIterator$ = BidirectionalIterator$; + exports.IterableMixinWorkaround = IterableMixinWorkaround; + exports.IterableMixinWorkaround$ = IterableMixinWorkaround$; + exports.IterableElementError = IterableElementError; + exports.FixedLengthListMixin = FixedLengthListMixin; + exports.FixedLengthListMixin$ = FixedLengthListMixin$; + exports.UnmodifiableListMixin = UnmodifiableListMixin; + exports.UnmodifiableListMixin$ = UnmodifiableListMixin$; + exports.FixedLengthListBase = FixedLengthListBase; + exports.FixedLengthListBase$ = FixedLengthListBase$; + exports.UnmodifiableListBase = UnmodifiableListBase; + exports.UnmodifiableListBase$ = UnmodifiableListBase$; + exports.ListMapView = ListMapView; + exports.ListMapView$ = ListMapView$; + exports.ReversedListIterable = ReversedListIterable; + exports.ReversedListIterable$ = ReversedListIterable$; + exports.UnmodifiableListError = UnmodifiableListError; + exports.NonGrowableListError = NonGrowableListError; + exports.makeListFixedLength = makeListFixedLength; + exports.Lists = Lists; + exports.printToConsole = printToConsole; + exports.Sort = Sort; + exports.Symbol = Symbol; })(_internal || (_internal = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/_isolate_helper/_isolate_helper.js b/pkg/dev_compiler/test/codegen/expect/_isolate_helper/_isolate_helper.js index 92af8cdd087e..5cbf0d6383b0 100644 --- a/pkg/dev_compiler/test/codegen/expect/_isolate_helper/_isolate_helper.js +++ b/pkg/dev_compiler/test/codegen/expect/_isolate_helper/_isolate_helper.js @@ -1,28 +1,28 @@ var _isolate_helper; -(function(_isolate_helper) { +(function(exports) { 'use strict'; // Function _callInIsolate: (_IsolateContext, Function) → dynamic function _callInIsolate(isolate, function) { let result = isolate.eval(function); - _isolate_helper._globalState.topEventLoop.run(); + exports._globalState.topEventLoop.run(); return result; } // Function enterJsAsync: () → dynamic function enterJsAsync() { - _isolate_helper._globalState.topEventLoop._activeJsAsyncCount++; + exports._globalState.topEventLoop._activeJsAsyncCount++; } // Function leaveJsAsync: () → dynamic function leaveJsAsync() { - _isolate_helper._globalState.topEventLoop._activeJsAsyncCount--; - dart.assert(_isolate_helper._globalState.topEventLoop._activeJsAsyncCount >= 0); + exports._globalState.topEventLoop._activeJsAsyncCount--; + dart.assert(exports._globalState.topEventLoop._activeJsAsyncCount >= 0); } // Function isWorker: () → bool function isWorker() { - return _isolate_helper._globalState.isWorker; + return exports._globalState.isWorker; } // Function _currentIsolate: () → _IsolateContext function _currentIsolate() { - return _isolate_helper._globalState.currentContext; + return exports._globalState.currentContext; } // Function startRootIsolate: (dynamic, dynamic) → void function startRootIsolate(entry, args) { @@ -32,12 +32,12 @@ var _isolate_helper; if (!dart.is(args, core.List)) { throw new core.ArgumentError(`Arguments to main must be a List: ${args}`); } - _isolate_helper._globalState = new _Manager(dart.as(entry, core.Function)); - if (_isolate_helper._globalState.isWorker) + exports._globalState = new _Manager(dart.as(entry, core.Function)); + if (exports._globalState.isWorker) return; let rootContext = new _IsolateContext(); - _isolate_helper._globalState.rootContext = rootContext; - _isolate_helper._globalState.currentContext = rootContext; + exports._globalState.rootContext = rootContext; + exports._globalState.currentContext = rootContext; if (dart.is(entry, _MainFunctionArgs)) { rootContext.eval(() => { dart.dinvokef(entry, args); @@ -49,9 +49,9 @@ var _isolate_helper; } else { rootContext.eval(dart.as(entry, core.Function)); } - _isolate_helper._globalState.topEventLoop.run(); + exports._globalState.topEventLoop.run(); } - dart.copyProperties(_isolate_helper, { + dart.copyProperties(exports, { get _globalState() { return dart.as(init.globalState, _Manager); }, @@ -87,9 +87,9 @@ var _isolate_helper; } } _nativeDetectEnvironment() { - let isWindowDefined = _isolate_helper.globalWindow !== null; - let isWorkerDefined = _isolate_helper.globalWorker !== null; - this.isWorker = dart.notNull(!dart.notNull(isWindowDefined)) && dart.notNull(_isolate_helper.globalPostMessageDefined); + let isWindowDefined = exports.globalWindow !== null; + let isWorkerDefined = exports.globalWorker !== null; + this.isWorker = dart.notNull(!dart.notNull(isWindowDefined)) && dart.notNull(exports.globalPostMessageDefined); this.supportsWorkers = dart.notNull(this.isWorker) || dart.notNull(dart.notNull(isWorkerDefined) && dart.notNull(IsolateNatives.thisScript !== null)); this.fromCommandLine = dart.notNull(!dart.notNull(isWindowDefined)) && dart.notNull(!dart.notNull(this.isWorker)); } @@ -121,7 +121,7 @@ var _isolate_helper; } class _IsolateContext extends dart.Object { _IsolateContext() { - this.id = _isolate_helper._globalState.nextIsolateId++; + this.id = exports._globalState.nextIsolateId++; this.ports = new core.Map(); this.weakPorts = new core.Set(); this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE(); @@ -154,7 +154,7 @@ var _isolate_helper; if (this.pauseTokens.isEmpty) { while (this.delayedEvents.isNotEmpty) { let event = this.delayedEvents.removeLast(); - _isolate_helper._globalState.topEventLoop.prequeue(event); + exports._globalState.topEventLoop.prequeue(event); } this.isPaused = false; } @@ -188,7 +188,7 @@ var _isolate_helper; responsePort.send(null); } if (pingType === isolate.Isolate.AS_EVENT) { - _isolate_helper._globalState.topEventLoop.enqueue(this, respond, "ping"); + exports._globalState.topEventLoop.enqueue(this, respond, "ping"); return; } dart.assert(pingType === isolate.Isolate.BEFORE_NEXT_EVENT); @@ -205,7 +205,7 @@ var _isolate_helper; return; } if (priority === isolate.Isolate.AS_EVENT) { - _isolate_helper._globalState.topEventLoop.enqueue(this, this.kill, "kill"); + exports._globalState.topEventLoop.enqueue(this, this.kill, "kill"); return; } dart.assert(priority === isolate.Isolate.BEFORE_NEXT_EVENT); @@ -222,7 +222,7 @@ var _isolate_helper; } handleUncaughtError(error, stackTrace) { if (this.errorPorts.isEmpty) { - if (dart.notNull(this.errorsAreFatal) && dart.notNull(core.identical(this, _isolate_helper._globalState.rootContext))) { + if (dart.notNull(this.errorsAreFatal) && dart.notNull(core.identical(this, exports._globalState.rootContext))) { return; } if (self.console && self.console.error) { @@ -241,8 +241,8 @@ var _isolate_helper; port.send(message); } eval(code) { - let old = _isolate_helper._globalState.currentContext; - _isolate_helper._globalState.currentContext = this; + let old = exports._globalState.currentContext; + exports._globalState.currentContext = this; this._setGlobals(); let result = null; this._isExecutingEvent = true; @@ -253,14 +253,14 @@ var _isolate_helper; this.handleUncaughtError(e, s); if (this.errorsAreFatal) { this.kill(); - if (core.identical(this, _isolate_helper._globalState.rootContext)) { + if (core.identical(this, exports._globalState.rootContext)) { dart.throw_("Unimplemented RethrowExpression: rethrow"); } } } finally { this._isExecutingEvent = false; - _isolate_helper._globalState.currentContext = old; + exports._globalState.currentContext = old; if (old !== null) old._setGlobals(); if (this._scheduledControlEvents !== null) { @@ -325,7 +325,7 @@ var _isolate_helper; } _updateGlobalState() { if (dart.notNull(dart.notNull(this.ports.length - this.weakPorts.length > 0) || dart.notNull(this.isPaused)) || dart.notNull(!dart.notNull(this.initialized))) { - _isolate_helper._globalState.isolates.set(this.id, this); + exports._globalState.isolates.set(this.id, this); } else { this.kill(); } @@ -339,7 +339,7 @@ var _isolate_helper; } this.ports.clear(); this.weakPorts.clear(); - _isolate_helper._globalState.isolates.remove(this.id); + exports._globalState.isolates.remove(this.id); this.errorPorts.clear(); if (this.doneHandlers !== null) { for (let port of this.doneHandlers) { @@ -371,7 +371,7 @@ var _isolate_helper; return this.events.removeFirst(); } checkOpenReceivePortsFromCommandLine() { - if (dart.notNull(dart.notNull(dart.notNull(_isolate_helper._globalState.rootContext !== null) && dart.notNull(_isolate_helper._globalState.isolates.containsKey(_isolate_helper._globalState.rootContext.id))) && dart.notNull(_isolate_helper._globalState.fromCommandLine)) && dart.notNull(_isolate_helper._globalState.rootContext.ports.isEmpty)) { + if (dart.notNull(dart.notNull(dart.notNull(exports._globalState.rootContext !== null) && dart.notNull(exports._globalState.isolates.containsKey(exports._globalState.rootContext.id))) && dart.notNull(exports._globalState.fromCommandLine)) && dart.notNull(exports._globalState.rootContext.ports.isEmpty)) { throw new core.Exception("Program exited with open ReceivePorts."); } } @@ -379,14 +379,14 @@ var _isolate_helper; let event = this.dequeue(); if (event === null) { this.checkOpenReceivePortsFromCommandLine(); - _isolate_helper._globalState.maybeCloseWorker(); + exports._globalState.maybeCloseWorker(); return false; } event.process(); return true; } _runHelper() { - if (_isolate_helper.globalWindow !== null) { + if (exports.globalWindow !== null) { // Function next: () → void function next() { if (!dart.notNull(this.runIteration())) @@ -400,14 +400,14 @@ var _isolate_helper; } } run() { - if (!dart.notNull(_isolate_helper._globalState.isWorker)) { + if (!dart.notNull(exports._globalState.isWorker)) { this._runHelper(); } else { try { this._runHelper(); } catch (e) { let trace = dart.stackTrace(e); - _isolate_helper._globalState.mainManager.postMessage(_serializeMessage(dart.map({command: 'error', msg: `${e}\n${trace}`}))); + exports._globalState.mainManager.postMessage(_serializeMessage(dart.map({command: 'error', msg: `${e}\n${trace}`}))); } } @@ -435,7 +435,7 @@ var _isolate_helper; } let _SPAWNED_SIGNAL = "spawned"; let _SPAWN_FAILED_SIGNAL = "spawn failed"; - dart.copyProperties(_isolate_helper, { + dart.copyProperties(exports, { get globalWindow() { _js_helper.requiresPreamble(); return self.window; @@ -459,7 +459,7 @@ var _isolate_helper; return computeThisScriptD8(); if (_js_helper.Primitives.isJsshell) return computeThisScriptJsshell(); - if (_isolate_helper._globalState.isWorker) + if (exports._globalState.isWorker) return computeThisScriptFromTrace(); return null; } @@ -501,20 +501,20 @@ var _isolate_helper; let msg = _deserializeMessage(_getEventData(e)); switch (dart.dindex(msg, 'command')) { case 'start': - _isolate_helper._globalState.currentManagerId = dart.as(dart.dindex(msg, 'id'), core.int); + exports._globalState.currentManagerId = dart.as(dart.dindex(msg, 'id'), core.int); let functionName = dart.as(dart.dindex(msg, 'functionName'), core.String); - let entryPoint = dart.as(functionName === null ? _isolate_helper._globalState.entry : _getJSFunctionFromName(functionName), core.Function); + let entryPoint = dart.as(functionName === null ? exports._globalState.entry : _getJSFunctionFromName(functionName), core.Function); let args = dart.dindex(msg, 'args'); let message = _deserializeMessage(dart.dindex(msg, 'msg')); let isSpawnUri = dart.dindex(msg, 'isSpawnUri'); let startPaused = dart.dindex(msg, 'startPaused'); let replyTo = _deserializeMessage(dart.dindex(msg, 'replyTo')); let context = new _IsolateContext(); - _isolate_helper._globalState.topEventLoop.enqueue(context, () => { + exports._globalState.topEventLoop.enqueue(context, () => { _startIsolate(entryPoint, dart.as(args, core.List$(core.String)), message, dart.as(isSpawnUri, core.bool), dart.as(startPaused, core.bool), dart.as(replyTo, isolate.SendPort)); }, 'worker-start'); - _isolate_helper._globalState.currentContext = context; - _isolate_helper._globalState.topEventLoop.run(); + exports._globalState.currentContext = context; + exports._globalState.topEventLoop.run(); break; case 'spawn-worker': if (enableSpawnWorker !== null) @@ -525,19 +525,19 @@ var _isolate_helper; if (port !== null) { dart.dinvoke(dart.dindex(msg, 'port'), 'send', dart.dindex(msg, 'msg')); } - _isolate_helper._globalState.topEventLoop.run(); + exports._globalState.topEventLoop.run(); break; case 'close': - _isolate_helper._globalState.managers.remove(workerIds.get(sender)); + exports._globalState.managers.remove(workerIds.get(sender)); sender.terminate(); - _isolate_helper._globalState.topEventLoop.run(); + exports._globalState.topEventLoop.run(); break; case 'log': _log(dart.dindex(msg, 'msg')); break; case 'print': - if (_isolate_helper._globalState.isWorker) { - _isolate_helper._globalState.mainManager.postMessage(_serializeMessage(dart.map({command: 'print', msg: msg}))); + if (exports._globalState.isWorker) { + exports._globalState.mainManager.postMessage(_serializeMessage(dart.map({command: 'print', msg: msg}))); } else { core.print(dart.dindex(msg, 'msg')); } @@ -557,8 +557,8 @@ var _isolate_helper; }); } static _log(msg) { - if (_isolate_helper._globalState.isWorker) { - _isolate_helper._globalState.mainManager.postMessage(_serializeMessage(dart.map({command: 'log', msg: msg}))); + if (exports._globalState.isWorker) { + exports._globalState.mainManager.postMessage(_serializeMessage(dart.map({command: 'log', msg: msg}))); } else { try { _consoleLog(msg); @@ -613,7 +613,7 @@ var _isolate_helper; } }).bind(this)); let signalReply = port.sendPort; - if (dart.notNull(_isolate_helper._globalState.useWorkers) && dart.notNull(!dart.notNull(isLight))) { + if (dart.notNull(exports._globalState.useWorkers) && dart.notNull(!dart.notNull(isLight))) { _startWorker(functionName, uri, args, message, isSpawnUri, startPaused, signalReply, ((message) => completer.completeError(message)).bind(this)); } else { _startNonWorker(functionName, uri, args, message, isSpawnUri, startPaused, signalReply); @@ -623,8 +623,8 @@ var _isolate_helper; static _startWorker(functionName, uri, args, message, isSpawnUri, startPaused, replyPort, onError) { if (args !== null) args = new core.List.from(args); - if (_isolate_helper._globalState.isWorker) { - _isolate_helper._globalState.mainManager.postMessage(_serializeMessage(dart.map({command: 'spawn-worker', functionName: functionName, args: args, msg: message, uri: uri, isSpawnUri: isSpawnUri, startPaused: startPaused, replyPort: replyPort}))); + if (exports._globalState.isWorker) { + exports._globalState.mainManager.postMessage(_serializeMessage(dart.map({command: 'spawn-worker', functionName: functionName, args: args, msg: message, uri: uri, isSpawnUri: isSpawnUri, startPaused: startPaused, replyPort: replyPort}))); } else { _spawnWorker(functionName, uri, args, message, isSpawnUri, startPaused, replyPort, onError); } @@ -636,7 +636,7 @@ var _isolate_helper; message = _clone(message); if (args !== null) args = new core.List.from(args); - _isolate_helper._globalState.topEventLoop.enqueue(new _IsolateContext(), () => { + exports._globalState.topEventLoop.enqueue(new _IsolateContext(), () => { let func = _getJSFunctionFromName(functionName); _startIsolate(dart.as(func, core.Function), args, message, isSpawnUri, startPaused, replyPort); }, 'nonworker start'); @@ -664,7 +664,7 @@ var _isolate_helper; } if (startPaused) { context.addPause(context.pauseCapability, context.pauseCapability); - _isolate_helper._globalState.topEventLoop.enqueue(context, runStartFunction, 'start isolate'); + exports._globalState.topEventLoop.enqueue(context, runStartFunction, 'start isolate'); } else { runStartFunction(); } @@ -686,9 +686,9 @@ var _isolate_helper; }; }(_foreign_helper.DART_CLOSURE_TO_JS(_processWorkerMessage), worker); worker.onmessage = processWorkerMessageTrampoline; - let workerId = _isolate_helper._globalState.nextManagerId++; + let workerId = exports._globalState.nextManagerId++; workerIds.set(worker, workerId); - _isolate_helper._globalState.managers.set(workerId, worker); + exports._globalState.managers.set(workerId, worker); worker.postMessage(_serializeMessage(dart.map({command: 'start', id: workerId, replyTo: _serializeMessage(replyPort), args: args, msg: _serializeMessage(message), isSpawnUri: isSpawnUri, startPaused: startPaused, functionName: functionName}))); } static workerOnError(event, uri, onError) { @@ -729,7 +729,7 @@ var _isolate_helper; super._BaseSendPort(isolateId); } send(message) { - let isolate = _isolate_helper._globalState.isolates.get(this._isolateId); + let isolate = exports._globalState.isolates.get(this._isolateId); if (isolate === null) return; if (this._receivePort._isClosed) @@ -739,7 +739,7 @@ var _isolate_helper; isolate.handleControlMessage(msg); return; } - _isolate_helper._globalState.topEventLoop.enqueue(isolate, (() => { + exports._globalState.topEventLoop.enqueue(isolate, (() => { if (!dart.notNull(this._receivePort._isClosed)) { this._receivePort._add(msg); } @@ -760,10 +760,10 @@ var _isolate_helper; } send(message) { let workerMessage = _serializeMessage(dart.map({command: 'message', port: this, msg: message})); - if (_isolate_helper._globalState.isWorker) { - _isolate_helper._globalState.mainManager.postMessage(workerMessage); + if (exports._globalState.isWorker) { + exports._globalState.mainManager.postMessage(workerMessage); } else { - let manager = _isolate_helper._globalState.managers.get(this._workerId); + let manager = exports._globalState.managers.get(this._workerId); if (manager !== null) { manager.postMessage(workerMessage); } @@ -781,13 +781,13 @@ var _isolate_helper; this._handler = _handler; this._id = _nextFreeId++; this._isClosed = false; - _isolate_helper._globalState.currentContext.register(this._id, this); + exports._globalState.currentContext.register(this._id, this); } RawReceivePortImpl$weak(_handler) { this._handler = _handler; this._id = _nextFreeId++; this._isClosed = false; - _isolate_helper._globalState.currentContext.registerWeak(this._id, this); + exports._globalState.currentContext.registerWeak(this._id, this); } RawReceivePortImpl$_controlPort() { this._handler = null; @@ -806,7 +806,7 @@ var _isolate_helper; return; this._isClosed = true; this._handler = null; - _isolate_helper._globalState.currentContext.unregister(this._id); + exports._globalState.currentContext.unregister(this._id); } _add(dataEvent) { if (this._isClosed) @@ -814,7 +814,7 @@ var _isolate_helper; dart.dinvokef(this._handler, dataEvent); } get sendPort() { - return new _NativeJsSendPort(this, _isolate_helper._globalState.currentContext.id); + return new _NativeJsSendPort(this, exports._globalState.currentContext.id); } } dart.defineNamedConstructor(RawReceivePortImpl, 'weak'); @@ -855,14 +855,14 @@ var _isolate_helper; this._once = true; this._inEventLoop = false; this._handle = dart.as(null, core.int); - if (dart.notNull(milliseconds === 0) && dart.notNull(dart.notNull(!dart.notNull(hasTimer())) || dart.notNull(_isolate_helper._globalState.isWorker))) { + if (dart.notNull(milliseconds === 0) && dart.notNull(dart.notNull(!dart.notNull(hasTimer())) || dart.notNull(exports._globalState.isWorker))) { // Function internalCallback: () → void function internalCallback() { this._handle = dart.as(null, core.int); callback(); } this._handle = 1; - _isolate_helper._globalState.topEventLoop.enqueue(_isolate_helper._globalState.currentContext, internalCallback, 'timer'); + exports._globalState.topEventLoop.enqueue(exports._globalState.currentContext, internalCallback, 'timer'); this._inEventLoop = true; } else if (hasTimer()) { // Function internalCallback: () → void @@ -1072,7 +1072,7 @@ var _isolate_helper; } serializeJsSendPort(x) { if (this._serializeSendPorts) { - let workerId = _isolate_helper._globalState.currentManagerId; + let workerId = exports._globalState.currentManagerId; return new List.from(['sendport', workerId, x._isolateId, x._receivePort._id]); } return new List.from(['raw sendport', x]); @@ -1208,8 +1208,8 @@ var _isolate_helper; let isolateId = dart.as(dart.dindex(x, 2), core.int); let receivePortId = dart.as(dart.dindex(x, 3), core.int); let result = null; - if (managerId === _isolate_helper._globalState.currentManagerId) { - let isolate = _isolate_helper._globalState.isolates.get(isolateId); + if (managerId === exports._globalState.currentManagerId) { + let isolate = exports._globalState.isolates.get(isolateId); if (isolate === null) return null; let receivePort = isolate.lookup(receivePortId); @@ -1259,17 +1259,17 @@ var _isolate_helper; } } // Exports: - _isolate_helper.enterJsAsync = enterJsAsync; - _isolate_helper.leaveJsAsync = leaveJsAsync; - _isolate_helper.isWorker = isWorker; - _isolate_helper.startRootIsolate = startRootIsolate; - _isolate_helper.globalWindow = globalWindow; - _isolate_helper.globalWorker = globalWorker; - _isolate_helper.globalPostMessageDefined = globalPostMessageDefined; - _isolate_helper.IsolateNatives = IsolateNatives; - _isolate_helper.RawReceivePortImpl = RawReceivePortImpl; - _isolate_helper.ReceivePortImpl = ReceivePortImpl; - _isolate_helper.TimerImpl = TimerImpl; - _isolate_helper.hasTimer = hasTimer; - _isolate_helper.CapabilityImpl = CapabilityImpl; + exports.enterJsAsync = enterJsAsync; + exports.leaveJsAsync = leaveJsAsync; + exports.isWorker = isWorker; + exports.startRootIsolate = startRootIsolate; + exports.globalWindow = globalWindow; + exports.globalWorker = globalWorker; + exports.globalPostMessageDefined = globalPostMessageDefined; + exports.IsolateNatives = IsolateNatives; + exports.RawReceivePortImpl = RawReceivePortImpl; + exports.ReceivePortImpl = ReceivePortImpl; + exports.TimerImpl = TimerImpl; + exports.hasTimer = hasTimer; + exports.CapabilityImpl = CapabilityImpl; })(_isolate_helper || (_isolate_helper = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/_js_embedded_names/_js_embedded_names.js b/pkg/dev_compiler/test/codegen/expect/_js_embedded_names/_js_embedded_names.js index ffa37258d4be..ee5675353cf4 100644 --- a/pkg/dev_compiler/test/codegen/expect/_js_embedded_names/_js_embedded_names.js +++ b/pkg/dev_compiler/test/codegen/expect/_js_embedded_names/_js_embedded_names.js @@ -1,5 +1,5 @@ var _js_embedded_names; -(function(_js_embedded_names) { +(function(exports) { 'use strict'; let DISPATCH_PROPERTY_NAME = "dispatchPropertyName"; let TYPE_INFORMATION = 'typeInformation'; @@ -33,35 +33,35 @@ var _js_embedded_names; let NATIVE_SUPERCLASS_TAG_NAME = "$nativeSuperclassTag"; let MAP_TYPE_TO_INTERCEPTOR = "mapTypeToInterceptor"; // Exports: - _js_embedded_names.DISPATCH_PROPERTY_NAME = DISPATCH_PROPERTY_NAME; - _js_embedded_names.TYPE_INFORMATION = TYPE_INFORMATION; - _js_embedded_names.GLOBAL_FUNCTIONS = GLOBAL_FUNCTIONS; - _js_embedded_names.STATICS = STATICS; - _js_embedded_names.INTERCEPTED_NAMES = INTERCEPTED_NAMES; - _js_embedded_names.MANGLED_GLOBAL_NAMES = MANGLED_GLOBAL_NAMES; - _js_embedded_names.MANGLED_NAMES = MANGLED_NAMES; - _js_embedded_names.LIBRARIES = LIBRARIES; - _js_embedded_names.FINISHED_CLASSES = FINISHED_CLASSES; - _js_embedded_names.ALL_CLASSES = ALL_CLASSES; - _js_embedded_names.METADATA = METADATA; - _js_embedded_names.INTERCEPTORS_BY_TAG = INTERCEPTORS_BY_TAG; - _js_embedded_names.LEAF_TAGS = LEAF_TAGS; - _js_embedded_names.LAZIES = LAZIES; - _js_embedded_names.GET_ISOLATE_TAG = GET_ISOLATE_TAG; - _js_embedded_names.ISOLATE_TAG = ISOLATE_TAG; - _js_embedded_names.CURRENT_SCRIPT = CURRENT_SCRIPT; - _js_embedded_names.DEFERRED_LIBRARY_URIS = DEFERRED_LIBRARY_URIS; - _js_embedded_names.DEFERRED_LIBRARY_HASHES = DEFERRED_LIBRARY_HASHES; - _js_embedded_names.INITIALIZE_LOADED_HUNK = INITIALIZE_LOADED_HUNK; - _js_embedded_names.IS_HUNK_LOADED = IS_HUNK_LOADED; - _js_embedded_names.IS_HUNK_INITIALIZED = IS_HUNK_INITIALIZED; - _js_embedded_names.DEFERRED_INITIALIZED = DEFERRED_INITIALIZED; - _js_embedded_names.CLASS_ID_EXTRACTOR = CLASS_ID_EXTRACTOR; - _js_embedded_names.CLASS_FIELDS_EXTRACTOR = CLASS_FIELDS_EXTRACTOR; - _js_embedded_names.INSTANCE_FROM_CLASS_ID = INSTANCE_FROM_CLASS_ID; - _js_embedded_names.INITIALIZE_EMPTY_INSTANCE = INITIALIZE_EMPTY_INSTANCE; - _js_embedded_names.TYPEDEF_TYPE_PROPERTY_NAME = TYPEDEF_TYPE_PROPERTY_NAME; - _js_embedded_names.TYPEDEF_PREDICATE_PROPERTY_NAME = TYPEDEF_PREDICATE_PROPERTY_NAME; - _js_embedded_names.NATIVE_SUPERCLASS_TAG_NAME = NATIVE_SUPERCLASS_TAG_NAME; - _js_embedded_names.MAP_TYPE_TO_INTERCEPTOR = MAP_TYPE_TO_INTERCEPTOR; + exports.DISPATCH_PROPERTY_NAME = DISPATCH_PROPERTY_NAME; + exports.TYPE_INFORMATION = TYPE_INFORMATION; + exports.GLOBAL_FUNCTIONS = GLOBAL_FUNCTIONS; + exports.STATICS = STATICS; + exports.INTERCEPTED_NAMES = INTERCEPTED_NAMES; + exports.MANGLED_GLOBAL_NAMES = MANGLED_GLOBAL_NAMES; + exports.MANGLED_NAMES = MANGLED_NAMES; + exports.LIBRARIES = LIBRARIES; + exports.FINISHED_CLASSES = FINISHED_CLASSES; + exports.ALL_CLASSES = ALL_CLASSES; + exports.METADATA = METADATA; + exports.INTERCEPTORS_BY_TAG = INTERCEPTORS_BY_TAG; + exports.LEAF_TAGS = LEAF_TAGS; + exports.LAZIES = LAZIES; + exports.GET_ISOLATE_TAG = GET_ISOLATE_TAG; + exports.ISOLATE_TAG = ISOLATE_TAG; + exports.CURRENT_SCRIPT = CURRENT_SCRIPT; + exports.DEFERRED_LIBRARY_URIS = DEFERRED_LIBRARY_URIS; + exports.DEFERRED_LIBRARY_HASHES = DEFERRED_LIBRARY_HASHES; + exports.INITIALIZE_LOADED_HUNK = INITIALIZE_LOADED_HUNK; + exports.IS_HUNK_LOADED = IS_HUNK_LOADED; + exports.IS_HUNK_INITIALIZED = IS_HUNK_INITIALIZED; + exports.DEFERRED_INITIALIZED = DEFERRED_INITIALIZED; + exports.CLASS_ID_EXTRACTOR = CLASS_ID_EXTRACTOR; + exports.CLASS_FIELDS_EXTRACTOR = CLASS_FIELDS_EXTRACTOR; + exports.INSTANCE_FROM_CLASS_ID = INSTANCE_FROM_CLASS_ID; + exports.INITIALIZE_EMPTY_INSTANCE = INITIALIZE_EMPTY_INSTANCE; + exports.TYPEDEF_TYPE_PROPERTY_NAME = TYPEDEF_TYPE_PROPERTY_NAME; + exports.TYPEDEF_PREDICATE_PROPERTY_NAME = TYPEDEF_PREDICATE_PROPERTY_NAME; + exports.NATIVE_SUPERCLASS_TAG_NAME = NATIVE_SUPERCLASS_TAG_NAME; + exports.MAP_TYPE_TO_INTERCEPTOR = MAP_TYPE_TO_INTERCEPTOR; })(_js_embedded_names || (_js_embedded_names = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/_js_helper/_js_helper.js b/pkg/dev_compiler/test/codegen/expect/_js_helper/_js_helper.js index 5505043ab327..077ce0efceed 100644 --- a/pkg/dev_compiler/test/codegen/expect/_js_helper/_js_helper.js +++ b/pkg/dev_compiler/test/codegen/expect/_js_helper/_js_helper.js @@ -1,5 +1,5 @@ var _js_helper; -(function(_js_helper) { +(function(exports) { 'use strict'; class _Patch extends dart.Object { _Patch() { @@ -1783,7 +1783,7 @@ var _js_helper; } // Function checkDeferredIsLoaded: (String, String) → void function checkDeferredIsLoaded(loadId, uri) { - if (!dart.notNull(_js_helper._loadedLibraries.contains(loadId))) { + if (!dart.notNull(exports._loadedLibraries.contains(loadId))) { throw new DeferredNotLoadedError(uri); } } @@ -2236,7 +2236,7 @@ var _js_helper; function _loadLibraryWrapper(loadId) { return () => loadDeferredLibrary(loadId); } - dart.defineLazyProperties(_js_helper, { + dart.defineLazyProperties(exports, { get _loadingLibraries() { return dart.map(); }, @@ -2244,7 +2244,7 @@ var _js_helper; return new core.Set(); } }); - _js_helper.deferredLoadHook = null; + exports.deferredLoadHook = null; // Function loadDeferredLibrary: (String) → Future function loadDeferredLibrary(loadId) { let urisMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_names.DEFERRED_LIBRARY_URIS, core.String)); @@ -2263,15 +2263,15 @@ var _js_helper; let initializer = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_names.INITIALIZE_LOADED_HUNK, core.String)); initializer(hashes.get(i)); } - let updated = _js_helper._loadedLibraries.add(loadId); - if (dart.notNull(updated) && dart.notNull(_js_helper.deferredLoadHook !== null)) { - _js_helper.deferredLoadHook(); + let updated = exports._loadedLibraries.add(loadId); + if (dart.notNull(updated) && dart.notNull(exports.deferredLoadHook !== null)) { + exports.deferredLoadHook(); } }), async.Future$(core.Null)); } // Function _loadHunk: (String) → Future function _loadHunk(hunkName) { - let future = _js_helper._loadingLibraries.get(hunkName); + let future = exports._loadingLibraries.get(hunkName); if (future !== null) { return dart.as(future.then((_) => null), async.Future$(core.Null)); } @@ -2279,7 +2279,7 @@ var _js_helper; let index = uri.lastIndexOf('/'); uri = `${uri.substring(0, index + 1)}${hunkName}`; if (dart.notNull(Primitives.isJsshell) || dart.notNull(Primitives.isD8)) { - return _js_helper._loadingLibraries.set(hunkName, new async.Future(() => { + return exports._loadingLibraries.set(hunkName, new async.Future(() => { try { new Function(`load("${uri}")`)(); } catch (error) { @@ -2290,7 +2290,7 @@ var _js_helper; return null; })); } else if (_isolate_helper.isWorker()) { - return _js_helper._loadingLibraries.set(hunkName, new async.Future(() => { + return exports._loadingLibraries.set(hunkName, new async.Future(() => { let completer = new async.Completer(); _isolate_helper.enterJsAsync(); let leavingFuture = dart.as(completer.future.whenComplete(() => { @@ -2325,7 +2325,7 @@ var _js_helper; return leavingFuture; })); } - return _js_helper._loadingLibraries.set(hunkName, new async.Future(() => { + return exports._loadingLibraries.set(hunkName, new async.Future(() => { let completer = new async.Completer(); let script = document.createElement("script"); script.type = "text/javascript"; @@ -2570,12 +2570,12 @@ var _js_helper; function getPropertyFromPrototype(object, name) { return Object.getPrototypeOf(object)[name]; } - _js_helper.getTagFunction = null; - _js_helper.alternateTagFunction = null; - _js_helper.prototypeForTagFunction = null; + exports.getTagFunction = null; + exports.alternateTagFunction = null; + exports.prototypeForTagFunction = null; // Function toStringForNativeObject: (dynamic) → String function toStringForNativeObject(obj) { - let name = _js_helper.getTagFunction === null ? '' : dart.dinvokef(_js_helper.getTagFunction, obj); + let name = exports.getTagFunction === null ? '' : dart.dinvokef(exports.getTagFunction, obj); return `Instance of ${name}`; } // Function hashCodeForNativeObject: (dynamic) → int @@ -2590,7 +2590,7 @@ var _js_helper; function isDartObject(obj) { return obj instanceof _foreign_helper.JS_DART_OBJECT_CONSTRUCTOR(); } - dart.copyProperties(_js_helper, { + dart.copyProperties(exports, { get interceptorsByTag() { return _foreign_helper.JS_EMBEDDED_GLOBAL('=Object', dart.as(_js_embedded_names.INTERCEPTORS_BY_TAG, core.String)); }, @@ -2602,11 +2602,11 @@ var _js_helper; function findDispatchTagForInterceptorClass(interceptorClassConstructor) { return dart.as(interceptorClassConstructor[_js_embedded_names.NATIVE_SUPERCLASS_TAG_NAME], core.String); } - _js_helper.dispatchRecordsForInstanceTags = null; - _js_helper.interceptorsForUncacheableTags = null; + exports.dispatchRecordsForInstanceTags = null; + exports.interceptorsForUncacheableTags = null; // Function lookupInterceptor: (String) → dynamic function lookupInterceptor(tag) { - return propertyGet(_js_helper.interceptorsByTag, tag); + return propertyGet(exports.interceptorsByTag, tag); } let UNCACHED_MARK = '~'; let INSTANCE_CACHED_MARK = '!'; @@ -2616,21 +2616,21 @@ var _js_helper; // Function lookupAndCacheInterceptor: (dynamic) → dynamic function lookupAndCacheInterceptor(obj) { dart.assert(!dart.notNull(isDartObject(obj))); - let tag = dart.as(dart.dinvokef(_js_helper.getTagFunction, obj), core.String); - let record = propertyGet(_js_helper.dispatchRecordsForInstanceTags, tag); + let tag = dart.as(dart.dinvokef(exports.getTagFunction, obj), core.String); + let record = propertyGet(exports.dispatchRecordsForInstanceTags, tag); if (record !== null) return patchInstance(obj, record); - let interceptor = propertyGet(_js_helper.interceptorsForUncacheableTags, tag); + let interceptor = propertyGet(exports.interceptorsForUncacheableTags, tag); if (interceptor !== null) return interceptor; let interceptorClass = lookupInterceptor(tag); if (interceptorClass === null) { - tag = dart.as(dart.dinvokef(_js_helper.alternateTagFunction, obj, tag), core.String); + tag = dart.as(dart.dinvokef(exports.alternateTagFunction, obj, tag), core.String); if (tag !== null) { - record = propertyGet(_js_helper.dispatchRecordsForInstanceTags, tag); + record = propertyGet(exports.dispatchRecordsForInstanceTags, tag); if (record !== null) return patchInstance(obj, record); - interceptor = propertyGet(_js_helper.interceptorsForUncacheableTags, tag); + interceptor = propertyGet(exports.interceptorsForUncacheableTags, tag); if (interceptor !== null) return interceptor; interceptorClass = lookupInterceptor(tag); @@ -2643,11 +2643,11 @@ var _js_helper; let mark = tag[0]; if (dart.equals(mark, INSTANCE_CACHED_MARK)) { record = makeLeafDispatchRecord(interceptor); - propertySet(_js_helper.dispatchRecordsForInstanceTags, tag, record); + propertySet(exports.dispatchRecordsForInstanceTags, tag, record); return patchInstance(obj, record); } if (dart.equals(mark, UNCACHED_MARK)) { - propertySet(_js_helper.interceptorsForUncacheableTags, tag, interceptor); + propertySet(exports.interceptorsForUncacheableTags, tag, interceptor); return interceptor; } if (dart.equals(mark, LEAF_MARK)) { @@ -2659,7 +2659,7 @@ var _js_helper; if (dart.equals(mark, DISCRIMINATED_MARK)) { throw new core.UnimplementedError(tag); } - let isLeaf = _js_helper.leafTags[tag] === true; + let isLeaf = exports.leafTags[tag] === true; if (isLeaf) { return patchProto(obj, makeLeafDispatchRecord(interceptor)); } else { @@ -2692,7 +2692,7 @@ var _js_helper; // Function makeDefaultDispatchRecord: (dynamic, dynamic, dynamic) → dynamic function makeDefaultDispatchRecord(tag, interceptorClass, proto) { let interceptor = interceptorClass.prototype; - let isLeaf = _js_helper.leafTags[tag] === true; + let isLeaf = exports.leafTags[tag] === true; if (isLeaf) { return makeLeafDispatchRecord(interceptor); } else { @@ -2707,20 +2707,20 @@ var _js_helper; function constructorNameFallback(object) { return _constructorNameFallback(object); } - _js_helper.initNativeDispatchFlag = null; + exports.initNativeDispatchFlag = null; // Function initNativeDispatch: () → void function initNativeDispatch() { - if (true === _js_helper.initNativeDispatchFlag) + if (true === exports.initNativeDispatchFlag) return; - _js_helper.initNativeDispatchFlag = true; + exports.initNativeDispatchFlag = true; initNativeDispatchContinue(); } // Function initNativeDispatchContinue: () → void function initNativeDispatchContinue() { - _js_helper.dispatchRecordsForInstanceTags = Object.create(null); - _js_helper.interceptorsForUncacheableTags = Object.create(null); + exports.dispatchRecordsForInstanceTags = Object.create(null); + exports.interceptorsForUncacheableTags = Object.create(null); initHooks(); - let map = _js_helper.interceptorsByTag; + let map = exports.interceptorsByTag; let tags = Object.getOwnPropertyNames(map); if (typeof window != "undefined") { let context = window; @@ -2728,7 +2728,7 @@ var _js_helper; }; for (let i = 0; i['<'](dart.dload(tags, 'length')); i++) { let tag = dart.dindex(tags, i); - let proto = dart.dinvokef(_js_helper.prototypeForTagFunction, tag); + let proto = dart.dinvokef(exports.prototypeForTagFunction, tag); if (proto !== null) { let interceptorClass = map[tag]; let record = makeDefaultDispatchRecord(tag, interceptorClass, proto); @@ -2779,9 +2779,9 @@ var _js_helper; let getTag = hooks.getTag; let getUnknownTag = hooks.getUnknownTag; let prototypeForTag = hooks.prototypeForTag; - _js_helper.getTagFunction = (o) => getTag(o); - _js_helper.alternateTagFunction = (o, tag) => getUnknownTag(o, tag); - _js_helper.prototypeForTagFunction = (tag) => prototypeForTag(tag); + exports.getTagFunction = (o) => getTag(o); + exports.alternateTagFunction = (o, tag) => getUnknownTag(o, tag); + exports.prototypeForTagFunction = (tag) => prototypeForTag(tag); } // Function applyHooksTransformer: (dynamic, dynamic) → dynamic function applyHooksTransformer(transformer, hooks) { @@ -3661,234 +3661,234 @@ var _js_helper; return s !== t; } // Exports: - _js_helper.patch = patch; - _js_helper.InternalMap = InternalMap; - _js_helper.requiresPreamble = requiresPreamble; - _js_helper.isJsIndexable = isJsIndexable; - _js_helper.S = S; - _js_helper.createInvocationMirror = createInvocationMirror; - _js_helper.createUnmangledInvocationMirror = createUnmangledInvocationMirror; - _js_helper.throwInvalidReflectionError = throwInvalidReflectionError; - _js_helper.traceHelper = traceHelper; - _js_helper.JSInvocationMirror = JSInvocationMirror; - _js_helper.CachedInvocation = CachedInvocation; - _js_helper.CachedCatchAllInvocation = CachedCatchAllInvocation; - _js_helper.CachedNoSuchMethodInvocation = CachedNoSuchMethodInvocation; - _js_helper.ReflectionInfo = ReflectionInfo; - _js_helper.getMetadata = getMetadata; - _js_helper.Primitives = Primitives; - _js_helper.JsCache = JsCache; - _js_helper.iae = iae; - _js_helper.ioore = ioore; - _js_helper.stringLastIndexOfUnchecked = stringLastIndexOfUnchecked; - _js_helper.checkNull = checkNull; - _js_helper.checkNum = checkNum; - _js_helper.checkInt = checkInt; - _js_helper.checkBool = checkBool; - _js_helper.checkString = checkString; - _js_helper.wrapException = wrapException; - _js_helper.toStringWrapper = toStringWrapper; - _js_helper.throwExpression = throwExpression; - _js_helper.makeLiteralListConst = makeLiteralListConst; - _js_helper.throwRuntimeError = throwRuntimeError; - _js_helper.throwAbstractClassInstantiationError = throwAbstractClassInstantiationError; - _js_helper.TypeErrorDecoder = TypeErrorDecoder; - _js_helper.NullError = NullError; - _js_helper.JsNoSuchMethodError = JsNoSuchMethodError; - _js_helper.UnknownJsTypeError = UnknownJsTypeError; - _js_helper.unwrapException = unwrapException; - _js_helper.getTraceFromException = getTraceFromException; - _js_helper.objectHashCode = objectHashCode; - _js_helper.fillLiteralMap = fillLiteralMap; - _js_helper.invokeClosure = invokeClosure; - _js_helper.convertDartClosureToJS = convertDartClosureToJS; - _js_helper.Closure = Closure; - _js_helper.closureFromTearOff = closureFromTearOff; - _js_helper.TearOffClosure = TearOffClosure; - _js_helper.BoundClosure = BoundClosure; - _js_helper.jsHasOwnProperty = jsHasOwnProperty; - _js_helper.jsPropertyAccess = jsPropertyAccess; - _js_helper.getFallThroughError = getFallThroughError; - _js_helper.Creates = Creates; - _js_helper.Returns = Returns; - _js_helper.JSName = JSName; - _js_helper.boolConversionCheck = boolConversionCheck; - _js_helper.stringTypeCheck = stringTypeCheck; - _js_helper.stringTypeCast = stringTypeCast; - _js_helper.doubleTypeCheck = doubleTypeCheck; - _js_helper.doubleTypeCast = doubleTypeCast; - _js_helper.numTypeCheck = numTypeCheck; - _js_helper.numTypeCast = numTypeCast; - _js_helper.boolTypeCheck = boolTypeCheck; - _js_helper.boolTypeCast = boolTypeCast; - _js_helper.intTypeCheck = intTypeCheck; - _js_helper.intTypeCast = intTypeCast; - _js_helper.propertyTypeError = propertyTypeError; - _js_helper.propertyTypeCastError = propertyTypeCastError; - _js_helper.propertyTypeCheck = propertyTypeCheck; - _js_helper.propertyTypeCast = propertyTypeCast; - _js_helper.interceptedTypeCheck = interceptedTypeCheck; - _js_helper.interceptedTypeCast = interceptedTypeCast; - _js_helper.numberOrStringSuperTypeCheck = numberOrStringSuperTypeCheck; - _js_helper.numberOrStringSuperTypeCast = numberOrStringSuperTypeCast; - _js_helper.numberOrStringSuperNativeTypeCheck = numberOrStringSuperNativeTypeCheck; - _js_helper.numberOrStringSuperNativeTypeCast = numberOrStringSuperNativeTypeCast; - _js_helper.stringSuperTypeCheck = stringSuperTypeCheck; - _js_helper.stringSuperTypeCast = stringSuperTypeCast; - _js_helper.stringSuperNativeTypeCheck = stringSuperNativeTypeCheck; - _js_helper.stringSuperNativeTypeCast = stringSuperNativeTypeCast; - _js_helper.listTypeCheck = listTypeCheck; - _js_helper.listTypeCast = listTypeCast; - _js_helper.listSuperTypeCheck = listSuperTypeCheck; - _js_helper.listSuperTypeCast = listSuperTypeCast; - _js_helper.listSuperNativeTypeCheck = listSuperNativeTypeCheck; - _js_helper.listSuperNativeTypeCast = listSuperNativeTypeCast; - _js_helper.voidTypeCheck = voidTypeCheck; - _js_helper.checkMalformedType = checkMalformedType; - _js_helper.checkDeferredIsLoaded = checkDeferredIsLoaded; - _js_helper.JavaScriptIndexingBehavior = JavaScriptIndexingBehavior; - _js_helper.TypeErrorImplementation = TypeErrorImplementation; - _js_helper.CastErrorImplementation = CastErrorImplementation; - _js_helper.FallThroughErrorImplementation = FallThroughErrorImplementation; - _js_helper.assertHelper = assertHelper; - _js_helper.throwNoSuchMethod = throwNoSuchMethod; - _js_helper.throwCyclicInit = throwCyclicInit; - _js_helper.RuntimeError = RuntimeError; - _js_helper.DeferredNotLoadedError = DeferredNotLoadedError; - _js_helper.RuntimeType = RuntimeType; - _js_helper.RuntimeFunctionType = RuntimeFunctionType; - _js_helper.buildFunctionType = buildFunctionType; - _js_helper.buildNamedFunctionType = buildNamedFunctionType; - _js_helper.buildInterfaceType = buildInterfaceType; - _js_helper.DynamicRuntimeType = DynamicRuntimeType; - _js_helper.getDynamicRuntimeType = getDynamicRuntimeType; - _js_helper.VoidRuntimeType = VoidRuntimeType; - _js_helper.getVoidRuntimeType = getVoidRuntimeType; - _js_helper.functionTypeTestMetaHelper = functionTypeTestMetaHelper; - _js_helper.convertRtiToRuntimeType = convertRtiToRuntimeType; - _js_helper.RuntimeTypePlain = RuntimeTypePlain; - _js_helper.RuntimeTypeGeneric = RuntimeTypeGeneric; - _js_helper.FunctionTypeInfoDecoderRing = FunctionTypeInfoDecoderRing; - _js_helper.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError; - _js_helper.random64 = random64; - _js_helper.jsonEncodeNative = jsonEncodeNative; - _js_helper.getIsolateAffinityTag = getIsolateAffinityTag; - _js_helper.loadDeferredLibrary = loadDeferredLibrary; - _js_helper.MainError = MainError; - _js_helper.missingMain = missingMain; - _js_helper.badMain = badMain; - _js_helper.mainHasTooManyParameters = mainHasTooManyParameters; - _js_helper.NoSideEffects = NoSideEffects; - _js_helper.NoThrows = NoThrows; - _js_helper.NoInline = NoInline; - _js_helper.IrRepresentation = IrRepresentation; - _js_helper.Native = Native; - _js_helper.ConstantMap = ConstantMap; - _js_helper.ConstantMap$ = ConstantMap$; - _js_helper.ConstantStringMap = ConstantStringMap; - _js_helper.ConstantStringMap$ = ConstantStringMap$; - _js_helper.ConstantProtoMap = ConstantProtoMap; - _js_helper.ConstantProtoMap$ = ConstantProtoMap$; - _js_helper.GeneralConstantMap = GeneralConstantMap; - _js_helper.GeneralConstantMap$ = GeneralConstantMap$; - _js_helper.contains = contains; - _js_helper.arrayLength = arrayLength; - _js_helper.arrayGet = arrayGet; - _js_helper.arraySet = arraySet; - _js_helper.propertyGet = propertyGet; - _js_helper.callHasOwnProperty = callHasOwnProperty; - _js_helper.propertySet = propertySet; - _js_helper.getPropertyFromPrototype = getPropertyFromPrototype; - _js_helper.toStringForNativeObject = toStringForNativeObject; - _js_helper.hashCodeForNativeObject = hashCodeForNativeObject; - _js_helper.defineProperty = defineProperty; - _js_helper.isDartObject = isDartObject; - _js_helper.interceptorsByTag = interceptorsByTag; - _js_helper.leafTags = leafTags; - _js_helper.findDispatchTagForInterceptorClass = findDispatchTagForInterceptorClass; - _js_helper.lookupInterceptor = lookupInterceptor; - _js_helper.UNCACHED_MARK = UNCACHED_MARK; - _js_helper.INSTANCE_CACHED_MARK = INSTANCE_CACHED_MARK; - _js_helper.LEAF_MARK = LEAF_MARK; - _js_helper.INTERIOR_MARK = INTERIOR_MARK; - _js_helper.DISCRIMINATED_MARK = DISCRIMINATED_MARK; - _js_helper.lookupAndCacheInterceptor = lookupAndCacheInterceptor; - _js_helper.patchInstance = patchInstance; - _js_helper.patchProto = patchProto; - _js_helper.patchInteriorProto = patchInteriorProto; - _js_helper.makeLeafDispatchRecord = makeLeafDispatchRecord; - _js_helper.makeDefaultDispatchRecord = makeDefaultDispatchRecord; - _js_helper.setNativeSubclassDispatchRecord = setNativeSubclassDispatchRecord; - _js_helper.constructorNameFallback = constructorNameFallback; - _js_helper.initNativeDispatch = initNativeDispatch; - _js_helper.initNativeDispatchContinue = initNativeDispatchContinue; - _js_helper.initHooks = initHooks; - _js_helper.applyHooksTransformer = applyHooksTransformer; - _js_helper.regExpGetNative = regExpGetNative; - _js_helper.regExpGetGlobalNative = regExpGetGlobalNative; - _js_helper.regExpCaptureCount = regExpCaptureCount; - _js_helper.JSSyntaxRegExp = JSSyntaxRegExp; - _js_helper.firstMatchAfter = firstMatchAfter; - _js_helper.StringMatch = StringMatch; - _js_helper.allMatchesInStringUnchecked = allMatchesInStringUnchecked; - _js_helper.stringContainsUnchecked = stringContainsUnchecked; - _js_helper.stringReplaceJS = stringReplaceJS; - _js_helper.stringReplaceFirstRE = stringReplaceFirstRE; - _js_helper.ESCAPE_REGEXP = ESCAPE_REGEXP; - _js_helper.stringReplaceAllUnchecked = stringReplaceAllUnchecked; - _js_helper.stringReplaceAllFuncUnchecked = stringReplaceAllFuncUnchecked; - _js_helper.stringReplaceAllEmptyFuncUnchecked = stringReplaceAllEmptyFuncUnchecked; - _js_helper.stringReplaceAllStringFuncUnchecked = stringReplaceAllStringFuncUnchecked; - _js_helper.stringReplaceFirstUnchecked = stringReplaceFirstUnchecked; - _js_helper.stringJoinUnchecked = stringJoinUnchecked; - _js_helper.createRuntimeType = createRuntimeType; - _js_helper.TypeImpl = TypeImpl; - _js_helper.TypeVariable = TypeVariable; - _js_helper.getMangledTypeName = getMangledTypeName; - _js_helper.setRuntimeTypeInfo = setRuntimeTypeInfo; - _js_helper.getRuntimeTypeInfo = getRuntimeTypeInfo; - _js_helper.getRuntimeTypeArguments = getRuntimeTypeArguments; - _js_helper.getRuntimeTypeArgument = getRuntimeTypeArgument; - _js_helper.getTypeArgumentByIndex = getTypeArgumentByIndex; - _js_helper.copyTypeArguments = copyTypeArguments; - _js_helper.getClassName = getClassName; - _js_helper.getRuntimeTypeAsString = getRuntimeTypeAsString; - _js_helper.getConstructorName = getConstructorName; - _js_helper.runtimeTypeToString = runtimeTypeToString; - _js_helper.joinArguments = joinArguments; - _js_helper.getRuntimeTypeString = getRuntimeTypeString; - _js_helper.getRuntimeType = getRuntimeType; - _js_helper.substitute = substitute; - _js_helper.checkSubtype = checkSubtype; - _js_helper.computeTypeName = computeTypeName; - _js_helper.subtypeCast = subtypeCast; - _js_helper.assertSubtype = assertSubtype; - _js_helper.assertIsSubtype = assertIsSubtype; - _js_helper.throwTypeError = throwTypeError; - _js_helper.checkArguments = checkArguments; - _js_helper.areSubtypes = areSubtypes; - _js_helper.computeSignature = computeSignature; - _js_helper.isSupertypeOfNull = isSupertypeOfNull; - _js_helper.checkSubtypeOfRuntimeType = checkSubtypeOfRuntimeType; - _js_helper.subtypeOfRuntimeTypeCast = subtypeOfRuntimeTypeCast; - _js_helper.assertSubtypeOfRuntimeType = assertSubtypeOfRuntimeType; - _js_helper.getArguments = getArguments; - _js_helper.isSubtype = isSubtype; - _js_helper.isAssignable = isAssignable; - _js_helper.areAssignable = areAssignable; - _js_helper.areAssignableMaps = areAssignableMaps; - _js_helper.isFunctionSubtype = isFunctionSubtype; - _js_helper.invoke = invoke; - _js_helper.invokeOn = invokeOn; - _js_helper.call = call; - _js_helper.getField = getField; - _js_helper.getIndex = getIndex; - _js_helper.getLength = getLength; - _js_helper.isJsArray = isJsArray; - _js_helper.hasField = hasField; - _js_helper.hasNoField = hasNoField; - _js_helper.isJsFunction = isJsFunction; - _js_helper.isJsObject = isJsObject; - _js_helper.isIdentical = isIdentical; - _js_helper.isNotIdentical = isNotIdentical; + exports.patch = patch; + exports.InternalMap = InternalMap; + exports.requiresPreamble = requiresPreamble; + exports.isJsIndexable = isJsIndexable; + exports.S = S; + exports.createInvocationMirror = createInvocationMirror; + exports.createUnmangledInvocationMirror = createUnmangledInvocationMirror; + exports.throwInvalidReflectionError = throwInvalidReflectionError; + exports.traceHelper = traceHelper; + exports.JSInvocationMirror = JSInvocationMirror; + exports.CachedInvocation = CachedInvocation; + exports.CachedCatchAllInvocation = CachedCatchAllInvocation; + exports.CachedNoSuchMethodInvocation = CachedNoSuchMethodInvocation; + exports.ReflectionInfo = ReflectionInfo; + exports.getMetadata = getMetadata; + exports.Primitives = Primitives; + exports.JsCache = JsCache; + exports.iae = iae; + exports.ioore = ioore; + exports.stringLastIndexOfUnchecked = stringLastIndexOfUnchecked; + exports.checkNull = checkNull; + exports.checkNum = checkNum; + exports.checkInt = checkInt; + exports.checkBool = checkBool; + exports.checkString = checkString; + exports.wrapException = wrapException; + exports.toStringWrapper = toStringWrapper; + exports.throwExpression = throwExpression; + exports.makeLiteralListConst = makeLiteralListConst; + exports.throwRuntimeError = throwRuntimeError; + exports.throwAbstractClassInstantiationError = throwAbstractClassInstantiationError; + exports.TypeErrorDecoder = TypeErrorDecoder; + exports.NullError = NullError; + exports.JsNoSuchMethodError = JsNoSuchMethodError; + exports.UnknownJsTypeError = UnknownJsTypeError; + exports.unwrapException = unwrapException; + exports.getTraceFromException = getTraceFromException; + exports.objectHashCode = objectHashCode; + exports.fillLiteralMap = fillLiteralMap; + exports.invokeClosure = invokeClosure; + exports.convertDartClosureToJS = convertDartClosureToJS; + exports.Closure = Closure; + exports.closureFromTearOff = closureFromTearOff; + exports.TearOffClosure = TearOffClosure; + exports.BoundClosure = BoundClosure; + exports.jsHasOwnProperty = jsHasOwnProperty; + exports.jsPropertyAccess = jsPropertyAccess; + exports.getFallThroughError = getFallThroughError; + exports.Creates = Creates; + exports.Returns = Returns; + exports.JSName = JSName; + exports.boolConversionCheck = boolConversionCheck; + exports.stringTypeCheck = stringTypeCheck; + exports.stringTypeCast = stringTypeCast; + exports.doubleTypeCheck = doubleTypeCheck; + exports.doubleTypeCast = doubleTypeCast; + exports.numTypeCheck = numTypeCheck; + exports.numTypeCast = numTypeCast; + exports.boolTypeCheck = boolTypeCheck; + exports.boolTypeCast = boolTypeCast; + exports.intTypeCheck = intTypeCheck; + exports.intTypeCast = intTypeCast; + exports.propertyTypeError = propertyTypeError; + exports.propertyTypeCastError = propertyTypeCastError; + exports.propertyTypeCheck = propertyTypeCheck; + exports.propertyTypeCast = propertyTypeCast; + exports.interceptedTypeCheck = interceptedTypeCheck; + exports.interceptedTypeCast = interceptedTypeCast; + exports.numberOrStringSuperTypeCheck = numberOrStringSuperTypeCheck; + exports.numberOrStringSuperTypeCast = numberOrStringSuperTypeCast; + exports.numberOrStringSuperNativeTypeCheck = numberOrStringSuperNativeTypeCheck; + exports.numberOrStringSuperNativeTypeCast = numberOrStringSuperNativeTypeCast; + exports.stringSuperTypeCheck = stringSuperTypeCheck; + exports.stringSuperTypeCast = stringSuperTypeCast; + exports.stringSuperNativeTypeCheck = stringSuperNativeTypeCheck; + exports.stringSuperNativeTypeCast = stringSuperNativeTypeCast; + exports.listTypeCheck = listTypeCheck; + exports.listTypeCast = listTypeCast; + exports.listSuperTypeCheck = listSuperTypeCheck; + exports.listSuperTypeCast = listSuperTypeCast; + exports.listSuperNativeTypeCheck = listSuperNativeTypeCheck; + exports.listSuperNativeTypeCast = listSuperNativeTypeCast; + exports.voidTypeCheck = voidTypeCheck; + exports.checkMalformedType = checkMalformedType; + exports.checkDeferredIsLoaded = checkDeferredIsLoaded; + exports.JavaScriptIndexingBehavior = JavaScriptIndexingBehavior; + exports.TypeErrorImplementation = TypeErrorImplementation; + exports.CastErrorImplementation = CastErrorImplementation; + exports.FallThroughErrorImplementation = FallThroughErrorImplementation; + exports.assertHelper = assertHelper; + exports.throwNoSuchMethod = throwNoSuchMethod; + exports.throwCyclicInit = throwCyclicInit; + exports.RuntimeError = RuntimeError; + exports.DeferredNotLoadedError = DeferredNotLoadedError; + exports.RuntimeType = RuntimeType; + exports.RuntimeFunctionType = RuntimeFunctionType; + exports.buildFunctionType = buildFunctionType; + exports.buildNamedFunctionType = buildNamedFunctionType; + exports.buildInterfaceType = buildInterfaceType; + exports.DynamicRuntimeType = DynamicRuntimeType; + exports.getDynamicRuntimeType = getDynamicRuntimeType; + exports.VoidRuntimeType = VoidRuntimeType; + exports.getVoidRuntimeType = getVoidRuntimeType; + exports.functionTypeTestMetaHelper = functionTypeTestMetaHelper; + exports.convertRtiToRuntimeType = convertRtiToRuntimeType; + exports.RuntimeTypePlain = RuntimeTypePlain; + exports.RuntimeTypeGeneric = RuntimeTypeGeneric; + exports.FunctionTypeInfoDecoderRing = FunctionTypeInfoDecoderRing; + exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError; + exports.random64 = random64; + exports.jsonEncodeNative = jsonEncodeNative; + exports.getIsolateAffinityTag = getIsolateAffinityTag; + exports.loadDeferredLibrary = loadDeferredLibrary; + exports.MainError = MainError; + exports.missingMain = missingMain; + exports.badMain = badMain; + exports.mainHasTooManyParameters = mainHasTooManyParameters; + exports.NoSideEffects = NoSideEffects; + exports.NoThrows = NoThrows; + exports.NoInline = NoInline; + exports.IrRepresentation = IrRepresentation; + exports.Native = Native; + exports.ConstantMap = ConstantMap; + exports.ConstantMap$ = ConstantMap$; + exports.ConstantStringMap = ConstantStringMap; + exports.ConstantStringMap$ = ConstantStringMap$; + exports.ConstantProtoMap = ConstantProtoMap; + exports.ConstantProtoMap$ = ConstantProtoMap$; + exports.GeneralConstantMap = GeneralConstantMap; + exports.GeneralConstantMap$ = GeneralConstantMap$; + exports.contains = contains; + exports.arrayLength = arrayLength; + exports.arrayGet = arrayGet; + exports.arraySet = arraySet; + exports.propertyGet = propertyGet; + exports.callHasOwnProperty = callHasOwnProperty; + exports.propertySet = propertySet; + exports.getPropertyFromPrototype = getPropertyFromPrototype; + exports.toStringForNativeObject = toStringForNativeObject; + exports.hashCodeForNativeObject = hashCodeForNativeObject; + exports.defineProperty = defineProperty; + exports.isDartObject = isDartObject; + exports.interceptorsByTag = interceptorsByTag; + exports.leafTags = leafTags; + exports.findDispatchTagForInterceptorClass = findDispatchTagForInterceptorClass; + exports.lookupInterceptor = lookupInterceptor; + exports.UNCACHED_MARK = UNCACHED_MARK; + exports.INSTANCE_CACHED_MARK = INSTANCE_CACHED_MARK; + exports.LEAF_MARK = LEAF_MARK; + exports.INTERIOR_MARK = INTERIOR_MARK; + exports.DISCRIMINATED_MARK = DISCRIMINATED_MARK; + exports.lookupAndCacheInterceptor = lookupAndCacheInterceptor; + exports.patchInstance = patchInstance; + exports.patchProto = patchProto; + exports.patchInteriorProto = patchInteriorProto; + exports.makeLeafDispatchRecord = makeLeafDispatchRecord; + exports.makeDefaultDispatchRecord = makeDefaultDispatchRecord; + exports.setNativeSubclassDispatchRecord = setNativeSubclassDispatchRecord; + exports.constructorNameFallback = constructorNameFallback; + exports.initNativeDispatch = initNativeDispatch; + exports.initNativeDispatchContinue = initNativeDispatchContinue; + exports.initHooks = initHooks; + exports.applyHooksTransformer = applyHooksTransformer; + exports.regExpGetNative = regExpGetNative; + exports.regExpGetGlobalNative = regExpGetGlobalNative; + exports.regExpCaptureCount = regExpCaptureCount; + exports.JSSyntaxRegExp = JSSyntaxRegExp; + exports.firstMatchAfter = firstMatchAfter; + exports.StringMatch = StringMatch; + exports.allMatchesInStringUnchecked = allMatchesInStringUnchecked; + exports.stringContainsUnchecked = stringContainsUnchecked; + exports.stringReplaceJS = stringReplaceJS; + exports.stringReplaceFirstRE = stringReplaceFirstRE; + exports.ESCAPE_REGEXP = ESCAPE_REGEXP; + exports.stringReplaceAllUnchecked = stringReplaceAllUnchecked; + exports.stringReplaceAllFuncUnchecked = stringReplaceAllFuncUnchecked; + exports.stringReplaceAllEmptyFuncUnchecked = stringReplaceAllEmptyFuncUnchecked; + exports.stringReplaceAllStringFuncUnchecked = stringReplaceAllStringFuncUnchecked; + exports.stringReplaceFirstUnchecked = stringReplaceFirstUnchecked; + exports.stringJoinUnchecked = stringJoinUnchecked; + exports.createRuntimeType = createRuntimeType; + exports.TypeImpl = TypeImpl; + exports.TypeVariable = TypeVariable; + exports.getMangledTypeName = getMangledTypeName; + exports.setRuntimeTypeInfo = setRuntimeTypeInfo; + exports.getRuntimeTypeInfo = getRuntimeTypeInfo; + exports.getRuntimeTypeArguments = getRuntimeTypeArguments; + exports.getRuntimeTypeArgument = getRuntimeTypeArgument; + exports.getTypeArgumentByIndex = getTypeArgumentByIndex; + exports.copyTypeArguments = copyTypeArguments; + exports.getClassName = getClassName; + exports.getRuntimeTypeAsString = getRuntimeTypeAsString; + exports.getConstructorName = getConstructorName; + exports.runtimeTypeToString = runtimeTypeToString; + exports.joinArguments = joinArguments; + exports.getRuntimeTypeString = getRuntimeTypeString; + exports.getRuntimeType = getRuntimeType; + exports.substitute = substitute; + exports.checkSubtype = checkSubtype; + exports.computeTypeName = computeTypeName; + exports.subtypeCast = subtypeCast; + exports.assertSubtype = assertSubtype; + exports.assertIsSubtype = assertIsSubtype; + exports.throwTypeError = throwTypeError; + exports.checkArguments = checkArguments; + exports.areSubtypes = areSubtypes; + exports.computeSignature = computeSignature; + exports.isSupertypeOfNull = isSupertypeOfNull; + exports.checkSubtypeOfRuntimeType = checkSubtypeOfRuntimeType; + exports.subtypeOfRuntimeTypeCast = subtypeOfRuntimeTypeCast; + exports.assertSubtypeOfRuntimeType = assertSubtypeOfRuntimeType; + exports.getArguments = getArguments; + exports.isSubtype = isSubtype; + exports.isAssignable = isAssignable; + exports.areAssignable = areAssignable; + exports.areAssignableMaps = areAssignableMaps; + exports.isFunctionSubtype = isFunctionSubtype; + exports.invoke = invoke; + exports.invokeOn = invokeOn; + exports.call = call; + exports.getField = getField; + exports.getIndex = getIndex; + exports.getLength = getLength; + exports.isJsArray = isJsArray; + exports.hasField = hasField; + exports.hasNoField = hasNoField; + exports.isJsFunction = isJsFunction; + exports.isJsObject = isJsObject; + exports.isIdentical = isIdentical; + exports.isNotIdentical = isNotIdentical; })(_js_helper || (_js_helper = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/_js_names/_js_names.js b/pkg/dev_compiler/test/codegen/expect/_js_names/_js_names.js index 804cdd9630cc..a4f59272f1b6 100644 --- a/pkg/dev_compiler/test/codegen/expect/_js_names/_js_names.js +++ b/pkg/dev_compiler/test/codegen/expect/_js_names/_js_names.js @@ -1,21 +1,21 @@ var _js_names; -(function(_js_names) { +(function(exports) { 'use strict'; // Function preserveNames: () → dynamic function preserveNames() { } - dart.defineLazyProperties(_js_names, { + dart.defineLazyProperties(exports, { get mangledNames() { return computeMangledNames(_foreign_helper.JS_EMBEDDED_GLOBAL('=Object', dart.as(_js_embedded_names.MANGLED_NAMES, core.String)), false); }, get reflectiveNames() { - return computeReflectiveNames(_js_names.mangledNames); + return computeReflectiveNames(exports.mangledNames); }, get mangledGlobalNames() { return computeMangledNames(_foreign_helper.JS_EMBEDDED_GLOBAL('=Object', dart.as(_js_embedded_names.MANGLED_GLOBAL_NAMES, core.String)), true); }, get reflectiveGlobalNames() { - return computeReflectiveNames(_js_names.mangledGlobalNames); + return computeReflectiveNames(exports.mangledGlobalNames); } }); // Function computeMangledNames: (dynamic, bool) → Map @@ -70,10 +70,10 @@ var _js_names; }); } // Exports: - _js_names.preserveNames = preserveNames; - _js_names.computeMangledNames = computeMangledNames; - _js_names.computeReflectiveNames = computeReflectiveNames; - _js_names.extractKeys = extractKeys; - _js_names.unmangleGlobalNameIfPreservedAnyways = unmangleGlobalNameIfPreservedAnyways; - _js_names.unmangleAllIdentifiersIfPreservedAnyways = unmangleAllIdentifiersIfPreservedAnyways; + exports.preserveNames = preserveNames; + exports.computeMangledNames = computeMangledNames; + exports.computeReflectiveNames = computeReflectiveNames; + exports.extractKeys = extractKeys; + exports.unmangleGlobalNameIfPreservedAnyways = unmangleGlobalNameIfPreservedAnyways; + exports.unmangleAllIdentifiersIfPreservedAnyways = unmangleAllIdentifiersIfPreservedAnyways; })(_js_names || (_js_names = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/_js_primitives/_js_primitives.js b/pkg/dev_compiler/test/codegen/expect/_js_primitives/_js_primitives.js index af32b2f09ce6..f286fc6ed9ea 100644 --- a/pkg/dev_compiler/test/codegen/expect/_js_primitives/_js_primitives.js +++ b/pkg/dev_compiler/test/codegen/expect/_js_primitives/_js_primitives.js @@ -1,5 +1,5 @@ var _js_primitives; -(function(_js_primitives) { +(function(exports) { 'use strict'; // Function printString: (String) → void function printString(string) { @@ -21,5 +21,5 @@ var _js_primitives; throw "Unable to print message: " + String(string); } // Exports: - _js_primitives.printString = printString; + exports.printString = printString; })(_js_primitives || (_js_primitives = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/_native_typed_data/_native_typed_data.js b/pkg/dev_compiler/test/codegen/expect/_native_typed_data/_native_typed_data.js index 4ecab37b515d..64be63c5a713 100644 --- a/pkg/dev_compiler/test/codegen/expect/_native_typed_data/_native_typed_data.js +++ b/pkg/dev_compiler/test/codegen/expect/_native_typed_data/_native_typed_data.js @@ -1,5 +1,5 @@ var _native_typed_data; -(function(_native_typed_data) { +(function(exports) { 'use strict'; class NativeByteBuffer extends dart.Object { NativeByteBuffer() { @@ -1491,25 +1491,25 @@ var _native_typed_data; set _uint32View() {} }); // Exports: - _native_typed_data.NativeByteBuffer = NativeByteBuffer; - _native_typed_data.NativeFloat32x4List = NativeFloat32x4List; - _native_typed_data.NativeInt32x4List = NativeInt32x4List; - _native_typed_data.NativeFloat64x2List = NativeFloat64x2List; - _native_typed_data.NativeTypedData = NativeTypedData; - _native_typed_data.NativeByteData = NativeByteData; - _native_typed_data.NativeTypedArray = NativeTypedArray; - _native_typed_data.NativeTypedArrayOfDouble = NativeTypedArrayOfDouble; - _native_typed_data.NativeTypedArrayOfInt = NativeTypedArrayOfInt; - _native_typed_data.NativeFloat32List = NativeFloat32List; - _native_typed_data.NativeFloat64List = NativeFloat64List; - _native_typed_data.NativeInt16List = NativeInt16List; - _native_typed_data.NativeInt32List = NativeInt32List; - _native_typed_data.NativeInt8List = NativeInt8List; - _native_typed_data.NativeUint16List = NativeUint16List; - _native_typed_data.NativeUint32List = NativeUint32List; - _native_typed_data.NativeUint8ClampedList = NativeUint8ClampedList; - _native_typed_data.NativeUint8List = NativeUint8List; - _native_typed_data.NativeFloat32x4 = NativeFloat32x4; - _native_typed_data.NativeInt32x4 = NativeInt32x4; - _native_typed_data.NativeFloat64x2 = NativeFloat64x2; + exports.NativeByteBuffer = NativeByteBuffer; + exports.NativeFloat32x4List = NativeFloat32x4List; + exports.NativeInt32x4List = NativeInt32x4List; + exports.NativeFloat64x2List = NativeFloat64x2List; + exports.NativeTypedData = NativeTypedData; + exports.NativeByteData = NativeByteData; + exports.NativeTypedArray = NativeTypedArray; + exports.NativeTypedArrayOfDouble = NativeTypedArrayOfDouble; + exports.NativeTypedArrayOfInt = NativeTypedArrayOfInt; + exports.NativeFloat32List = NativeFloat32List; + exports.NativeFloat64List = NativeFloat64List; + exports.NativeInt16List = NativeInt16List; + exports.NativeInt32List = NativeInt32List; + exports.NativeInt8List = NativeInt8List; + exports.NativeUint16List = NativeUint16List; + exports.NativeUint32List = NativeUint32List; + exports.NativeUint8ClampedList = NativeUint8ClampedList; + exports.NativeUint8List = NativeUint8List; + exports.NativeFloat32x4 = NativeFloat32x4; + exports.NativeInt32x4 = NativeInt32x4; + exports.NativeFloat64x2 = NativeFloat64x2; })(_native_typed_data || (_native_typed_data = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/async/async.js b/pkg/dev_compiler/test/codegen/expect/async/async.js index 8c051e59ea3b..3e655c29ff8a 100644 --- a/pkg/dev_compiler/test/codegen/expect/async/async.js +++ b/pkg/dev_compiler/test/codegen/expect/async/async.js @@ -1,7 +1,7 @@ var async; -(function(async) { +(function(exports) { 'use strict'; - dart.copyProperties(async, { + dart.copyProperties(exports, { get _hasDocument() { return dart.equals(typeof document, 'object'); } @@ -1258,61 +1258,61 @@ var async; this.next = null; } } - async._nextCallback = null; - async._lastCallback = null; - async._lastPriorityCallback = null; - async._isInCallbackLoop = false; + exports._nextCallback = null; + exports._lastCallback = null; + exports._lastPriorityCallback = null; + exports._isInCallbackLoop = false; // Function _asyncRunCallbackLoop: () → void function _asyncRunCallbackLoop() { - while (async._nextCallback !== null) { - async._lastPriorityCallback = null; - let entry = async._nextCallback; - async._nextCallback = entry.next; - if (async._nextCallback === null) - async._lastCallback = null; + while (exports._nextCallback !== null) { + exports._lastPriorityCallback = null; + let entry = exports._nextCallback; + exports._nextCallback = entry.next; + if (exports._nextCallback === null) + exports._lastCallback = null; entry.callback(); } } // Function _asyncRunCallback: () → void function _asyncRunCallback() { - async._isInCallbackLoop = true; + exports._isInCallbackLoop = true; try { _asyncRunCallbackLoop(); } finally { - async._lastPriorityCallback = null; - async._isInCallbackLoop = false; - if (async._nextCallback !== null) + exports._lastPriorityCallback = null; + exports._isInCallbackLoop = false; + if (exports._nextCallback !== null) _AsyncRun._scheduleImmediate(_asyncRunCallback); } } // Function _scheduleAsyncCallback: (dynamic) → void function _scheduleAsyncCallback(callback) { - if (async._nextCallback === null) { - async._nextCallback = async._lastCallback = new _AsyncCallbackEntry(dart.as(callback, _AsyncCallback)); - if (!dart.notNull(async._isInCallbackLoop)) { + if (exports._nextCallback === null) { + exports._nextCallback = exports._lastCallback = new _AsyncCallbackEntry(dart.as(callback, _AsyncCallback)); + if (!dart.notNull(exports._isInCallbackLoop)) { _AsyncRun._scheduleImmediate(_asyncRunCallback); } } else { let newEntry = new _AsyncCallbackEntry(dart.as(callback, _AsyncCallback)); - async._lastCallback.next = newEntry; - async._lastCallback = newEntry; + exports._lastCallback.next = newEntry; + exports._lastCallback = newEntry; } } // Function _schedulePriorityAsyncCallback: (dynamic) → void function _schedulePriorityAsyncCallback(callback) { let entry = new _AsyncCallbackEntry(dart.as(callback, _AsyncCallback)); - if (async._nextCallback === null) { + if (exports._nextCallback === null) { _scheduleAsyncCallback(callback); - async._lastPriorityCallback = async._lastCallback; - } else if (async._lastPriorityCallback === null) { - entry.next = async._nextCallback; - async._nextCallback = async._lastPriorityCallback = entry; + exports._lastPriorityCallback = exports._lastCallback; + } else if (exports._lastPriorityCallback === null) { + entry.next = exports._nextCallback; + exports._nextCallback = exports._lastPriorityCallback = entry; } else { - entry.next = async._lastPriorityCallback.next; - async._lastPriorityCallback.next = entry; - async._lastPriorityCallback = entry; + entry.next = exports._lastPriorityCallback.next; + exports._lastPriorityCallback.next = entry; + exports._lastPriorityCallback = entry; if (entry.next === null) { - async._lastCallback = entry; + exports._lastCallback = entry; } } } @@ -4755,36 +4755,36 @@ var async; } } // Exports: - async.DeferredLibrary = DeferredLibrary; - async.DeferredLoadException = DeferredLoadException; - async.Future = Future; - async.Future$ = Future$; - async.TimeoutException = TimeoutException; - async.Completer = Completer; - async.Completer$ = Completer$; - async.scheduleMicrotask = scheduleMicrotask; - async.Stream = Stream; - async.Stream$ = Stream$; - async.StreamSubscription = StreamSubscription; - async.StreamSubscription$ = StreamSubscription$; - async.EventSink = EventSink; - async.EventSink$ = EventSink$; - async.StreamView = StreamView; - async.StreamView$ = StreamView$; - async.StreamConsumer = StreamConsumer; - async.StreamConsumer$ = StreamConsumer$; - async.StreamSink = StreamSink; - async.StreamSink$ = StreamSink$; - async.StreamTransformer = StreamTransformer; - async.StreamTransformer$ = StreamTransformer$; - async.StreamIterator = StreamIterator; - async.StreamIterator$ = StreamIterator$; - async.StreamController = StreamController; - async.StreamController$ = StreamController$; - async.Timer = Timer; - async.AsyncError = AsyncError; - async.ZoneSpecification = ZoneSpecification; - async.ZoneDelegate = ZoneDelegate; - async.Zone = Zone; - async.runZoned = runZoned; + exports.DeferredLibrary = DeferredLibrary; + exports.DeferredLoadException = DeferredLoadException; + exports.Future = Future; + exports.Future$ = Future$; + exports.TimeoutException = TimeoutException; + exports.Completer = Completer; + exports.Completer$ = Completer$; + exports.scheduleMicrotask = scheduleMicrotask; + exports.Stream = Stream; + exports.Stream$ = Stream$; + exports.StreamSubscription = StreamSubscription; + exports.StreamSubscription$ = StreamSubscription$; + exports.EventSink = EventSink; + exports.EventSink$ = EventSink$; + exports.StreamView = StreamView; + exports.StreamView$ = StreamView$; + exports.StreamConsumer = StreamConsumer; + exports.StreamConsumer$ = StreamConsumer$; + exports.StreamSink = StreamSink; + exports.StreamSink$ = StreamSink$; + exports.StreamTransformer = StreamTransformer; + exports.StreamTransformer$ = StreamTransformer$; + exports.StreamIterator = StreamIterator; + exports.StreamIterator$ = StreamIterator$; + exports.StreamController = StreamController; + exports.StreamController$ = StreamController$; + exports.Timer = Timer; + exports.AsyncError = AsyncError; + exports.ZoneSpecification = ZoneSpecification; + exports.ZoneDelegate = ZoneDelegate; + exports.Zone = Zone; + exports.runZoned = runZoned; })(async || (async = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/cascade/cascade.js b/pkg/dev_compiler/test/codegen/expect/cascade/cascade.js index b2d7c4611326..4b7787e1548c 100644 --- a/pkg/dev_compiler/test/codegen/expect/cascade/cascade.js +++ b/pkg/dev_compiler/test/codegen/expect/cascade/cascade.js @@ -1,5 +1,5 @@ var cascade; -(function(cascade) { +(function(exports) { 'use strict'; class A extends dart.Object { A() { @@ -72,12 +72,12 @@ var cascade; core.print(a); } // Exports: - cascade.A = A; - cascade.test_closure_with_mutate = test_closure_with_mutate; - cascade.test_closure_without_mutate = test_closure_without_mutate; - cascade.test_mutate_inside_cascade = test_mutate_inside_cascade; - cascade.test_mutate_outside_cascade = test_mutate_outside_cascade; - cascade.test_VariableDeclaration_single = test_VariableDeclaration_single; - cascade.test_VariableDeclaration_last = test_VariableDeclaration_last; - cascade.test_VariableDeclaration_first = test_VariableDeclaration_first; + exports.A = A; + exports.test_closure_with_mutate = test_closure_with_mutate; + exports.test_closure_without_mutate = test_closure_without_mutate; + exports.test_mutate_inside_cascade = test_mutate_inside_cascade; + exports.test_mutate_outside_cascade = test_mutate_outside_cascade; + exports.test_VariableDeclaration_single = test_VariableDeclaration_single; + exports.test_VariableDeclaration_last = test_VariableDeclaration_last; + exports.test_VariableDeclaration_first = test_VariableDeclaration_first; })(cascade || (cascade = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/collection/collection.js b/pkg/dev_compiler/test/codegen/expect/collection/collection.js index 35efacabc103..0a1ec4153fdd 100644 --- a/pkg/dev_compiler/test/codegen/expect/collection/collection.js +++ b/pkg/dev_compiler/test/codegen/expect/collection/collection.js @@ -1,5 +1,5 @@ var collection; -(function(collection) { +(function(exports) { 'use strict'; let _HashMap$ = dart.generic(function(K, V) { class _HashMap extends dart.Object { @@ -4728,69 +4728,69 @@ var collection; }); let SplayTreeSet = SplayTreeSet$(dynamic); // Exports: - collection.HashMapKeyIterable = HashMapKeyIterable; - collection.HashMapKeyIterable$ = HashMapKeyIterable$; - collection.HashMapKeyIterator = HashMapKeyIterator; - collection.HashMapKeyIterator$ = HashMapKeyIterator$; - collection.LinkedHashMapCell = LinkedHashMapCell; - collection.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable; - collection.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$; - collection.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator; - collection.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$; - collection.HashSetIterator = HashSetIterator; - collection.HashSetIterator$ = HashSetIterator$; - collection.LinkedHashSetCell = LinkedHashSetCell; - collection.LinkedHashSetIterator = LinkedHashSetIterator; - collection.LinkedHashSetIterator$ = LinkedHashSetIterator$; - collection.UnmodifiableListView = UnmodifiableListView; - collection.UnmodifiableListView$ = UnmodifiableListView$; - collection.HashMap = HashMap; - collection.HashMap$ = HashMap$; - collection.HashSet = HashSet; - collection.HashSet$ = HashSet$; - collection.IterableMixin = IterableMixin; - collection.IterableMixin$ = IterableMixin$; - collection.IterableBase = IterableBase; - collection.IterableBase$ = IterableBase$; - collection.HasNextIterator = HasNextIterator; - collection.HasNextIterator$ = HasNextIterator$; - collection.LinkedHashMap = LinkedHashMap; - collection.LinkedHashMap$ = LinkedHashMap$; - collection.LinkedHashSet = LinkedHashSet; - collection.LinkedHashSet$ = LinkedHashSet$; - collection.LinkedList = LinkedList; - collection.LinkedList$ = LinkedList$; - collection.LinkedListEntry = LinkedListEntry; - collection.LinkedListEntry$ = LinkedListEntry$; - collection.ListBase = ListBase; - collection.ListBase$ = ListBase$; - collection.ListMixin = ListMixin; - collection.ListMixin$ = ListMixin$; - collection.MapBase = MapBase; - collection.MapBase$ = MapBase$; - collection.MapMixin = MapMixin; - collection.MapMixin$ = MapMixin$; - collection.UnmodifiableMapBase = UnmodifiableMapBase; - collection.UnmodifiableMapBase$ = UnmodifiableMapBase$; - collection.MapView = MapView; - collection.MapView$ = MapView$; - collection.UnmodifiableMapView = UnmodifiableMapView; - collection.UnmodifiableMapView$ = UnmodifiableMapView$; - collection.Maps = Maps; - collection.Queue = Queue; - collection.Queue$ = Queue$; - collection.DoubleLinkedQueueEntry = DoubleLinkedQueueEntry; - collection.DoubleLinkedQueueEntry$ = DoubleLinkedQueueEntry$; - collection.DoubleLinkedQueue = DoubleLinkedQueue; - collection.DoubleLinkedQueue$ = DoubleLinkedQueue$; - collection.ListQueue = ListQueue; - collection.ListQueue$ = ListQueue$; - collection.SetMixin = SetMixin; - collection.SetMixin$ = SetMixin$; - collection.SetBase = SetBase; - collection.SetBase$ = SetBase$; - collection.SplayTreeMap = SplayTreeMap; - collection.SplayTreeMap$ = SplayTreeMap$; - collection.SplayTreeSet = SplayTreeSet; - collection.SplayTreeSet$ = SplayTreeSet$; + exports.HashMapKeyIterable = HashMapKeyIterable; + exports.HashMapKeyIterable$ = HashMapKeyIterable$; + exports.HashMapKeyIterator = HashMapKeyIterator; + exports.HashMapKeyIterator$ = HashMapKeyIterator$; + exports.LinkedHashMapCell = LinkedHashMapCell; + exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable; + exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$; + exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator; + exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$; + exports.HashSetIterator = HashSetIterator; + exports.HashSetIterator$ = HashSetIterator$; + exports.LinkedHashSetCell = LinkedHashSetCell; + exports.LinkedHashSetIterator = LinkedHashSetIterator; + exports.LinkedHashSetIterator$ = LinkedHashSetIterator$; + exports.UnmodifiableListView = UnmodifiableListView; + exports.UnmodifiableListView$ = UnmodifiableListView$; + exports.HashMap = HashMap; + exports.HashMap$ = HashMap$; + exports.HashSet = HashSet; + exports.HashSet$ = HashSet$; + exports.IterableMixin = IterableMixin; + exports.IterableMixin$ = IterableMixin$; + exports.IterableBase = IterableBase; + exports.IterableBase$ = IterableBase$; + exports.HasNextIterator = HasNextIterator; + exports.HasNextIterator$ = HasNextIterator$; + exports.LinkedHashMap = LinkedHashMap; + exports.LinkedHashMap$ = LinkedHashMap$; + exports.LinkedHashSet = LinkedHashSet; + exports.LinkedHashSet$ = LinkedHashSet$; + exports.LinkedList = LinkedList; + exports.LinkedList$ = LinkedList$; + exports.LinkedListEntry = LinkedListEntry; + exports.LinkedListEntry$ = LinkedListEntry$; + exports.ListBase = ListBase; + exports.ListBase$ = ListBase$; + exports.ListMixin = ListMixin; + exports.ListMixin$ = ListMixin$; + exports.MapBase = MapBase; + exports.MapBase$ = MapBase$; + exports.MapMixin = MapMixin; + exports.MapMixin$ = MapMixin$; + exports.UnmodifiableMapBase = UnmodifiableMapBase; + exports.UnmodifiableMapBase$ = UnmodifiableMapBase$; + exports.MapView = MapView; + exports.MapView$ = MapView$; + exports.UnmodifiableMapView = UnmodifiableMapView; + exports.UnmodifiableMapView$ = UnmodifiableMapView$; + exports.Maps = Maps; + exports.Queue = Queue; + exports.Queue$ = Queue$; + exports.DoubleLinkedQueueEntry = DoubleLinkedQueueEntry; + exports.DoubleLinkedQueueEntry$ = DoubleLinkedQueueEntry$; + exports.DoubleLinkedQueue = DoubleLinkedQueue; + exports.DoubleLinkedQueue$ = DoubleLinkedQueue$; + exports.ListQueue = ListQueue; + exports.ListQueue$ = ListQueue$; + exports.SetMixin = SetMixin; + exports.SetMixin$ = SetMixin$; + exports.SetBase = SetBase; + exports.SetBase$ = SetBase$; + exports.SplayTreeMap = SplayTreeMap; + exports.SplayTreeMap$ = SplayTreeMap$; + exports.SplayTreeSet = SplayTreeSet; + exports.SplayTreeSet$ = SplayTreeSet$; })(collection || (collection = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/constructors/constructors.js b/pkg/dev_compiler/test/codegen/expect/constructors/constructors.js index f009aea3623a..01653b26c53c 100644 --- a/pkg/dev_compiler/test/codegen/expect/constructors/constructors.js +++ b/pkg/dev_compiler/test/codegen/expect/constructors/constructors.js @@ -1,5 +1,5 @@ var constructors; -(function(constructors) { +(function(exports) { 'use strict'; class A extends dart.Object { } @@ -101,20 +101,20 @@ var constructors; dart.defineNamedConstructor(P, 'foo'); dart.defineNamedConstructor(P, 'bar'); // Exports: - constructors.A = A; - constructors.B = B; - constructors.C = C; - constructors.C2 = C2; - constructors.D = D; - constructors.E = E; - constructors.F = F; - constructors.G = G; - constructors.H = H; - constructors.I = I; - constructors.J = J; - constructors.K = K; - constructors.L = L; - constructors.M = M; - constructors.N = N; - constructors.P = P; + exports.A = A; + exports.B = B; + exports.C = C; + exports.C2 = C2; + exports.D = D; + exports.E = E; + exports.F = F; + exports.G = G; + exports.H = H; + exports.I = I; + exports.J = J; + exports.K = K; + exports.L = L; + exports.M = M; + exports.N = N; + exports.P = P; })(constructors || (constructors = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/convert/convert.js b/pkg/dev_compiler/test/codegen/expect/convert/convert.js index c3e2efc609fc..2a0e15baa4a7 100644 --- a/pkg/dev_compiler/test/codegen/expect/convert/convert.js +++ b/pkg/dev_compiler/test/codegen/expect/convert/convert.js @@ -1,5 +1,5 @@ var convert; -(function(convert) { +(function(exports) { 'use strict'; // Function _convertJsonToDart: (dynamic, (dynamic, dynamic) → dynamic) → dynamic function _convertJsonToDart(json, reviver) { @@ -2229,42 +2229,42 @@ var convert; } _Utf8Decoder._LIMITS = /* Unimplemented const */new List.from([_ONE_BYTE_LIMIT, _TWO_BYTE_LIMIT, _THREE_BYTE_LIMIT, _FOUR_BYTE_LIMIT]); // Exports: - convert.ASCII = ASCII; - convert.AsciiCodec = AsciiCodec; - convert.AsciiEncoder = AsciiEncoder; - convert.AsciiDecoder = AsciiDecoder; - convert.ByteConversionSink = ByteConversionSink; - convert.ByteConversionSinkBase = ByteConversionSinkBase; - convert.ChunkedConversionSink = ChunkedConversionSink; - convert.ChunkedConversionSink$ = ChunkedConversionSink$; - convert.Codec = Codec; - convert.Codec$ = Codec$; - convert.Converter = Converter; - convert.Converter$ = Converter$; - convert.Encoding = Encoding; - convert.HTML_ESCAPE = HTML_ESCAPE; - convert.HtmlEscapeMode = HtmlEscapeMode; - convert.HtmlEscape = HtmlEscape; - convert.JsonUnsupportedObjectError = JsonUnsupportedObjectError; - convert.JsonCyclicError = JsonCyclicError; - convert.JSON = JSON; - convert.JsonCodec = JsonCodec; - convert.JsonEncoder = JsonEncoder; - convert.JsonUtf8Encoder = JsonUtf8Encoder; - convert.JsonDecoder = JsonDecoder; - convert.LATIN1 = LATIN1; - convert.Latin1Codec = Latin1Codec; - convert.Latin1Encoder = Latin1Encoder; - convert.Latin1Decoder = Latin1Decoder; - convert.LineSplitter = LineSplitter; - convert.StringConversionSink = StringConversionSink; - convert.ClosableStringSink = ClosableStringSink; - convert.StringConversionSinkBase = StringConversionSinkBase; - convert.StringConversionSinkMixin = StringConversionSinkMixin; - convert.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUNE; - convert.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; - convert.UTF8 = UTF8; - convert.Utf8Codec = Utf8Codec; - convert.Utf8Encoder = Utf8Encoder; - convert.Utf8Decoder = Utf8Decoder; + exports.ASCII = ASCII; + exports.AsciiCodec = AsciiCodec; + exports.AsciiEncoder = AsciiEncoder; + exports.AsciiDecoder = AsciiDecoder; + exports.ByteConversionSink = ByteConversionSink; + exports.ByteConversionSinkBase = ByteConversionSinkBase; + exports.ChunkedConversionSink = ChunkedConversionSink; + exports.ChunkedConversionSink$ = ChunkedConversionSink$; + exports.Codec = Codec; + exports.Codec$ = Codec$; + exports.Converter = Converter; + exports.Converter$ = Converter$; + exports.Encoding = Encoding; + exports.HTML_ESCAPE = HTML_ESCAPE; + exports.HtmlEscapeMode = HtmlEscapeMode; + exports.HtmlEscape = HtmlEscape; + exports.JsonUnsupportedObjectError = JsonUnsupportedObjectError; + exports.JsonCyclicError = JsonCyclicError; + exports.JSON = JSON; + exports.JsonCodec = JsonCodec; + exports.JsonEncoder = JsonEncoder; + exports.JsonUtf8Encoder = JsonUtf8Encoder; + exports.JsonDecoder = JsonDecoder; + exports.LATIN1 = LATIN1; + exports.Latin1Codec = Latin1Codec; + exports.Latin1Encoder = Latin1Encoder; + exports.Latin1Decoder = Latin1Decoder; + exports.LineSplitter = LineSplitter; + exports.StringConversionSink = StringConversionSink; + exports.ClosableStringSink = ClosableStringSink; + exports.StringConversionSinkBase = StringConversionSinkBase; + exports.StringConversionSinkMixin = StringConversionSinkMixin; + exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUNE; + exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; + exports.UTF8 = UTF8; + exports.Utf8Codec = Utf8Codec; + exports.Utf8Encoder = Utf8Encoder; + exports.Utf8Decoder = Utf8Decoder; })(convert || (convert = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/core/core.js b/pkg/dev_compiler/test/codegen/expect/core/core.js index 26947a5cfdea..adf8db4f5d07 100644 --- a/pkg/dev_compiler/test/codegen/expect/core/core.js +++ b/pkg/dev_compiler/test/codegen/expect/core/core.js @@ -1,5 +1,5 @@ var core; -(function(core) { +(function(exports) { 'use strict'; // Function _symbolToString: (Symbol) → String function _symbolToString(symbol) { @@ -2886,73 +2886,73 @@ var core; Uri._pathCharOrSlashTable = /* Unimplemented const */new List.from([0, 0, 65490, 12287, 65535, 34815, 65534, 18431]); Uri._queryCharTable = /* Unimplemented const */new List.from([0, 0, 65490, 45055, 65535, 34815, 65534, 18431]); // Exports: - core.Deprecated = Deprecated; - core.deprecated = deprecated; - core.override = override; - core.proxy = proxy; - core.bool = bool; - core.Comparable = Comparable; - core.Comparable$ = Comparable$; - core.DateTime = DateTime; - core.double = double; - core.Duration = Duration; - core.Error = Error; - core.AssertionError = AssertionError; - core.TypeError = TypeError; - core.CastError = CastError; - core.NullThrownError = NullThrownError; - core.ArgumentError = ArgumentError; - core.RangeError = RangeError; - core.IndexError = IndexError; - core.FallThroughError = FallThroughError; - core.AbstractClassInstantiationError = AbstractClassInstantiationError; - core.NoSuchMethodError = NoSuchMethodError; - core.UnsupportedError = UnsupportedError; - core.UnimplementedError = UnimplementedError; - core.StateError = StateError; - core.ConcurrentModificationError = ConcurrentModificationError; - core.OutOfMemoryError = OutOfMemoryError; - core.StackOverflowError = StackOverflowError; - core.CyclicInitializationError = CyclicInitializationError; - core.Exception = Exception; - core.FormatException = FormatException; - core.IntegerDivisionByZeroException = IntegerDivisionByZeroException; - core.Expando = Expando; - core.Expando$ = Expando$; - core.Function = Function; - core.identical = identical; - core.identityHashCode = identityHashCode; - core.int = int; - core.Invocation = Invocation; - core.Iterable = Iterable; - core.Iterable$ = Iterable$; - core.BidirectionalIterator = BidirectionalIterator; - core.BidirectionalIterator$ = BidirectionalIterator$; - core.Iterator = Iterator; - core.Iterator$ = Iterator$; - core.List = List; - core.List$ = List$; - core.Map = Map; - core.Map$ = Map$; - core.Null = Null; - core.num = num; - core.Object = Object; - core.Pattern = Pattern; - core.print = print; - core.Match = Match; - core.RegExp = RegExp; - core.Set = Set; - core.Set$ = Set$; - core.Sink = Sink; - core.Sink$ = Sink$; - core.StackTrace = StackTrace; - core.Stopwatch = Stopwatch; - core.String = String; - core.Runes = Runes; - core.RuneIterator = RuneIterator; - core.StringBuffer = StringBuffer; - core.StringSink = StringSink; - core.Symbol = Symbol; - core.Type = Type; - core.Uri = Uri; + exports.Deprecated = Deprecated; + exports.deprecated = deprecated; + exports.override = override; + exports.proxy = proxy; + exports.bool = bool; + exports.Comparable = Comparable; + exports.Comparable$ = Comparable$; + exports.DateTime = DateTime; + exports.double = double; + exports.Duration = Duration; + exports.Error = Error; + exports.AssertionError = AssertionError; + exports.TypeError = TypeError; + exports.CastError = CastError; + exports.NullThrownError = NullThrownError; + exports.ArgumentError = ArgumentError; + exports.RangeError = RangeError; + exports.IndexError = IndexError; + exports.FallThroughError = FallThroughError; + exports.AbstractClassInstantiationError = AbstractClassInstantiationError; + exports.NoSuchMethodError = NoSuchMethodError; + exports.UnsupportedError = UnsupportedError; + exports.UnimplementedError = UnimplementedError; + exports.StateError = StateError; + exports.ConcurrentModificationError = ConcurrentModificationError; + exports.OutOfMemoryError = OutOfMemoryError; + exports.StackOverflowError = StackOverflowError; + exports.CyclicInitializationError = CyclicInitializationError; + exports.Exception = Exception; + exports.FormatException = FormatException; + exports.IntegerDivisionByZeroException = IntegerDivisionByZeroException; + exports.Expando = Expando; + exports.Expando$ = Expando$; + exports.Function = Function; + exports.identical = identical; + exports.identityHashCode = identityHashCode; + exports.int = int; + exports.Invocation = Invocation; + exports.Iterable = Iterable; + exports.Iterable$ = Iterable$; + exports.BidirectionalIterator = BidirectionalIterator; + exports.BidirectionalIterator$ = BidirectionalIterator$; + exports.Iterator = Iterator; + exports.Iterator$ = Iterator$; + exports.List = List; + exports.List$ = List$; + exports.Map = Map; + exports.Map$ = Map$; + exports.Null = Null; + exports.num = num; + exports.Object = Object; + exports.Pattern = Pattern; + exports.print = print; + exports.Match = Match; + exports.RegExp = RegExp; + exports.Set = Set; + exports.Set$ = Set$; + exports.Sink = Sink; + exports.Sink$ = Sink$; + exports.StackTrace = StackTrace; + exports.Stopwatch = Stopwatch; + exports.String = String; + exports.Runes = Runes; + exports.RuneIterator = RuneIterator; + exports.StringBuffer = StringBuffer; + exports.StringSink = StringSink; + exports.Symbol = Symbol; + exports.Type = Type; + exports.Uri = Uri; })(core || (core = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/dom/dom.js b/pkg/dev_compiler/test/codegen/expect/dom/dom.js index 86ffb73f0d5f..882fccae9fdc 100644 --- a/pkg/dev_compiler/test/codegen/expect/dom/dom.js +++ b/pkg/dev_compiler/test/codegen/expect/dom/dom.js @@ -1,5 +1,5 @@ var dom; -(function(dom) { +(function(exports) { 'use strict'; class JsType extends dart.Object { JsType(opt$) { @@ -16,7 +16,7 @@ var dom; } } let overload = new Overload(); - dom.document = null; + exports.document = null; class Document extends dart.Object { } class Element extends dart.Object { @@ -71,21 +71,21 @@ var dom; class ImageData extends dart.Object { } // Exports: - dom.JsType = JsType; - dom.JsGlobal = JsGlobal; - dom.Overload = Overload; - dom.overload = overload; - dom.Document = Document; - dom.Element = Element; - dom.Event = Event; - dom.InputElement = InputElement; - dom.CanvasElement = CanvasElement; - dom.RenderingContext = RenderingContext; - dom.CanvasRenderingContext2D = CanvasRenderingContext2D; - dom.CanvasDrawingStyles = CanvasDrawingStyles; - dom.CanvasPathMethods = CanvasPathMethods; - dom.CanvasGradient = CanvasGradient; - dom.CanvasPattern = CanvasPattern; - dom.TextMetrics = TextMetrics; - dom.ImageData = ImageData; + exports.JsType = JsType; + exports.JsGlobal = JsGlobal; + exports.Overload = Overload; + exports.overload = overload; + exports.Document = Document; + exports.Element = Element; + exports.Event = Event; + exports.InputElement = InputElement; + exports.CanvasElement = CanvasElement; + exports.RenderingContext = RenderingContext; + exports.CanvasRenderingContext2D = CanvasRenderingContext2D; + exports.CanvasDrawingStyles = CanvasDrawingStyles; + exports.CanvasPathMethods = CanvasPathMethods; + exports.CanvasGradient = CanvasGradient; + exports.CanvasPattern = CanvasPattern; + exports.TextMetrics = TextMetrics; + exports.ImageData = ImageData; })(dom || (dom = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/fieldtest/fieldtest.js b/pkg/dev_compiler/test/codegen/expect/fieldtest/fieldtest.js index ca1dda434ae0..45cf43553342 100644 --- a/pkg/dev_compiler/test/codegen/expect/fieldtest/fieldtest.js +++ b/pkg/dev_compiler/test/codegen/expect/fieldtest/fieldtest.js @@ -1,5 +1,5 @@ var fieldtest; -(function(fieldtest) { +(function(exports) { 'use strict'; class A extends dart.Object { A() { @@ -35,13 +35,13 @@ var fieldtest; function compute() { return 123; } - dart.defineLazyProperties(fieldtest, { + dart.defineLazyProperties(exports, { get y() { return compute() + 444; }, set y() {} }); - dart.copyProperties(fieldtest, { + dart.copyProperties(exports, { get q() { return core.String['+'](core.String['+']('life, ', 'the universe '), 'and everything'); }, @@ -49,7 +49,7 @@ var fieldtest; return 42; }, set z(value) { - fieldtest.y = dart.as(value, core.int); + exports.y = dart.as(value, core.int); } }); // Function main: () → void @@ -60,15 +60,15 @@ var fieldtest; core.print(baz(a)); } // Exports: - fieldtest.A = A; - fieldtest.B = B; - fieldtest.B$ = B$; - fieldtest.foo = foo; - fieldtest.bar = bar; - fieldtest.baz = baz; - fieldtest.compute = compute; - fieldtest.q = q; - fieldtest.z = z; - fieldtest.z = z; - fieldtest.main = main; + exports.A = A; + exports.B = B; + exports.B$ = B$; + exports.foo = foo; + exports.bar = bar; + exports.baz = baz; + exports.compute = compute; + exports.q = q; + exports.z = z; + exports.z = z; + exports.main = main; })(fieldtest || (fieldtest = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/html_input_a/html_input_a.js b/pkg/dev_compiler/test/codegen/expect/html_input_a/html_input_a.js index 79b9ac49b9fc..2e28a78b3e94 100644 --- a/pkg/dev_compiler/test/codegen/expect/html_input_a/html_input_a.js +++ b/pkg/dev_compiler/test/codegen/expect/html_input_a/html_input_a.js @@ -1,5 +1,5 @@ var html_input_a; -(function(html_input_a) { +(function(exports) { 'use strict'; // Function main: () → dynamic function main() { @@ -7,5 +7,5 @@ var html_input_a; core.print(` ... ${html_input_d.fib(html_input_b.x + html_input_c.y)}`); } // Exports: - html_input_a.main = main; + exports.main = main; })(html_input_a || (html_input_a = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/html_input_b/html_input_b.js b/pkg/dev_compiler/test/codegen/expect/html_input_b/html_input_b.js index 193de18fde0b..62fe15ed0a79 100644 --- a/pkg/dev_compiler/test/codegen/expect/html_input_b/html_input_b.js +++ b/pkg/dev_compiler/test/codegen/expect/html_input_b/html_input_b.js @@ -1,5 +1,5 @@ var html_input_b; -(function(html_input_b) { +(function(exports) { 'use strict'; - html_input_b.x = 22; + exports.x = 22; })(html_input_b || (html_input_b = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/html_input_c/html_input_c.js b/pkg/dev_compiler/test/codegen/expect/html_input_c/html_input_c.js index 434e5c92ab7d..c6cd4344e479 100644 --- a/pkg/dev_compiler/test/codegen/expect/html_input_c/html_input_c.js +++ b/pkg/dev_compiler/test/codegen/expect/html_input_c/html_input_c.js @@ -1,7 +1,7 @@ var html_input_c; -(function(html_input_c) { +(function(exports) { 'use strict'; - dart.defineLazyProperties(html_input_c, { + dart.defineLazyProperties(exports, { get y() { return 3 + html_input_e.w; }, diff --git a/pkg/dev_compiler/test/codegen/expect/html_input_d/html_input_d.js b/pkg/dev_compiler/test/codegen/expect/html_input_d/html_input_d.js index de39c1737580..1f4823acb3d9 100644 --- a/pkg/dev_compiler/test/codegen/expect/html_input_d/html_input_d.js +++ b/pkg/dev_compiler/test/codegen/expect/html_input_d/html_input_d.js @@ -1,5 +1,5 @@ var html_input_d; -(function(html_input_d) { +(function(exports) { 'use strict'; // Function fib: (int) → int function fib(n) { @@ -15,5 +15,5 @@ var html_input_d; return seen.get(n); } // Exports: - html_input_d.fib = fib; + exports.fib = fib; })(html_input_d || (html_input_d = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/html_input_e/html_input_e.js b/pkg/dev_compiler/test/codegen/expect/html_input_e/html_input_e.js index 277b1ed40c21..1824c522a1f9 100644 --- a/pkg/dev_compiler/test/codegen/expect/html_input_e/html_input_e.js +++ b/pkg/dev_compiler/test/codegen/expect/html_input_e/html_input_e.js @@ -1,5 +1,5 @@ var html_input_e; -(function(html_input_e) { +(function(exports) { 'use strict'; - html_input_e.w = 9; + exports.w = 9; })(html_input_e || (html_input_e = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/isolate/isolate.js b/pkg/dev_compiler/test/codegen/expect/isolate/isolate.js index facbfa45d1aa..814ba242e644 100644 --- a/pkg/dev_compiler/test/codegen/expect/isolate/isolate.js +++ b/pkg/dev_compiler/test/codegen/expect/isolate/isolate.js @@ -1,5 +1,5 @@ var isolate; -(function(isolate) { +(function(exports) { 'use strict'; class IsolateSpawnException extends dart.Object { IsolateSpawnException(message) { @@ -198,11 +198,11 @@ var isolate; } } // Exports: - isolate.IsolateSpawnException = IsolateSpawnException; - isolate.Isolate = Isolate; - isolate.SendPort = SendPort; - isolate.ReceivePort = ReceivePort; - isolate.RawReceivePort = RawReceivePort; - isolate.RemoteError = RemoteError; - isolate.Capability = Capability; + exports.IsolateSpawnException = IsolateSpawnException; + exports.Isolate = Isolate; + exports.SendPort = SendPort; + exports.ReceivePort = ReceivePort; + exports.RawReceivePort = RawReceivePort; + exports.RemoteError = RemoteError; + exports.Capability = Capability; })(isolate || (isolate = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/math/math.js b/pkg/dev_compiler/test/codegen/expect/math/math.js index 3c2ada951114..2c7a936bdc6a 100644 --- a/pkg/dev_compiler/test/codegen/expect/math/math.js +++ b/pkg/dev_compiler/test/codegen/expect/math/math.js @@ -1,5 +1,5 @@ var math; -(function(math) { +(function(exports) { 'use strict'; let E = 2.718281828459045; let LN10 = 2.302585092994046; @@ -416,32 +416,32 @@ var math; return dart.notNull(-dart.notNull(value)) * 0; } // Exports: - math.E = E; - math.LN10 = LN10; - math.LN2 = LN2; - math.LOG2E = LOG2E; - math.LOG10E = LOG10E; - math.PI = PI; - math.SQRT1_2 = SQRT1_2; - math.SQRT2 = SQRT2; - math.min = min; - math.max = max; - math.atan2 = atan2; - math.pow = pow; - math.sin = sin; - math.cos = cos; - math.tan = tan; - math.acos = acos; - math.asin = asin; - math.atan = atan; - math.sqrt = sqrt; - math.exp = exp; - math.log = log; - math.Point = Point; - math.Point$ = Point$; - math.Random = Random; - math.Rectangle = Rectangle; - math.Rectangle$ = Rectangle$; - math.MutableRectangle = MutableRectangle; - math.MutableRectangle$ = MutableRectangle$; + exports.E = E; + exports.LN10 = LN10; + exports.LN2 = LN2; + exports.LOG2E = LOG2E; + exports.LOG10E = LOG10E; + exports.PI = PI; + exports.SQRT1_2 = SQRT1_2; + exports.SQRT2 = SQRT2; + exports.min = min; + exports.max = max; + exports.atan2 = atan2; + exports.pow = pow; + exports.sin = sin; + exports.cos = cos; + exports.tan = tan; + exports.acos = acos; + exports.asin = asin; + exports.atan = atan; + exports.sqrt = sqrt; + exports.exp = exp; + exports.log = log; + exports.Point = Point; + exports.Point$ = Point$; + exports.Random = Random; + exports.Rectangle = Rectangle; + exports.Rectangle$ = Rectangle$; + exports.MutableRectangle = MutableRectangle; + exports.MutableRectangle$ = MutableRectangle$; })(math || (math = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/methods/methods.js b/pkg/dev_compiler/test/codegen/expect/methods/methods.js index 436bc92b2e7c..a1a7f3d8e50d 100644 --- a/pkg/dev_compiler/test/codegen/expect/methods/methods.js +++ b/pkg/dev_compiler/test/codegen/expect/methods/methods.js @@ -1,5 +1,5 @@ var methods; -(function(methods) { +(function(exports) { 'use strict'; class A extends dart.Object { A() { @@ -56,8 +56,8 @@ var methods; dart.dinvoke(f, 'bar', "Bar's call method!"); } // Exports: - methods.A = A; - methods.Bar = Bar; - methods.Foo = Foo; - methods.test = test; + exports.A = A; + exports.Bar = Bar; + exports.Foo = Foo; + exports.test = test; })(methods || (methods = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/sunflower/sunflower.js b/pkg/dev_compiler/test/codegen/expect/sunflower/sunflower.js index 4ae1f95732f7..5a610a6216fd 100644 --- a/pkg/dev_compiler/test/codegen/expect/sunflower/sunflower.js +++ b/pkg/dev_compiler/test/codegen/expect/sunflower/sunflower.js @@ -1,5 +1,5 @@ var sunflower; -(function(sunflower) { +(function(exports) { 'use strict'; let ORANGE = "orange"; let SEED_RADIUS = 2; @@ -12,8 +12,8 @@ var sunflower; function querySelector(selector) { return dom.document.querySelector(selector); } - sunflower.seeds = 0; - dart.defineLazyProperties(sunflower, { + exports.seeds = 0; + dart.defineLazyProperties(exports, { get slider() { return dart.as(querySelector("#slider"), dom.InputElement); }, @@ -39,14 +39,14 @@ var sunflower; this.color = ORANGE; } draw() { - sunflower.context.beginPath(); - sunflower.context.lineWidth = 2; - sunflower.context.fillStyle = this.color; - sunflower.context.strokeStyle = this.color; - sunflower.context.arc(this.x, this.y, this.radius, 0, TAU, false); - sunflower.context.fill(); - sunflower.context.closePath(); - sunflower.context.stroke(); + exports.context.beginPath(); + exports.context.lineWidth = 2; + exports.context.fillStyle = this.color; + exports.context.strokeStyle = this.color; + exports.context.arc(this.x, this.y, this.radius, 0, TAU, false); + exports.context.fill(); + exports.context.closePath(); + exports.context.stroke(); } } class SunflowerSeed extends dart.mixin(Circle, CirclePainter) { @@ -60,34 +60,34 @@ var sunflower; } // Function main: () → void function main() { - sunflower.slider.addEventListener('change', (e) => draw()); + exports.slider.addEventListener('change', (e) => draw()); draw(); } // Function draw: () → void function draw() { - sunflower.seeds = core.int.parse(sunflower.slider.value); - sunflower.context.clearRect(0, 0, MAX_D, MAX_D); - for (let i = 0; i < sunflower.seeds; i++) { - let theta = dart.notNull(i * dart.notNull(TAU)) / dart.notNull(sunflower.PHI); + exports.seeds = core.int.parse(exports.slider.value); + exports.context.clearRect(0, 0, MAX_D, MAX_D); + for (let i = 0; i < exports.seeds; i++) { + let theta = dart.notNull(i * dart.notNull(TAU)) / dart.notNull(exports.PHI); let r = math.sqrt(i) * SCALE_FACTOR; let x = dart.notNull(centerX) + dart.notNull(dart.notNull(r) * math.cos(theta)); let y = dart.notNull(centerY) - dart.notNull(dart.notNull(r) * math.sin(theta)); new SunflowerSeed(x, y, SEED_RADIUS).draw(); } - sunflower.notes.textContent = `${sunflower.seeds} seeds`; + exports.notes.textContent = `${exports.seeds} seeds`; } // Exports: - sunflower.ORANGE = ORANGE; - sunflower.SEED_RADIUS = SEED_RADIUS; - sunflower.SCALE_FACTOR = SCALE_FACTOR; - sunflower.TAU = TAU; - sunflower.MAX_D = MAX_D; - sunflower.centerX = centerX; - sunflower.centerY = centerY; - sunflower.querySelector = querySelector; - sunflower.Circle = Circle; - sunflower.CirclePainter = CirclePainter; - sunflower.SunflowerSeed = SunflowerSeed; - sunflower.main = main; - sunflower.draw = draw; + exports.ORANGE = ORANGE; + exports.SEED_RADIUS = SEED_RADIUS; + exports.SCALE_FACTOR = SCALE_FACTOR; + exports.TAU = TAU; + exports.MAX_D = MAX_D; + exports.centerX = centerX; + exports.centerY = centerY; + exports.querySelector = querySelector; + exports.Circle = Circle; + exports.CirclePainter = CirclePainter; + exports.SunflowerSeed = SunflowerSeed; + exports.main = main; + exports.draw = draw; })(sunflower || (sunflower = {})); diff --git a/pkg/dev_compiler/test/codegen/expect/typed_data/typed_data.js b/pkg/dev_compiler/test/codegen/expect/typed_data/typed_data.js index fe67945775c4..55b71930f70a 100644 --- a/pkg/dev_compiler/test/codegen/expect/typed_data/typed_data.js +++ b/pkg/dev_compiler/test/codegen/expect/typed_data/typed_data.js @@ -1,5 +1,5 @@ var typed_data; -(function(typed_data) { +(function(exports) { 'use strict'; class ByteBuffer extends dart.Object { } @@ -847,25 +847,25 @@ var typed_data; dart.defineNamedConstructor(Float64x2, 'zero'); dart.defineNamedConstructor(Float64x2, 'fromFloat32x4'); // Exports: - typed_data.ByteBuffer = ByteBuffer; - typed_data.TypedData = TypedData; - typed_data.Endianness = Endianness; - typed_data.ByteData = ByteData; - typed_data.Int8List = Int8List; - typed_data.Uint8List = Uint8List; - typed_data.Uint8ClampedList = Uint8ClampedList; - typed_data.Int16List = Int16List; - typed_data.Uint16List = Uint16List; - typed_data.Int32List = Int32List; - typed_data.Uint32List = Uint32List; - typed_data.Int64List = Int64List; - typed_data.Uint64List = Uint64List; - typed_data.Float32List = Float32List; - typed_data.Float64List = Float64List; - typed_data.Float32x4List = Float32x4List; - typed_data.Int32x4List = Int32x4List; - typed_data.Float64x2List = Float64x2List; - typed_data.Float32x4 = Float32x4; - typed_data.Int32x4 = Int32x4; - typed_data.Float64x2 = Float64x2; + exports.ByteBuffer = ByteBuffer; + exports.TypedData = TypedData; + exports.Endianness = Endianness; + exports.ByteData = ByteData; + exports.Int8List = Int8List; + exports.Uint8List = Uint8List; + exports.Uint8ClampedList = Uint8ClampedList; + exports.Int16List = Int16List; + exports.Uint16List = Uint16List; + exports.Int32List = Int32List; + exports.Uint32List = Uint32List; + exports.Int64List = Int64List; + exports.Uint64List = Uint64List; + exports.Float32List = Float32List; + exports.Float64List = Float64List; + exports.Float32x4List = Float32x4List; + exports.Int32x4List = Int32x4List; + exports.Float64x2List = Float64x2List; + exports.Float32x4 = Float32x4; + exports.Int32x4 = Int32x4; + exports.Float64x2 = Float64x2; })(typed_data || (typed_data = {}));