Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit d9fadc3

Browse files
author
John Messerly
committed
fixes #157, renaming local library identifiers if needed.
readability regression, but fairly simple fix. looks okay in libraries with few imports, bad if they have a lot. ultimately I think this gets cleaned up as part of emitting modules + handling module lowering in JS codegen, see issue #34. [email protected] Review URL: https://codereview.chromium.org/1122133003
1 parent ca517db commit d9fadc3

40 files changed

+247
-121
lines changed

lib/runtime/dart/_foreign_helper.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
var _foreign_helper;
2-
(function(exports) {
1+
var _foreign_helper = dart.defineLibrary(_foreign_helper, {});
2+
var core = dart.import(core);
3+
(function(exports, core) {
34
'use strict';
45
// Function JS: (String, String, [dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic]) → dynamic
56
function JS(typeDescription, codeTemplate, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
@@ -152,4 +153,4 @@ var _foreign_helper;
152153
exports.JS_EFFECT = JS_EFFECT;
153154
exports.JS_CONST = JS_CONST;
154155
exports.JS_STRING_CONCAT = JS_STRING_CONCAT;
155-
})(_foreign_helper || (_foreign_helper = {}));
156+
})(_foreign_helper, core);

lib/runtime/dart/_interceptors.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
var _interceptors;
2-
(function(exports) {
1+
var _interceptors = dart.defineLibrary(_interceptors, {});
2+
var core = dart.import(core);
3+
var _js_helper = dart.lazyImport(_js_helper);
4+
var _internal = dart.import(_internal);
5+
var _foreign_helper = dart.import(_foreign_helper);
6+
var _js_embedded_names = dart.import(_js_embedded_names);
7+
(function(exports, core, _js_helper, _internal, _foreign_helper, _js_embedded_names) {
38
'use strict';
49
let JSArray = Array;
510
let JSMutableArray$ = dart.generic(function(E) {
@@ -1086,4 +1091,4 @@ var _interceptors;
10861091
exports.JavaScriptObject = JavaScriptObject;
10871092
exports.PlainJavaScriptObject = PlainJavaScriptObject;
10881093
exports.UnknownJavaScriptObject = UnknownJavaScriptObject;
1089-
})(_interceptors || (_interceptors = {}));
1094+
})(_interceptors, core, _js_helper, _internal, _foreign_helper, _js_embedded_names);

lib/runtime/dart/_internal.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
var _internal;
2-
(function(exports) {
1+
var _internal = dart.defineLibrary(_internal, {});
2+
var core = dart.import(core);
3+
var collection = dart.import(collection);
4+
var math = dart.lazyImport(math);
5+
var _interceptors = dart.lazyImport(_interceptors);
6+
var _js_primitives = dart.lazyImport(_js_primitives);
7+
(function(exports, core, collection, math, _interceptors, _js_primitives) {
38
'use strict';
49
class EfficientLength extends core.Object {}
510
let ListIterable$ = dart.generic(function(E) {
@@ -2040,4 +2045,4 @@ var _internal;
20402045
exports.Sort = Sort;
20412046
exports.Symbol = Symbol;
20422047
exports.POWERS_OF_TEN = POWERS_OF_TEN;
2043-
})(_internal || (_internal = {}));
2048+
})(_internal, core, collection, math, _interceptors, _js_primitives);

lib/runtime/dart/_isolate_helper.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
var _isolate_helper;
2-
(function(exports) {
1+
var _isolate_helper = dart.defineLibrary(_isolate_helper, {});
2+
var core = dart.import(core);
3+
var _native_typed_data = dart.import(_native_typed_data);
4+
var _interceptors = dart.lazyImport(_interceptors);
5+
var _js_helper = dart.lazyImport(_js_helper);
6+
var isolate = dart.import(isolate);
7+
var _foreign_helper = dart.import(_foreign_helper);
8+
var _js_embedded_names = dart.import(_js_embedded_names);
9+
var collection = dart.import(collection);
10+
var async = dart.import(async);
11+
(function(exports, core, _native_typed_data, _interceptors, _js_helper, isolate, _foreign_helper, _js_embedded_names, collection, async) {
312
'use strict';
413
// Function _serializeMessage: (dynamic) → dynamic
514
function _serializeMessage(message) {
@@ -1384,4 +1393,4 @@ var _isolate_helper;
13841393
exports.TimerImpl = TimerImpl;
13851394
exports.hasTimer = hasTimer;
13861395
exports.CapabilityImpl = CapabilityImpl;
1387-
})(_isolate_helper || (_isolate_helper = {}));
1396+
})(_isolate_helper, core, _native_typed_data, _interceptors, _js_helper, isolate, _foreign_helper, _js_embedded_names, collection, async);

lib/runtime/dart/_js_embedded_names.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var _js_embedded_names;
1+
var _js_embedded_names = dart.defineLibrary(_js_embedded_names, {});
22
(function(exports) {
33
'use strict';
44
let DISPATCH_PROPERTY_NAME = "dispatchPropertyName";
@@ -64,4 +64,4 @@ var _js_embedded_names;
6464
exports.TYPEDEF_PREDICATE_PROPERTY_NAME = TYPEDEF_PREDICATE_PROPERTY_NAME;
6565
exports.NATIVE_SUPERCLASS_TAG_NAME = NATIVE_SUPERCLASS_TAG_NAME;
6666
exports.MAP_TYPE_TO_INTERCEPTOR = MAP_TYPE_TO_INTERCEPTOR;
67-
})(_js_embedded_names || (_js_embedded_names = {}));
67+
})(_js_embedded_names);

lib/runtime/dart/_js_helper.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
var _js_helper;
2-
(function(exports) {
1+
var _js_helper = dart.defineLibrary(_js_helper, {});
2+
var core = dart.import(core);
3+
var collection = dart.import(collection);
4+
var _internal = dart.import(_internal);
5+
var _foreign_helper = dart.import(_foreign_helper);
6+
var _js_embedded_names = dart.import(_js_embedded_names);
7+
var _interceptors = dart.lazyImport(_interceptors);
8+
var _js_names = dart.import(_js_names);
9+
var async = dart.import(async);
10+
var _isolate_helper = dart.lazyImport(_isolate_helper);
11+
(function(exports, core, collection, _internal, _foreign_helper, _js_embedded_names, _interceptors, _js_names, async, _isolate_helper) {
312
'use strict';
413
class NoSideEffects extends core.Object {
514
NoSideEffects() {
@@ -4080,4 +4089,4 @@ var _js_helper;
40804089
exports.missingMain = missingMain;
40814090
exports.badMain = badMain;
40824091
exports.mainHasTooManyParameters = mainHasTooManyParameters;
4083-
})(_js_helper || (_js_helper = {}));
4092+
})(_js_helper, core, collection, _internal, _foreign_helper, _js_embedded_names, _interceptors, _js_names, async, _isolate_helper);

lib/runtime/dart/_js_names.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
var _js_names;
2-
(function(exports) {
1+
var _js_names = dart.defineLibrary(_js_names, {});
2+
var _foreign_helper = dart.lazyImport(_foreign_helper);
3+
var _js_embedded_names = dart.import(_js_embedded_names);
4+
var core = dart.import(core);
5+
var _interceptors = dart.import(_interceptors);
6+
var _js_helper = dart.lazyImport(_js_helper);
7+
(function(exports, _foreign_helper, _js_embedded_names, core, _interceptors, _js_helper) {
38
'use strict';
49
// Function preserveNames: () → dynamic
510
function preserveNames() {
@@ -76,4 +81,4 @@ var _js_names;
7681
exports.extractKeys = extractKeys;
7782
exports.unmangleGlobalNameIfPreservedAnyways = unmangleGlobalNameIfPreservedAnyways;
7883
exports.unmangleAllIdentifiersIfPreservedAnyways = unmangleAllIdentifiersIfPreservedAnyways;
79-
})(_js_names || (_js_names = {}));
84+
})(_js_names, _foreign_helper, _js_embedded_names, core, _interceptors, _js_helper);

lib/runtime/dart/_js_primitives.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var _js_primitives;
1+
var _js_primitives = dart.defineLibrary(_js_primitives, {});
22
(function(exports) {
33
'use strict';
44
// Function printString: (String) → void
@@ -22,4 +22,4 @@ var _js_primitives;
2222
}
2323
// Exports:
2424
exports.printString = printString;
25-
})(_js_primitives || (_js_primitives = {}));
25+
})(_js_primitives);

lib/runtime/dart/_native_typed_data.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
var _native_typed_data;
2-
(function(exports) {
1+
var _native_typed_data = dart.defineLibrary(_native_typed_data, {});
2+
var core = dart.import(core);
3+
var typed_data = dart.lazyImport(typed_data);
4+
var collection = dart.import(collection);
5+
var _internal = dart.import(_internal);
6+
var _interceptors = dart.lazyImport(_interceptors);
7+
var _js_helper = dart.lazyImport(_js_helper);
8+
var math = dart.import(math);
9+
(function(exports, core, typed_data, collection, _internal, _interceptors, _js_helper, math) {
310
'use strict';
411
class NativeByteBuffer extends core.Object {
512
NativeByteBuffer() {
@@ -1555,4 +1562,4 @@ var _native_typed_data;
15551562
exports.NativeFloat32x4 = NativeFloat32x4;
15561563
exports.NativeInt32x4 = NativeInt32x4;
15571564
exports.NativeFloat64x2 = NativeFloat64x2;
1558-
})(_native_typed_data || (_native_typed_data = {}));
1565+
})(_native_typed_data, core, typed_data, collection, _internal, _interceptors, _js_helper, math);

lib/runtime/dart/async.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
var async;
2-
(function(exports) {
1+
var async = dart.defineLibrary(async, {});
2+
var core = dart.import(core);
3+
var _internal = dart.import(_internal);
4+
var _js_helper = dart.lazyImport(_js_helper);
5+
var _isolate_helper = dart.lazyImport(_isolate_helper);
6+
var collection = dart.import(collection);
7+
(function(exports, core, _internal, _js_helper, _isolate_helper, collection) {
38
'use strict';
49
// Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic
510
function _invokeErrorHandler(errorHandler, error, stackTrace) {
@@ -5361,4 +5366,4 @@ var async;
53615366
exports.ZoneDelegate = ZoneDelegate;
53625367
exports.Zone = Zone;
53635368
exports.runZoned = runZoned;
5364-
})(async || (async = {}));
5369+
})(async, core, _internal, _js_helper, _isolate_helper, collection);

0 commit comments

Comments
 (0)