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

Commit 9027fd9

Browse files
committed
fuse List and js Array together and a few other misc fixes.
BUG= [email protected] Review URL: https://codereview.chromium.org/1071393007
1 parent 8cb39fc commit 9027fd9

File tree

13 files changed

+1467
-221
lines changed

13 files changed

+1467
-221
lines changed

lib/runtime/dart/_js_helper.js

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ var _js_helper;
884884
toString() {
885885
if (this[_unmangledName] != null)
886886
return this[_unmangledName];
887-
let unmangledName = _js_names.unmangleAllIdentifiersIfPreservedAnyways(this[_typeName]);
887+
let unmangledName = unmangleAllIdentifiersIfPreservedAnyways(this[_typeName]);
888888
return this[_unmangledName] = unmangledName;
889889
}
890890
get hashCode() {
@@ -1334,6 +1334,14 @@ var _js_helper;
13341334
function isNotIdentical(s, t) {
13351335
return s !== t;
13361336
}
1337+
// Function unmangleGlobalNameIfPreservedAnyways: (String) → String
1338+
function unmangleGlobalNameIfPreservedAnyways(str) {
1339+
return str;
1340+
}
1341+
// Function unmangleAllIdentifiersIfPreservedAnyways: (String) → String
1342+
function unmangleAllIdentifiersIfPreservedAnyways(str) {
1343+
return str;
1344+
}
13371345
class _Patch extends core.Object {
13381346
_Patch() {
13391347
}
@@ -1807,19 +1815,16 @@ var _js_helper;
18071815
return result;
18081816
}
18091817
static formatType(className, typeArguments) {
1810-
return _js_names.unmangleAllIdentifiersIfPreservedAnyways(`${className}${joinArguments(typeArguments, 0)}`);
1818+
return unmangleAllIdentifiersIfPreservedAnyways(`${className}${joinArguments(typeArguments, 0)}`);
18111819
}
18121820
static objectTypeName(object) {
1813-
let name = constructorNameFallback(_interceptors.getInterceptor(object));
1821+
let name = Primitives.constructorNameFallback(object);
18141822
if (name == 'Object') {
18151823
let decompiled = String(object.constructor).match(/^\s*function\s*(\S*)\s*\(/)[1];
18161824
if (typeof decompiled == 'string')
18171825
if (/^\w+$/.test(decompiled))
18181826
name = dart.as(decompiled, core.String);
18191827
}
1820-
if (dart.notNull(name.length) > 1 && dart.notNull(core.identical(name.codeUnitAt(0), Primitives.DOLLAR_CHAR_VALUE))) {
1821-
name = name.substring(1);
1822-
}
18231828
return Primitives.formatType(name, dart.as(getRuntimeTypeInfo(object), core.List));
18241829
}
18251830
static objectToString(object) {
@@ -2123,6 +2128,22 @@ var _js_helper;
21232128
Primitives.DOLLAR_CHAR_VALUE = 36;
21242129
Primitives.timerFrequency = null;
21252130
Primitives.timerTicks = null;
2131+
dart.defineLazyProperties(Primitives, {
2132+
get constructorNameFallback() {
2133+
return function getTagFallback(o) {
2134+
var constructor = o.constructor;
2135+
if (typeof constructor == "function") {
2136+
var name = constructor.name;
2137+
if (typeof name == "string" && name.length > 2 && name !== "Object" && name !== "Function.prototype") {
2138+
return name;
2139+
}
2140+
}
2141+
var s = Object.prototype.toString.call(o);
2142+
return s.substring(8, s.length - 1);
2143+
};
2144+
},
2145+
set constructorNameFallback(_) {}
2146+
});
21262147
class JsCache extends core.Object {
21272148
static allocate() {
21282149
let result = Object.create(null);
@@ -3932,6 +3953,8 @@ var _js_helper;
39323953
exports.isJsObject = isJsObject;
39333954
exports.isIdentical = isIdentical;
39343955
exports.isNotIdentical = isNotIdentical;
3956+
exports.unmangleGlobalNameIfPreservedAnyways = unmangleGlobalNameIfPreservedAnyways;
3957+
exports.unmangleAllIdentifiersIfPreservedAnyways = unmangleAllIdentifiersIfPreservedAnyways;
39353958
exports.patch = patch;
39363959
exports.InternalMap = InternalMap;
39373960
exports.requiresPreamble = requiresPreamble;

lib/runtime/dart/collection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,7 @@ var collection;
18011801
get [core.$reversed]() {
18021802
return new (_internal.ReversedListIterable$(E))(this);
18031803
}
1804-
toString() {
1804+
[core.$toString]() {
18051805
return IterableBase.iterableToFullString(this, '[', ']');
18061806
}
18071807
}

0 commit comments

Comments
 (0)