Skip to content

Commit da91435

Browse files
author
John Messerly
committed
fixes for angular hello: String + and disable broken arg parsing
[email protected] Review URL: https://codereview.chromium.org/1085723002
1 parent 9dae584 commit da91435

File tree

11 files changed

+109
-101
lines changed

11 files changed

+109
-101
lines changed

pkg/dev_compiler/lib/runtime/dart/_interceptors.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ var _interceptors;
7878
}
7979
}
8080
get isNegative() {
81-
return dart.equals(this, 0) ? 1['/'](this) < 0 : this['<'](0);
81+
return dart.equals(this, 0) ? core.int['/'](1, this) < 0 : this['<'](0);
8282
}
8383
get isNaN() {
8484
return isNaN(this);
@@ -214,7 +214,7 @@ var _interceptors;
214214
result = result + dart.dindex(match, 2);
215215
exponent = dart.notNull(exponent) - dart.dindex(match, 2).length;
216216
}
217-
return core.String['+'](result, core.String['*']("0", exponent));
217+
return dart.notNull(result) + core.String['*']("0", exponent);
218218
}
219219
toString() {
220220
if (dart.notNull(dart.equals(this, 0)) && 1 / this < 0) {
@@ -387,8 +387,8 @@ var _interceptors;
387387
}
388388
static [_bitCount](i) {
389389
i = dart.as(dart.dsend(JSInt[_shru](i, 0), '-', dart.dsend(JSInt[_shru](i, 1), '&', 1431655765)), core.int);
390-
i = (dart.notNull(i) & 858993459)['+'](dart.dsend(JSInt[_shru](i, 2), '&', 858993459));
391-
i = 252645135 & i['+'](JSInt[_shru](i, 4));
390+
i = core.int['+'](dart.notNull(i) & 858993459, dart.dsend(JSInt[_shru](i, 2), '&', 858993459));
391+
i = 252645135 & core.int['+'](i, JSInt[_shru](i, 4));
392392
i = dart.notNull(i) + dart.notNull(dart.as(JSInt[_shru](i, 8), core.int));
393393
i = dart.notNull(i) + dart.notNull(dart.as(JSInt[_shru](i, 16), core.int));
394394
return dart.notNull(i) & 63;
@@ -740,7 +740,7 @@ var _interceptors;
740740
let delta = dart.notNull(width) - dart.notNull(this.length);
741741
if (dart.notNull(delta) <= 0)
742742
return this;
743-
return core.String['+'](core.String['*'](padding, delta), this);
743+
return core.String['*'](padding, delta) + dart.notNull(this);
744744
}
745745
padRight(width, padding) {
746746
if (padding === void 0)

pkg/dev_compiler/lib/runtime/dart/_internal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@ var _internal;
18461846
this[_name] = Symbol.validatePublicSymbol(name);
18471847
}
18481848
['=='](other) {
1849-
return dart.is(other, Symbol) && dart.notNull(dart.equals(this[_name], dart.dload(other, _name)));
1849+
return dart.is(other, Symbol) && dart.equals(this[_name], dart.dload(other, _name));
18501850
}
18511851
get hashCode() {
18521852
let arbitraryPrime = 664597;

pkg/dev_compiler/lib/runtime/dart/_isolate_helper.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ var _isolate_helper;
445445
let isWindowDefined = exports.globalWindow != null;
446446
let isWorkerDefined = exports.globalWorker != null;
447447
this.isWorker = !dart.notNull(isWindowDefined) && dart.notNull(exports.globalPostMessageDefined);
448-
this.supportsWorkers = dart.notNull(this.isWorker) || dart.notNull(isWorkerDefined) && dart.notNull(IsolateNatives.thisScript != null);
448+
this.supportsWorkers = dart.notNull(this.isWorker) || dart.notNull(isWorkerDefined) && IsolateNatives.thisScript != null;
449449
this.fromCommandLine = !dart.notNull(isWindowDefined) && !dart.notNull(this.isWorker);
450450
}
451451
[_nativeInitWorkerMessageHandler]() {
@@ -1011,8 +1011,8 @@ var _isolate_helper;
10111011
return IsolateNatives.spawn(null, uri.toString(), args, message, isLight, isSpawnUri, startPaused);
10121012
}
10131013
static spawn(functionName, uri, args, message, isLight, isSpawnUri, startPaused) {
1014-
if (dart.notNull(uri != null) && dart.notNull(uri.endsWith(".dart"))) {
1015-
uri = core.String['+'](uri, ".js");
1014+
if (uri != null && dart.notNull(uri.endsWith(".dart"))) {
1015+
uri = dart.notNull(uri) + ".js";
10161016
}
10171017
let port = new isolate.ReceivePort();
10181018
let completer = dart.as(new async.Completer(), async.Completer$(core.List));

pkg/dev_compiler/lib/runtime/dart/_js_helper.js

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ var _js_helper;
9393
}
9494
forEach(f) {
9595
let keys = this[_keys];
96-
for (let i = 0; i['<'](dart.dload(keys, 'length')); i = dart.notNull(i) + 1) {
96+
for (let i = 0; core.int['<'](i, dart.dload(keys, 'length')); i = dart.notNull(i) + 1) {
9797
let key = dart.dindex(keys, i);
9898
f(dart.as(key, K), dart.as(this[_fetch](key), V));
9999
}
@@ -377,7 +377,7 @@ var _js_helper;
377377
let context = window;
378378
let fun = function() {
379379
};
380-
for (let i = 0; i['<'](dart.dload(tags, 'length')); i = dart.notNull(i) + 1) {
380+
for (let i = 0; core.int['<'](i, dart.dload(tags, 'length')); i = dart.notNull(i) + 1) {
381381
let tag = dart.dindex(tags, i);
382382
let proto = dart.dcall(exports.prototypeForTagFunction, tag);
383383
if (proto != null) {
@@ -390,15 +390,15 @@ var _js_helper;
390390
}
391391
}
392392
}
393-
for (let i = 0; i['<'](dart.dload(tags, 'length')); i = dart.notNull(i) + 1) {
393+
for (let i = 0; core.int['<'](i, dart.dload(tags, 'length')); i = dart.notNull(i) + 1) {
394394
let tag = tags[i];
395395
if (/^[A-Za-z_]/.test(tag)) {
396396
let interceptorClass = propertyGet(map, tag);
397-
propertySet(map, core.String['+'](INSTANCE_CACHED_MARK, tag), interceptorClass);
398-
propertySet(map, core.String['+'](UNCACHED_MARK, tag), interceptorClass);
399-
propertySet(map, core.String['+'](LEAF_MARK, tag), interceptorClass);
400-
propertySet(map, core.String['+'](INTERIOR_MARK, tag), interceptorClass);
401-
propertySet(map, core.String['+'](DISCRIMINATED_MARK, tag), interceptorClass);
397+
propertySet(map, dart.notNull(INSTANCE_CACHED_MARK) + dart.notNull(tag), interceptorClass);
398+
propertySet(map, dart.notNull(UNCACHED_MARK) + dart.notNull(tag), interceptorClass);
399+
propertySet(map, dart.notNull(LEAF_MARK) + dart.notNull(tag), interceptorClass);
400+
propertySet(map, dart.notNull(INTERIOR_MARK) + dart.notNull(tag), interceptorClass);
401+
propertySet(map, dart.notNull(DISCRIMINATED_MARK) + dart.notNull(tag), interceptorClass);
402402
}
403403
}
404404
}
@@ -891,7 +891,7 @@ var _js_helper;
891891
return this[_typeName].hashCode;
892892
}
893893
['=='](other) {
894-
return dart.is(other, TypeImpl) && dart.notNull(dart.equals(this[_typeName], dart.dload(other, _typeName)));
894+
return dart.is(other, TypeImpl) && dart.equals(this[_typeName], dart.dload(other, _typeName));
895895
}
896896
}
897897
TypeImpl[dart.implements] = () => [core.Type];
@@ -1092,7 +1092,7 @@ var _js_helper;
10921092
}
10931093
// Function isSupertypeOfNull: (dynamic) → bool
10941094
function isSupertypeOfNull(type) {
1095-
return dart.notNull(type == null) || dart.notNull(getConstructorName(type) == _foreign_helper.JS_OBJECT_CLASS_NAME()) || dart.notNull(getConstructorName(type) == _foreign_helper.JS_NULL_CLASS_NAME());
1095+
return dart.notNull(type == null) || getConstructorName(type) == _foreign_helper.JS_OBJECT_CLASS_NAME() || getConstructorName(type) == _foreign_helper.JS_NULL_CLASS_NAME();
10961096
}
10971097
// Function checkSubtypeOfRuntimeType: (dynamic, dynamic) → bool
10981098
function checkSubtypeOfRuntimeType(o, t) {
@@ -1724,8 +1724,8 @@ var _js_helper;
17241724
let _mangledNameMatchesType = Symbol('_mangledNameMatchesType');
17251725
class Primitives extends core.Object {
17261726
static initializeStatics(id) {
1727-
Primitives.mirrorFunctionCacheName = core.String['+'](Primitives.mirrorFunctionCacheName, `_${id}`);
1728-
Primitives.mirrorInvokeCacheName = core.String['+'](Primitives.mirrorInvokeCacheName, `_${id}`);
1727+
Primitives.mirrorFunctionCacheName = dart.notNull(Primitives.mirrorFunctionCacheName) + `_${id}`;
1728+
Primitives.mirrorInvokeCacheName = dart.notNull(Primitives.mirrorInvokeCacheName) + `_${id}`;
17291729
}
17301730
static objectHashCode(object) {
17311731
let hash = dart.as(object.$identityHash, core.int);
@@ -1799,7 +1799,7 @@ var _js_helper;
17991799
let result = parseFloat(source);
18001800
if (result.isNaN) {
18011801
let trimmed = source.trim();
1802-
if (dart.notNull(trimmed == 'NaN') || dart.notNull(trimmed == '+NaN') || dart.notNull(trimmed == '-NaN')) {
1802+
if (trimmed == 'NaN' || trimmed == '+NaN' || trimmed == '-NaN') {
18031803
return result;
18041804
}
18051805
return handleError(source);
@@ -1883,8 +1883,8 @@ var _js_helper;
18831883
if (dart.dsend(i, '<=', 65535)) {
18841884
a[core.$add](dart.as(i, core.int));
18851885
} else if (dart.dsend(i, '<=', 1114111)) {
1886-
a[core.$add](55296['+'](dart.dsend(dart.dsend(dart.dsend(i, '-', 65536), '>>', 10), '&', 1023)));
1887-
a[core.$add](56320['+'](dart.dsend(i, '&', 1023)));
1886+
a[core.$add](core.int['+'](55296, dart.dsend(dart.dsend(dart.dsend(i, '-', 65536), '>>', 10), '&', 1023)));
1887+
a[core.$add](core.int['+'](56320, dart.dsend(i, '&', 1023)));
18881888
} else {
18891889
throw new core.ArgumentError(i);
18901890
}
@@ -1903,14 +1903,14 @@ var _js_helper;
19031903
return Primitives[_fromCharCodeApply](dart.as(charCodes, core.List$(core.int)));
19041904
}
19051905
static stringFromCharCode(charCode) {
1906-
if (0['<='](charCode)) {
1906+
if (core.int['<='](0, charCode)) {
19071907
if (dart.dsend(charCode, '<=', 65535)) {
19081908
return String.fromCharCode(charCode);
19091909
}
19101910
if (dart.dsend(charCode, '<=', 1114111)) {
19111911
let bits = dart.dsend(charCode, '-', 65536);
1912-
let low = 56320['|'](dart.dsend(bits, '&', 1023));
1913-
let high = 55296['|'](dart.dsend(bits, '>>', 10));
1912+
let low = core.int['|'](56320, dart.dsend(bits, '&', 1023));
1913+
let high = core.int['|'](55296, dart.dsend(bits, '>>', 10));
19141914
return String.fromCharCode(high, low);
19151915
}
19161916
}
@@ -3382,7 +3382,7 @@ var _js_helper;
33823382
static listToRti(list) {
33833383
list = list;
33843384
let result = [];
3385-
for (let i = 0; i['<'](dart.dload(list, 'length')); i = dart.notNull(i) + 1) {
3385+
for (let i = 0; core.int['<'](i, dart.dload(list, 'length')); i = dart.notNull(i) + 1) {
33863386
result.push(dart.dsend(dart.dindex(list, i), 'toRti'));
33873387
}
33883388
return result;
@@ -3394,46 +3394,46 @@ var _js_helper;
33943394
for (let i = 0; dart.notNull(i) < dart.notNull(this.parameterTypes[core.$length]); i = dart.notNull(i) + 1) {
33953395
let type = this.parameterTypes[core.$get](i);
33963396
if (needsComma) {
3397-
result = core.String['+'](result, ', ');
3397+
result = dart.notNull(result) + ', ';
33983398
}
3399-
result = core.String['+'](result, `${type}`);
3399+
result = dart.notNull(result) + `${type}`;
34003400
needsComma = true;
34013401
}
34023402
}
34033403
if (dart.notNull(this.optionalParameterTypes != null) && !dart.notNull(this.optionalParameterTypes[core.$isEmpty])) {
34043404
if (needsComma) {
3405-
result = core.String['+'](result, ', ');
3405+
result = dart.notNull(result) + ', ';
34063406
}
34073407
needsComma = false;
3408-
result = core.String['+'](result, '[');
3408+
result = dart.notNull(result) + '[';
34093409
for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterTypes[core.$length]); i = dart.notNull(i) + 1) {
34103410
let type = this.optionalParameterTypes[core.$get](i);
34113411
if (needsComma) {
3412-
result = core.String['+'](result, ', ');
3412+
result = dart.notNull(result) + ', ';
34133413
}
3414-
result = core.String['+'](result, `${type}`);
3414+
result = dart.notNull(result) + `${type}`;
34153415
needsComma = true;
34163416
}
3417-
result = core.String['+'](result, ']');
3417+
result = dart.notNull(result) + ']';
34183418
} else if (this.namedParameters != null) {
34193419
if (needsComma) {
3420-
result = core.String['+'](result, ', ');
3420+
result = dart.notNull(result) + ', ';
34213421
}
34223422
needsComma = false;
3423-
result = core.String['+'](result, '{');
3423+
result = dart.notNull(result) + '{';
34243424
let keys = _js_names.extractKeys(this.namedParameters);
34253425
for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = dart.notNull(i) + 1) {
34263426
let name = keys[core.$get](i);
34273427
if (needsComma) {
3428-
result = core.String['+'](result, ', ');
3428+
result = dart.notNull(result) + ', ';
34293429
}
34303430
let rti = dart.dsend(this.namedParameters[name], 'toRti');
3431-
result = core.String['+'](result, `${rti} ${name}`);
3431+
result = dart.notNull(result) + `${rti} ${name}`;
34323432
needsComma = true;
34333433
}
3434-
result = core.String['+'](result, '}');
3434+
result = dart.notNull(result) + '}';
34353435
}
3436-
result = core.String['+'](result, `) -> ${this.returnType}`);
3436+
result = dart.notNull(result) + `) -> ${this.returnType}`;
34373437
return result;
34383438
}
34393439
}
@@ -3625,39 +3625,39 @@ var _js_helper;
36253625
let sep = '';
36263626
if (this[_hasArguments]) {
36273627
for (let argument of this[_arguments]) {
3628-
s = core.String['+'](s, sep);
3629-
s = core.String['+'](s, this[_convert](argument));
3628+
s = dart.notNull(s) + dart.notNull(sep);
3629+
s = dart.notNull(s) + dart.notNull(this[_convert](argument));
36303630
sep = ', ';
36313631
}
36323632
}
36333633
if (this[_hasOptionalArguments]) {
3634-
s = core.String['+'](s, `${sep}[`);
3634+
s = dart.notNull(s) + `${sep}[`;
36353635
sep = '';
36363636
for (let argument of this[_optionalArguments]) {
3637-
s = core.String['+'](s, sep);
3638-
s = core.String['+'](s, this[_convert](argument));
3637+
s = dart.notNull(s) + dart.notNull(sep);
3638+
s = dart.notNull(s) + dart.notNull(this[_convert](argument));
36393639
sep = ', ';
36403640
}
3641-
s = core.String['+'](s, ']');
3641+
s = dart.notNull(s) + ']';
36423642
}
36433643
if (this[_hasNamedArguments]) {
3644-
s = core.String['+'](s, `${sep}{`);
3644+
s = dart.notNull(s) + `${sep}{`;
36453645
sep = '';
36463646
for (let name of _js_names.extractKeys(this[_namedArguments])) {
3647-
s = core.String['+'](s, sep);
3648-
s = core.String['+'](s, `${name}: `);
3649-
s = core.String['+'](s, this[_convert](this[_namedArguments][name]));
3647+
s = dart.notNull(s) + dart.notNull(sep);
3648+
s = dart.notNull(s) + `${name}: `;
3649+
s = dart.notNull(s) + dart.notNull(this[_convert](this[_namedArguments][name]));
36503650
sep = ', ';
36513651
}
3652-
s = core.String['+'](s, '}');
3652+
s = dart.notNull(s) + '}';
36533653
}
3654-
s = core.String['+'](s, ') -> ');
3654+
s = dart.notNull(s) + ') -> ';
36553655
if (this[_isVoid]) {
3656-
s = core.String['+'](s, 'void');
3656+
s = dart.notNull(s) + 'void';
36573657
} else if (this[_hasReturnType]) {
3658-
s = core.String['+'](s, this[_convert](this[_returnType]));
3658+
s = dart.notNull(s) + dart.notNull(this[_convert](this[_returnType]));
36593659
} else {
3660-
s = core.String['+'](s, 'dynamic');
3660+
s = dart.notNull(s) + 'dynamic';
36613661
}
36623662
return this[_cachedToString] = `${s}`;
36633663
}

pkg/dev_compiler/lib/runtime/dart/async.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var async;
4343
toString() {
4444
let result = `Uncaught Error: ${this.error}`;
4545
if (this.stackTrace != null) {
46-
result = core.String['+'](result, `\nStack Trace:\n${this.stackTrace}`);
46+
result = dart.notNull(result) + `\nStack Trace:\n${this.stackTrace}`;
4747
}
4848
return result;
4949
}

pkg/dev_compiler/lib/runtime/dart/collection.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ var collection;
242242
if (!dart.notNull(iterator.moveNext()))
243243
return "";
244244
let buffer = new core.StringBuffer();
245-
if (dart.notNull(separator == null) || dart.notNull(separator == "")) {
245+
if (separator == null || separator == "") {
246246
do {
247247
buffer.write(`${iterator.current}`);
248248
} while (iterator.moveNext());
@@ -488,7 +488,7 @@ var collection;
488488
if (!dart.notNull(iterator.moveNext()))
489489
return "";
490490
let buffer = new core.StringBuffer();
491-
if (dart.notNull(separator == null) || dart.notNull(separator == "")) {
491+
if (separator == null || separator == "") {
492492
do {
493493
buffer.write(`${iterator.current}`);
494494
} while (iterator.moveNext());
@@ -689,7 +689,7 @@ var collection;
689689
if (!dart.notNull(iterator.moveNext()))
690690
return "";
691691
let buffer = new core.StringBuffer();
692-
if (dart.notNull(separator == null) || dart.notNull(separator == "")) {
692+
if (separator == null || separator == "") {
693693
do {
694694
buffer.write(`${iterator.current}`);
695695
} while (iterator.moveNext());
@@ -833,7 +833,7 @@ var collection;
833833
if (rightDelimiter === void 0)
834834
rightDelimiter = ')';
835835
if (IterableBase[_isToStringVisiting](iterable)) {
836-
if (dart.notNull(leftDelimiter == "(") && dart.notNull(rightDelimiter == ")")) {
836+
if (leftDelimiter == "(" && rightDelimiter == ")") {
837837
return "(...)";
838838
}
839839
return `${leftDelimiter}...${rightDelimiter}`;

pkg/dev_compiler/lib/runtime/dart/convert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,7 @@ var convert;
14001400
}
14011401
addSlice(chunk, start, end, isLast) {
14021402
if (this[_carry] != null) {
1403-
chunk = core.String['+'](this[_carry], chunk.substring(start, end));
1403+
chunk = dart.notNull(this[_carry]) + dart.notNull(chunk.substring(start, end));
14041404
start = 0;
14051405
end = chunk.length;
14061406
this[_carry] = null;

0 commit comments

Comments
 (0)