Skip to content

Commit

Permalink
fixes for angular hello: String + and disable broken arg parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
John Messerly committed Apr 15, 2015
1 parent 9dae584 commit da91435
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 101 deletions.
10 changes: 5 additions & 5 deletions pkg/dev_compiler/lib/runtime/dart/_interceptors.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ var _interceptors;
}
}
get isNegative() {
return dart.equals(this, 0) ? 1['/'](this) < 0 : this['<'](0);
return dart.equals(this, 0) ? core.int['/'](1, this) < 0 : this['<'](0);
}
get isNaN() {
return isNaN(this);
Expand Down Expand Up @@ -214,7 +214,7 @@ var _interceptors;
result = result + dart.dindex(match, 2);
exponent = dart.notNull(exponent) - dart.dindex(match, 2).length;
}
return core.String['+'](result, core.String['*']("0", exponent));
return dart.notNull(result) + core.String['*']("0", exponent);
}
toString() {
if (dart.notNull(dart.equals(this, 0)) && 1 / this < 0) {
Expand Down Expand Up @@ -387,8 +387,8 @@ var _interceptors;
}
static [_bitCount](i) {
i = dart.as(dart.dsend(JSInt[_shru](i, 0), '-', dart.dsend(JSInt[_shru](i, 1), '&', 1431655765)), core.int);
i = (dart.notNull(i) & 858993459)['+'](dart.dsend(JSInt[_shru](i, 2), '&', 858993459));
i = 252645135 & i['+'](JSInt[_shru](i, 4));
i = core.int['+'](dart.notNull(i) & 858993459, dart.dsend(JSInt[_shru](i, 2), '&', 858993459));
i = 252645135 & core.int['+'](i, JSInt[_shru](i, 4));
i = dart.notNull(i) + dart.notNull(dart.as(JSInt[_shru](i, 8), core.int));
i = dart.notNull(i) + dart.notNull(dart.as(JSInt[_shru](i, 16), core.int));
return dart.notNull(i) & 63;
Expand Down Expand Up @@ -740,7 +740,7 @@ var _interceptors;
let delta = dart.notNull(width) - dart.notNull(this.length);
if (dart.notNull(delta) <= 0)
return this;
return core.String['+'](core.String['*'](padding, delta), this);
return core.String['*'](padding, delta) + dart.notNull(this);
}
padRight(width, padding) {
if (padding === void 0)
Expand Down
2 changes: 1 addition & 1 deletion pkg/dev_compiler/lib/runtime/dart/_internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,7 @@ var _internal;
this[_name] = Symbol.validatePublicSymbol(name);
}
['=='](other) {
return dart.is(other, Symbol) && dart.notNull(dart.equals(this[_name], dart.dload(other, _name)));
return dart.is(other, Symbol) && dart.equals(this[_name], dart.dload(other, _name));
}
get hashCode() {
let arbitraryPrime = 664597;
Expand Down
6 changes: 3 additions & 3 deletions pkg/dev_compiler/lib/runtime/dart/_isolate_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ var _isolate_helper;
let isWindowDefined = exports.globalWindow != null;
let isWorkerDefined = exports.globalWorker != null;
this.isWorker = !dart.notNull(isWindowDefined) && dart.notNull(exports.globalPostMessageDefined);
this.supportsWorkers = dart.notNull(this.isWorker) || dart.notNull(isWorkerDefined) && dart.notNull(IsolateNatives.thisScript != null);
this.supportsWorkers = dart.notNull(this.isWorker) || dart.notNull(isWorkerDefined) && IsolateNatives.thisScript != null;
this.fromCommandLine = !dart.notNull(isWindowDefined) && !dart.notNull(this.isWorker);
}
[_nativeInitWorkerMessageHandler]() {
Expand Down Expand Up @@ -1011,8 +1011,8 @@ var _isolate_helper;
return IsolateNatives.spawn(null, uri.toString(), args, message, isLight, isSpawnUri, startPaused);
}
static spawn(functionName, uri, args, message, isLight, isSpawnUri, startPaused) {
if (dart.notNull(uri != null) && dart.notNull(uri.endsWith(".dart"))) {
uri = core.String['+'](uri, ".js");
if (uri != null && dart.notNull(uri.endsWith(".dart"))) {
uri = dart.notNull(uri) + ".js";
}
let port = new isolate.ReceivePort();
let completer = dart.as(new async.Completer(), async.Completer$(core.List));
Expand Down
94 changes: 47 additions & 47 deletions pkg/dev_compiler/lib/runtime/dart/_js_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var _js_helper;
}
forEach(f) {
let keys = this[_keys];
for (let i = 0; i['<'](dart.dload(keys, 'length')); i = dart.notNull(i) + 1) {
for (let i = 0; core.int['<'](i, dart.dload(keys, 'length')); i = dart.notNull(i) + 1) {
let key = dart.dindex(keys, i);
f(dart.as(key, K), dart.as(this[_fetch](key), V));
}
Expand Down Expand Up @@ -377,7 +377,7 @@ var _js_helper;
let context = window;
let fun = function() {
};
for (let i = 0; i['<'](dart.dload(tags, 'length')); i = dart.notNull(i) + 1) {
for (let i = 0; core.int['<'](i, dart.dload(tags, 'length')); i = dart.notNull(i) + 1) {
let tag = dart.dindex(tags, i);
let proto = dart.dcall(exports.prototypeForTagFunction, tag);
if (proto != null) {
Expand All @@ -390,15 +390,15 @@ var _js_helper;
}
}
}
for (let i = 0; i['<'](dart.dload(tags, 'length')); i = dart.notNull(i) + 1) {
for (let i = 0; core.int['<'](i, dart.dload(tags, 'length')); i = dart.notNull(i) + 1) {
let tag = tags[i];
if (/^[A-Za-z_]/.test(tag)) {
let interceptorClass = propertyGet(map, tag);
propertySet(map, core.String['+'](INSTANCE_CACHED_MARK, tag), interceptorClass);
propertySet(map, core.String['+'](UNCACHED_MARK, tag), interceptorClass);
propertySet(map, core.String['+'](LEAF_MARK, tag), interceptorClass);
propertySet(map, core.String['+'](INTERIOR_MARK, tag), interceptorClass);
propertySet(map, core.String['+'](DISCRIMINATED_MARK, tag), interceptorClass);
propertySet(map, dart.notNull(INSTANCE_CACHED_MARK) + dart.notNull(tag), interceptorClass);
propertySet(map, dart.notNull(UNCACHED_MARK) + dart.notNull(tag), interceptorClass);
propertySet(map, dart.notNull(LEAF_MARK) + dart.notNull(tag), interceptorClass);
propertySet(map, dart.notNull(INTERIOR_MARK) + dart.notNull(tag), interceptorClass);
propertySet(map, dart.notNull(DISCRIMINATED_MARK) + dart.notNull(tag), interceptorClass);
}
}
}
Expand Down Expand Up @@ -891,7 +891,7 @@ var _js_helper;
return this[_typeName].hashCode;
}
['=='](other) {
return dart.is(other, TypeImpl) && dart.notNull(dart.equals(this[_typeName], dart.dload(other, _typeName)));
return dart.is(other, TypeImpl) && dart.equals(this[_typeName], dart.dload(other, _typeName));
}
}
TypeImpl[dart.implements] = () => [core.Type];
Expand Down Expand Up @@ -1092,7 +1092,7 @@ var _js_helper;
}
// Function isSupertypeOfNull: (dynamic) → bool
function isSupertypeOfNull(type) {
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());
return dart.notNull(type == null) || getConstructorName(type) == _foreign_helper.JS_OBJECT_CLASS_NAME() || getConstructorName(type) == _foreign_helper.JS_NULL_CLASS_NAME();
}
// Function checkSubtypeOfRuntimeType: (dynamic, dynamic) → bool
function checkSubtypeOfRuntimeType(o, t) {
Expand Down Expand Up @@ -1724,8 +1724,8 @@ var _js_helper;
let _mangledNameMatchesType = Symbol('_mangledNameMatchesType');
class Primitives extends core.Object {
static initializeStatics(id) {
Primitives.mirrorFunctionCacheName = core.String['+'](Primitives.mirrorFunctionCacheName, `_${id}`);
Primitives.mirrorInvokeCacheName = core.String['+'](Primitives.mirrorInvokeCacheName, `_${id}`);
Primitives.mirrorFunctionCacheName = dart.notNull(Primitives.mirrorFunctionCacheName) + `_${id}`;
Primitives.mirrorInvokeCacheName = dart.notNull(Primitives.mirrorInvokeCacheName) + `_${id}`;
}
static objectHashCode(object) {
let hash = dart.as(object.$identityHash, core.int);
Expand Down Expand Up @@ -1799,7 +1799,7 @@ var _js_helper;
let result = parseFloat(source);
if (result.isNaN) {
let trimmed = source.trim();
if (dart.notNull(trimmed == 'NaN') || dart.notNull(trimmed == '+NaN') || dart.notNull(trimmed == '-NaN')) {
if (trimmed == 'NaN' || trimmed == '+NaN' || trimmed == '-NaN') {
return result;
}
return handleError(source);
Expand Down Expand Up @@ -1883,8 +1883,8 @@ var _js_helper;
if (dart.dsend(i, '<=', 65535)) {
a[core.$add](dart.as(i, core.int));
} else if (dart.dsend(i, '<=', 1114111)) {
a[core.$add](55296['+'](dart.dsend(dart.dsend(dart.dsend(i, '-', 65536), '>>', 10), '&', 1023)));
a[core.$add](56320['+'](dart.dsend(i, '&', 1023)));
a[core.$add](core.int['+'](55296, dart.dsend(dart.dsend(dart.dsend(i, '-', 65536), '>>', 10), '&', 1023)));
a[core.$add](core.int['+'](56320, dart.dsend(i, '&', 1023)));
} else {
throw new core.ArgumentError(i);
}
Expand All @@ -1903,14 +1903,14 @@ var _js_helper;
return Primitives[_fromCharCodeApply](dart.as(charCodes, core.List$(core.int)));
}
static stringFromCharCode(charCode) {
if (0['<='](charCode)) {
if (core.int['<='](0, charCode)) {
if (dart.dsend(charCode, '<=', 65535)) {
return String.fromCharCode(charCode);
}
if (dart.dsend(charCode, '<=', 1114111)) {
let bits = dart.dsend(charCode, '-', 65536);
let low = 56320['|'](dart.dsend(bits, '&', 1023));
let high = 55296['|'](dart.dsend(bits, '>>', 10));
let low = core.int['|'](56320, dart.dsend(bits, '&', 1023));
let high = core.int['|'](55296, dart.dsend(bits, '>>', 10));
return String.fromCharCode(high, low);
}
}
Expand Down Expand Up @@ -3382,7 +3382,7 @@ var _js_helper;
static listToRti(list) {
list = list;
let result = [];
for (let i = 0; i['<'](dart.dload(list, 'length')); i = dart.notNull(i) + 1) {
for (let i = 0; core.int['<'](i, dart.dload(list, 'length')); i = dart.notNull(i) + 1) {
result.push(dart.dsend(dart.dindex(list, i), 'toRti'));
}
return result;
Expand All @@ -3394,46 +3394,46 @@ var _js_helper;
for (let i = 0; dart.notNull(i) < dart.notNull(this.parameterTypes[core.$length]); i = dart.notNull(i) + 1) {
let type = this.parameterTypes[core.$get](i);
if (needsComma) {
result = core.String['+'](result, ', ');
result = dart.notNull(result) + ', ';
}
result = core.String['+'](result, `${type}`);
result = dart.notNull(result) + `${type}`;
needsComma = true;
}
}
if (dart.notNull(this.optionalParameterTypes != null) && !dart.notNull(this.optionalParameterTypes[core.$isEmpty])) {
if (needsComma) {
result = core.String['+'](result, ', ');
result = dart.notNull(result) + ', ';
}
needsComma = false;
result = core.String['+'](result, '[');
result = dart.notNull(result) + '[';
for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterTypes[core.$length]); i = dart.notNull(i) + 1) {
let type = this.optionalParameterTypes[core.$get](i);
if (needsComma) {
result = core.String['+'](result, ', ');
result = dart.notNull(result) + ', ';
}
result = core.String['+'](result, `${type}`);
result = dart.notNull(result) + `${type}`;
needsComma = true;
}
result = core.String['+'](result, ']');
result = dart.notNull(result) + ']';
} else if (this.namedParameters != null) {
if (needsComma) {
result = core.String['+'](result, ', ');
result = dart.notNull(result) + ', ';
}
needsComma = false;
result = core.String['+'](result, '{');
result = dart.notNull(result) + '{';
let keys = _js_names.extractKeys(this.namedParameters);
for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = dart.notNull(i) + 1) {
let name = keys[core.$get](i);
if (needsComma) {
result = core.String['+'](result, ', ');
result = dart.notNull(result) + ', ';
}
let rti = dart.dsend(this.namedParameters[name], 'toRti');
result = core.String['+'](result, `${rti} ${name}`);
result = dart.notNull(result) + `${rti} ${name}`;
needsComma = true;
}
result = core.String['+'](result, '}');
result = dart.notNull(result) + '}';
}
result = core.String['+'](result, `) -> ${this.returnType}`);
result = dart.notNull(result) + `) -> ${this.returnType}`;
return result;
}
}
Expand Down Expand Up @@ -3625,39 +3625,39 @@ var _js_helper;
let sep = '';
if (this[_hasArguments]) {
for (let argument of this[_arguments]) {
s = core.String['+'](s, sep);
s = core.String['+'](s, this[_convert](argument));
s = dart.notNull(s) + dart.notNull(sep);
s = dart.notNull(s) + dart.notNull(this[_convert](argument));
sep = ', ';
}
}
if (this[_hasOptionalArguments]) {
s = core.String['+'](s, `${sep}[`);
s = dart.notNull(s) + `${sep}[`;
sep = '';
for (let argument of this[_optionalArguments]) {
s = core.String['+'](s, sep);
s = core.String['+'](s, this[_convert](argument));
s = dart.notNull(s) + dart.notNull(sep);
s = dart.notNull(s) + dart.notNull(this[_convert](argument));
sep = ', ';
}
s = core.String['+'](s, ']');
s = dart.notNull(s) + ']';
}
if (this[_hasNamedArguments]) {
s = core.String['+'](s, `${sep}{`);
s = dart.notNull(s) + `${sep}{`;
sep = '';
for (let name of _js_names.extractKeys(this[_namedArguments])) {
s = core.String['+'](s, sep);
s = core.String['+'](s, `${name}: `);
s = core.String['+'](s, this[_convert](this[_namedArguments][name]));
s = dart.notNull(s) + dart.notNull(sep);
s = dart.notNull(s) + `${name}: `;
s = dart.notNull(s) + dart.notNull(this[_convert](this[_namedArguments][name]));
sep = ', ';
}
s = core.String['+'](s, '}');
s = dart.notNull(s) + '}';
}
s = core.String['+'](s, ') -> ');
s = dart.notNull(s) + ') -> ';
if (this[_isVoid]) {
s = core.String['+'](s, 'void');
s = dart.notNull(s) + 'void';
} else if (this[_hasReturnType]) {
s = core.String['+'](s, this[_convert](this[_returnType]));
s = dart.notNull(s) + dart.notNull(this[_convert](this[_returnType]));
} else {
s = core.String['+'](s, 'dynamic');
s = dart.notNull(s) + 'dynamic';
}
return this[_cachedToString] = `${s}`;
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/dev_compiler/lib/runtime/dart/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var async;
toString() {
let result = `Uncaught Error: ${this.error}`;
if (this.stackTrace != null) {
result = core.String['+'](result, `\nStack Trace:\n${this.stackTrace}`);
result = dart.notNull(result) + `\nStack Trace:\n${this.stackTrace}`;
}
return result;
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/dev_compiler/lib/runtime/dart/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ var collection;
if (!dart.notNull(iterator.moveNext()))
return "";
let buffer = new core.StringBuffer();
if (dart.notNull(separator == null) || dart.notNull(separator == "")) {
if (separator == null || separator == "") {
do {
buffer.write(`${iterator.current}`);
} while (iterator.moveNext());
Expand Down Expand Up @@ -488,7 +488,7 @@ var collection;
if (!dart.notNull(iterator.moveNext()))
return "";
let buffer = new core.StringBuffer();
if (dart.notNull(separator == null) || dart.notNull(separator == "")) {
if (separator == null || separator == "") {
do {
buffer.write(`${iterator.current}`);
} while (iterator.moveNext());
Expand Down Expand Up @@ -689,7 +689,7 @@ var collection;
if (!dart.notNull(iterator.moveNext()))
return "";
let buffer = new core.StringBuffer();
if (dart.notNull(separator == null) || dart.notNull(separator == "")) {
if (separator == null || separator == "") {
do {
buffer.write(`${iterator.current}`);
} while (iterator.moveNext());
Expand Down Expand Up @@ -833,7 +833,7 @@ var collection;
if (rightDelimiter === void 0)
rightDelimiter = ')';
if (IterableBase[_isToStringVisiting](iterable)) {
if (dart.notNull(leftDelimiter == "(") && dart.notNull(rightDelimiter == ")")) {
if (leftDelimiter == "(" && rightDelimiter == ")") {
return "(...)";
}
return `${leftDelimiter}...${rightDelimiter}`;
Expand Down
2 changes: 1 addition & 1 deletion pkg/dev_compiler/lib/runtime/dart/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ var convert;
}
addSlice(chunk, start, end, isLast) {
if (this[_carry] != null) {
chunk = core.String['+'](this[_carry], chunk.substring(start, end));
chunk = dart.notNull(this[_carry]) + dart.notNull(chunk.substring(start, end));
start = 0;
end = chunk.length;
this[_carry] = null;
Expand Down
Loading

0 comments on commit da91435

Please sign in to comment.