From d52346c20140bc046b4a7e361f8fc0742e7a1388 Mon Sep 17 00:00:00 2001 From: John Messerly Date: Wed, 10 Jun 2015 12:21:49 -0700 Subject: [PATCH] fixes #215, removes special case for length R=vsm@google.com Review URL: https://codereview.chromium.org/1178523004. --- .../lib/runtime/dart/_interceptors.js | 150 +++++++++--------- .../lib/runtime/dart/_internal.js | 106 ++++++------- .../lib/runtime/dart/_isolate_helper.js | 16 +- .../lib/runtime/dart/_js_helper.js | 28 ++-- .../lib/runtime/dart/_native_typed_data.js | 16 +- .../lib/runtime/dart/collection.js | 126 +++++++-------- pkg/dev_compiler/lib/runtime/dart/convert.js | 106 ++++++------- pkg/dev_compiler/lib/runtime/dart/core.js | 126 +++++++-------- pkg/dev_compiler/lib/runtime/dart/isolate.js | 2 +- .../lib/src/codegen/js_codegen.dart | 3 +- .../test/codegen/expect/BenchmarkBase.js | 6 +- .../test/codegen/expect/DeltaBlue.js | 20 +-- .../test/codegen/expect/cascade.js | 6 +- 13 files changed, 355 insertions(+), 356 deletions(-) diff --git a/pkg/dev_compiler/lib/runtime/dart/_interceptors.js b/pkg/dev_compiler/lib/runtime/dart/_interceptors.js index 658cf7971923..615c98079d6b 100644 --- a/pkg/dev_compiler/lib/runtime/dart/_interceptors.js +++ b/pkg/dev_compiler/lib/runtime/dart/_interceptors.js @@ -95,7 +95,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ [dartx.removeAt](index) { if (!(typeof index == 'number')) throw new core.ArgumentError(index); - if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(this.length)) { + if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(this[dartx.length])) { throw new core.RangeError.value(index); } this[dartx.checkGrowable]('removeAt'); @@ -105,7 +105,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ dart.as(value, E); if (!(typeof index == 'number')) throw new core.ArgumentError(index); - if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this.length)) { + if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[dartx.length])) { throw new core.RangeError.value(index); } this[dartx.checkGrowable]('insert'); @@ -122,13 +122,13 @@ dart.library('dart/_interceptors', null, /* Imports */[ } [dartx.removeLast]() { this[dartx.checkGrowable]('removeLast'); - if (this.length == 0) + if (this[dartx.length] == 0) throw new core.RangeError.value(-1); return dart.as(this.pop(), E); } [dartx.remove](element) { this[dartx.checkGrowable]('remove'); - for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) { if (dart.equals(this[dartx.get](i), element)) { this.splice(i, 1); return true; @@ -159,14 +159,14 @@ dart.library('dart/_interceptors', null, /* Imports */[ } } [dartx.clear]() { - this.length = 0; + this[dartx.length] = 0; } [dartx.forEach](f) { dart.as(f, dart.functionType(dart.void, [E])); - let length = this.length; + let length = this[dartx.length]; for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) { f(dart.as(this[i], E)); - if (length != this.length) { + if (length != this[dartx.length]) { throw new core.ConcurrentModificationError(this); } } @@ -178,8 +178,8 @@ dart.library('dart/_interceptors', null, /* Imports */[ [dartx.join](separator) { if (separator === void 0) separator = ""; - let list = core.List.new(this.length); - for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.notNull(i) + 1) { + let list = core.List.new(this[dartx.length]); + for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) { list[dartx.set](i, `${this[dartx.get](i)}`); } return list.join(separator); @@ -231,16 +231,16 @@ dart.library('dart/_interceptors', null, /* Imports */[ _js_helper.checkNull(start); if (!(typeof start == 'number')) throw new core.ArgumentError(start); - if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this.length)) { - throw new core.RangeError.range(start, 0, this.length); + if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[dartx.length])) { + throw new core.RangeError.range(start, 0, this[dartx.length]); } if (end == null) { - end = this.length; + end = this[dartx.length]; } else { if (!(typeof end == 'number')) throw new core.ArgumentError(end); - if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.notNull(this.length)) { - throw new core.RangeError.range(end, start, this.length); + if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.notNull(this[dartx.length])) { + throw new core.RangeError.range(end, start, this[dartx.length]); } } if (start == end) @@ -251,25 +251,25 @@ dart.library('dart/_interceptors', null, /* Imports */[ return new (_internal.IterableMixinWorkaround$(E))().getRangeList(this, start, end); } get [dartx.first]() { - if (dart.notNull(this.length) > 0) + if (dart.notNull(this[dartx.length]) > 0) return this[dartx.get](0); throw new core.StateError("No elements"); } get [dartx.last]() { - if (dart.notNull(this.length) > 0) - return this[dartx.get](dart.notNull(this.length) - 1); + if (dart.notNull(this[dartx.length]) > 0) + return this[dartx.get](dart.notNull(this[dartx.length]) - 1); throw new core.StateError("No elements"); } get [dartx.single]() { - if (this.length == 1) + if (this[dartx.length] == 1) return this[dartx.get](0); - if (this.length == 0) + if (this[dartx.length] == 0) throw new core.StateError("No elements"); throw new core.StateError("More than one element"); } [dartx.removeRange](start, end) { this[dartx.checkGrowable]('removeRange'); - let receiverLength = this.length; + let receiverLength = this[dartx.length]; if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(receiverLength)) { throw new core.RangeError.range(start, 0, receiverLength); } @@ -277,7 +277,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ throw new core.RangeError.range(end, start, receiverLength); } _internal.Lists.copy(this, end, this, start, dart.notNull(receiverLength) - dart.notNull(end)); - this.length = dart.notNull(receiverLength) - (dart.notNull(end) - dart.notNull(start)); + this[dartx.length] = dart.notNull(receiverLength) - (dart.notNull(end) - dart.notNull(start)); } [dartx.setRange](start, end, iterable, skipCount) { dart.as(iterable, core.Iterable$(E)); @@ -328,14 +328,14 @@ dart.library('dart/_interceptors', null, /* Imports */[ return _internal.IterableMixinWorkaround.lastIndexOfList(this, element, start); } [dartx.contains](other) { - for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) { if (dart.equals(this[dartx.get](i), other)) return true; } return false; } get [dartx.isEmpty]() { - return this.length == 0; + return this[dartx.length] == 0; } get [dartx.isNotEmpty]() { return !dart.notNull(this[dartx.isEmpty]); @@ -359,10 +359,10 @@ dart.library('dart/_interceptors', null, /* Imports */[ get [dartx.hashCode]() { return _js_helper.Primitives.objectHashCode(this); } - get length() { + get [dartx.length]() { return dart.as(this.length, core.int); } - set length(newLength) { + set [dartx.length](newLength) { if (!(typeof newLength == 'number')) throw new core.ArgumentError(newLength); if (dart.notNull(newLength) < 0) @@ -373,7 +373,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ [dartx.get](index) { if (!(typeof index == 'number')) throw new core.ArgumentError(index); - if (dart.notNull(index) >= dart.notNull(this.length) || dart.notNull(index) < 0) + if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notNull(index) < 0) throw new core.RangeError.value(index); return dart.as(this[index], E); } @@ -381,7 +381,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ dart.as(value, E); if (!(typeof index == 'number')) throw new core.ArgumentError(index); - if (dart.notNull(index) >= dart.notNull(this.length) || dart.notNull(index) < 0) + if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notNull(index) < 0) throw new core.RangeError.value(index); this[index] = value; } @@ -638,7 +638,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ throw new core.RangeError(radix); let result = this.toString(radix); let rightParenCode = 41; - if (result[dartx.codeUnitAt](dart.notNull(result.length) - 1) != rightParenCode) { + if (result[dartx.codeUnitAt](dart.notNull(result[dartx.length]) - 1) != rightParenCode) { return result; } return JSNumber._handleIEtoString(result); @@ -992,7 +992,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ throw new core.ArgumentError(index); if (dart.notNull(index) < 0) throw new core.RangeError.value(index); - if (dart.notNull(index) >= dart.notNull(this.length)) + if (dart.notNull(index) >= dart.notNull(this[dartx.length])) throw new core.RangeError.value(index); return dart.as(this.charCodeAt(index), core.int); } @@ -1001,20 +1001,20 @@ dart.library('dart/_interceptors', null, /* Imports */[ start = 0; _js_helper.checkString(string); _js_helper.checkInt(start); - if (0 > dart.notNull(start) || dart.notNull(start) > dart.notNull(string.length)) { - throw new core.RangeError.range(start, 0, string.length); + if (0 > dart.notNull(start) || dart.notNull(start) > dart.notNull(string[dartx.length])) { + throw new core.RangeError.range(start, 0, string[dartx.length]); } return _js_helper.allMatchesInStringUnchecked(this, string, start); } [dartx.matchAsPrefix](string, start) { if (start === void 0) start = 0; - if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.length)) { - throw new core.RangeError.range(start, 0, string.length); + if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[dartx.length])) { + throw new core.RangeError.range(start, 0, string[dartx.length]); } - if (dart.notNull(start) + dart.notNull(this.length) > dart.notNull(string.length)) + if (dart.notNull(start) + dart.notNull(this[dartx.length]) > dart.notNull(string[dartx.length])) return null; - for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) { if (string[dartx.codeUnitAt](dart.notNull(start) + dart.notNull(i)) != this[dartx.codeUnitAt](i)) { return null; } @@ -1028,10 +1028,10 @@ dart.library('dart/_interceptors', null, /* Imports */[ } [dartx.endsWith](other) { _js_helper.checkString(other); - let otherLength = other.length; - if (dart.notNull(otherLength) > dart.notNull(this.length)) + let otherLength = other[dartx.length]; + if (dart.notNull(otherLength) > dart.notNull(this[dartx.length])) return false; - return other == this[dartx.substring](dart.notNull(this.length) - dart.notNull(otherLength)); + return other == this[dartx.substring](dart.notNull(this[dartx.length]) - dart.notNull(otherLength)); } [dartx.replaceAll](from, to) { _js_helper.checkString(to); @@ -1050,8 +1050,8 @@ dart.library('dart/_interceptors', null, /* Imports */[ startIndex = 0; _js_helper.checkString(to); _js_helper.checkInt(startIndex); - if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNull(this.length)) { - throw new core.RangeError.range(startIndex, 0, this.length); + if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNull(this[dartx.length])) { + throw new core.RangeError.range(startIndex, 0, this[dartx.length]); } return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, startIndex), core.String); } @@ -1081,7 +1081,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ result[dartx.add](this[dartx.substring](start, end)); start = matchEnd; } - if (dart.notNull(start) < dart.notNull(this.length) || dart.notNull(length) > 0) { + if (dart.notNull(start) < dart.notNull(this[dartx.length]) || dart.notNull(length) > 0) { result[dartx.add](this[dartx.substring](start)); } return result; @@ -1090,14 +1090,14 @@ dart.library('dart/_interceptors', null, /* Imports */[ if (index === void 0) index = 0; _js_helper.checkInt(index); - if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this.length)) { - throw new core.RangeError.range(index, 0, this.length); + if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[dartx.length])) { + throw new core.RangeError.range(index, 0, this[dartx.length]); } if (typeof pattern == 'string') { let other = pattern; - let otherLength = other.length; + let otherLength = other[dartx.length]; let endIndex = dart.notNull(index) + dart.notNull(otherLength); - if (dart.notNull(endIndex) > dart.notNull(this.length)) + if (dart.notNull(endIndex) > dart.notNull(this[dartx.length])) return false; return other == this.substring(index, endIndex); } @@ -1108,13 +1108,13 @@ dart.library('dart/_interceptors', null, /* Imports */[ endIndex = null; _js_helper.checkInt(startIndex); if (endIndex == null) - endIndex = this.length; + endIndex = this[dartx.length]; _js_helper.checkInt(endIndex); if (dart.notNull(startIndex) < 0) throw new core.RangeError.value(startIndex); if (dart.notNull(startIndex) > dart.notNull(endIndex)) throw new core.RangeError.value(startIndex); - if (dart.notNull(endIndex) > dart.notNull(this.length)) + if (dart.notNull(endIndex) > dart.notNull(this[dartx.length])) throw new core.RangeError.value(endIndex); return this.substring(startIndex, endIndex); } @@ -1176,7 +1176,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ static _skipLeadingWhitespace(string, index) { let SPACE = 32; let CARRIAGE_RETURN = 13; - while (dart.notNull(index) < dart.notNull(string.length)) { + while (dart.notNull(index) < dart.notNull(string[dartx.length])) { let codeUnit = string[dartx.codeUnitAt](index); if (codeUnit != SPACE && codeUnit != CARRIAGE_RETURN && !dart.notNull(JSString._isWhitespace(codeUnit))) { break; @@ -1200,21 +1200,21 @@ dart.library('dart/_interceptors', null, /* Imports */[ [dartx.trim]() { let NEL = 133; let result = this.trim(); - if (result.length == 0) + if (result[dartx.length] == 0) return result; let firstCode = result[dartx.codeUnitAt](0); let startIndex = 0; if (firstCode == NEL) { startIndex = JSString._skipLeadingWhitespace(result, 1); - if (startIndex == result.length) + if (startIndex == result[dartx.length]) return ""; } - let endIndex = result.length; + let endIndex = result[dartx.length]; let lastCode = result[dartx.codeUnitAt](dart.notNull(endIndex) - 1); if (lastCode == NEL) { endIndex = JSString._skipTrailingWhitespace(result, dart.notNull(endIndex) - 1); } - if (startIndex == 0 && endIndex == result.length) + if (startIndex == 0 && endIndex == result[dartx.length]) return result; return result.substring(startIndex, endIndex); } @@ -1224,7 +1224,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ let startIndex = 0; if (typeof this.trimLeft != "undefined") { result = this.trimLeft(); - if (result.length == 0) + if (result[dartx.length] == 0) return result; let firstCode = result[dartx.codeUnitAt](0); if (firstCode == NEL) { @@ -1236,7 +1236,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ } if (startIndex == 0) return result; - if (startIndex == result.length) + if (startIndex == result[dartx.length]) return ""; return result.substring(startIndex); } @@ -1246,7 +1246,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ let endIndex = null; if (typeof this.trimRight != "undefined") { result = this.trimRight(); - endIndex = result.length; + endIndex = result[dartx.length]; if (endIndex == 0) return result; let lastCode = result[dartx.codeUnitAt](dart.notNull(endIndex) - 1); @@ -1255,9 +1255,9 @@ dart.library('dart/_interceptors', null, /* Imports */[ } } else { result = this; - endIndex = JSString._skipTrailingWhitespace(this, this.length); + endIndex = JSString._skipTrailingWhitespace(this, this[dartx.length]); } - if (endIndex == result.length) + if (endIndex == result[dartx.length]) return result; if (endIndex == 0) return ""; @@ -1266,7 +1266,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ [dartx['*']](times) { if (0 >= dart.notNull(times)) return ''; - if (times == 1 || this.length == 0) + if (times == 1 || this[dartx.length] == 0) return this; if (!dart.equals(times, times >>> 0)) { throw dart.const(new core.OutOfMemoryError()); @@ -1286,7 +1286,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ [dartx.padLeft](width, padding) { if (padding === void 0) padding = ' '; - let delta = dart.notNull(width) - dart.notNull(this.length); + let delta = dart.notNull(width) - dart.notNull(this[dartx.length]); if (dart.notNull(delta) <= 0) return this; return padding[dartx['*']](delta) + this; @@ -1294,7 +1294,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ [dartx.padRight](width, padding) { if (padding === void 0) padding = ' '; - let delta = dart.notNull(width) - dart.notNull(this.length); + let delta = dart.notNull(width) - dart.notNull(this[dartx.length]); if (dart.notNull(delta) <= 0) return this; return this[dartx['+']](padding[dartx['*']](delta)); @@ -1311,8 +1311,8 @@ dart.library('dart/_interceptors', null, /* Imports */[ _js_helper.checkNull(pattern); if (!(typeof start == 'number')) throw new core.ArgumentError(start); - if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this.length)) { - throw new core.RangeError.range(start, 0, this.length); + if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[dartx.length])) { + throw new core.RangeError.range(start, 0, this[dartx.length]); } if (typeof pattern == 'string') { return this.indexOf(pattern, start); @@ -1322,7 +1322,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ let match = _js_helper.firstMatchAfter(re, this, start); return match == null ? -1 : match.start; } - for (let i = start; dart.notNull(i) <= dart.notNull(this.length); i = dart.notNull(i) + 1) { + for (let i = start; dart.notNull(i) <= dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) { if (pattern[dartx.matchAsPrefix](this, i) != null) return i; } @@ -1333,16 +1333,16 @@ dart.library('dart/_interceptors', null, /* Imports */[ start = null; _js_helper.checkNull(pattern); if (start == null) { - start = this.length; + start = this[dartx.length]; } else if (!(typeof start == 'number')) { throw new core.ArgumentError(start); - } else if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this.length)) { - throw new core.RangeError.range(start, 0, this.length); + } else if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[dartx.length])) { + throw new core.RangeError.range(start, 0, this[dartx.length]); } if (typeof pattern == 'string') { let other = pattern; - if (dart.notNull(start) + dart.notNull(other.length) > dart.notNull(this.length)) { - start = dart.notNull(this.length) - dart.notNull(other.length); + if (dart.notNull(start) + dart.notNull(other[dartx.length]) > dart.notNull(this[dartx.length])) { + start = dart.notNull(this[dartx.length]) - dart.notNull(other[dartx.length]); } return dart.as(_js_helper.stringLastIndexOfUnchecked(this, other, start), core.int); } @@ -1356,13 +1356,13 @@ dart.library('dart/_interceptors', null, /* Imports */[ if (startIndex === void 0) startIndex = 0; _js_helper.checkNull(other); - if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNull(this.length)) { - throw new core.RangeError.range(startIndex, 0, this.length); + if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNull(this[dartx.length])) { + throw new core.RangeError.range(startIndex, 0, this[dartx.length]); } return dart.as(_js_helper.stringContainsUnchecked(this, other, startIndex), core.bool); } get [dartx.isEmpty]() { - return this.length == 0; + return this[dartx.length] == 0; } get [dartx.isNotEmpty]() { return !dart.notNull(this[dartx.isEmpty]); @@ -1377,7 +1377,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ } get [dartx.hashCode]() { let hash = 0; - for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) { hash = 536870911 & dart.notNull(hash) + this.charCodeAt(i); hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) << 10); hash = hash ^ hash >> 6; @@ -1389,13 +1389,13 @@ dart.library('dart/_interceptors', null, /* Imports */[ get [dartx.runtimeType]() { return core.String; } - get length() { + get [dartx.length]() { return this.length; } [dartx.get](index) { if (!(typeof index == 'number')) throw new core.ArgumentError(index); - if (dart.notNull(index) >= dart.notNull(this.length) || dart.notNull(index) < 0) + if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notNull(index) < 0) throw new core.RangeError.value(index); return this[index]; } @@ -1446,7 +1446,7 @@ dart.library('dart/_interceptors', null, /* Imports */[ this[_string] = string; } get length() { - return this[_string].length; + return this[_string][dartx.length]; } get(i) { return this[_string][dartx.codeUnitAt](i); diff --git a/pkg/dev_compiler/lib/runtime/dart/_internal.js b/pkg/dev_compiler/lib/runtime/dart/_internal.js index bd7cd046a0d1..d8e517416d31 100644 --- a/pkg/dev_compiler/lib/runtime/dart/_internal.js +++ b/pkg/dev_compiler/lib/runtime/dart/_internal.js @@ -221,7 +221,7 @@ dart.library('dart/_internal', null, /* Imports */[ let result = null; if (dart.notNull(growable)) { result = core.List$(E).new(); - result.length = this.length; + result[dartx.length] = this.length; } else { result = core.List$(E).new(this.length); } @@ -309,19 +309,19 @@ dart.library('dart/_internal', null, /* Imports */[ } } get [_endIndex]() { - let length = this[_iterable].length; + let length = this[_iterable][dartx.length]; if (this[_endOrLength] == null || dart.notNull(this[_endOrLength]) > dart.notNull(length)) return length; return this[_endOrLength]; } get [_startIndex]() { - let length = this[_iterable].length; + let length = this[_iterable][dartx.length]; if (dart.notNull(this[_start]) > dart.notNull(length)) return length; return this[_start]; } get length() { - let length = this[_iterable].length; + let length = this[_iterable][dartx.length]; if (dart.notNull(this[_start]) >= dart.notNull(length)) return 0; if (this[_endOrLength] == null || dart.notNull(this[_endOrLength]) >= dart.notNull(length)) { @@ -358,7 +358,7 @@ dart.library('dart/_internal', null, /* Imports */[ toList(opts) { let growable = opts && 'growable' in opts ? opts.growable : true; let start = this[_start]; - let end = this[_iterable].length; + let end = this[_iterable][dartx.length]; if (this[_endOrLength] != null && dart.notNull(this[_endOrLength]) < dart.notNull(end)) end = this[_endOrLength]; let length = dart.notNull(end) - dart.notNull(start); @@ -366,12 +366,12 @@ dart.library('dart/_internal', null, /* Imports */[ length = 0; let result = dart.notNull(growable) ? (() => { let _ = core.List$(E).new(); - _.length = length; + _[dartx.length] = length; return _; })() : core.List$(E).new(length); for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) { result[dartx.set](i, this[_iterable][dartx.elementAt](dart.notNull(start) + dart.notNull(i))); - if (dart.notNull(this[_iterable].length) < dart.notNull(end)) + if (dart.notNull(this[_iterable][dartx.length]) < dart.notNull(end)) throw new core.ConcurrentModificationError(this); } return dart.as(result, core.List$(E)); @@ -403,7 +403,7 @@ dart.library('dart/_internal', null, /* Imports */[ class ListIterator extends core.Object { ListIterator(iterable) { this[_iterable] = iterable; - this[_length] = iterable.length; + this[_length] = iterable[dartx.length]; this[_index] = 0; this[_current] = null; } @@ -411,7 +411,7 @@ dart.library('dart/_internal', null, /* Imports */[ return this[_current]; } moveNext() { - let length = this[_iterable].length; + let length = this[_iterable][dartx.length]; if (this[_length] != length) { throw new core.ConcurrentModificationError(this[_iterable]); } @@ -455,7 +455,7 @@ dart.library('dart/_internal', null, /* Imports */[ return new (MappedIterator$(S, T))(this[_iterable][dartx.iterator], this[_f]); } get length() { - return this[_iterable].length; + return this[_iterable][dartx.length]; } get isEmpty() { return this[_iterable][dartx.isEmpty]; @@ -542,7 +542,7 @@ dart.library('dart/_internal', null, /* Imports */[ super.ListIterable(); } get length() { - return this[_source].length; + return this[_source][dartx.length]; } elementAt(index) { return this[_f](this[_source][dartx.elementAt](index)); @@ -707,7 +707,7 @@ dart.library('dart/_internal', null, /* Imports */[ super._(iterable, takeCount); } get length() { - let iterableLength = this[_iterable].length; + let iterableLength = this[_iterable][dartx.length]; if (dart.notNull(iterableLength) > dart.notNull(this[_takeCount])) return this[_takeCount]; return iterableLength; @@ -845,7 +845,7 @@ dart.library('dart/_internal', null, /* Imports */[ super._(iterable, skipCount); } get length() { - let length = dart.notNull(this[_iterable].length) - dart.notNull(this[_skipCount]); + let length = dart.notNull(this[_iterable][dartx.length]) - dart.notNull(this[_skipCount]); if (dart.notNull(length) >= 0) return length; return 0; @@ -1169,20 +1169,20 @@ dart.library('dart/_internal', null, /* Imports */[ static removeWhereList(list, test) { dart.as(test, dart.functionType(core.bool, [dart.bottom])); let retained = []; - let length = list.length; + let length = list[dartx.length]; for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) { let element = list[dartx.get](i); if (!dart.notNull(dart.dcall(test, element))) { retained[dartx.add](element); } - if (length != list.length) { + if (length != list[dartx.length]) { throw new core.ConcurrentModificationError(list); } } - if (retained.length == length) + if (retained[dartx.length] == length) return; - list.length = retained.length; - for (let i = 0; dart.notNull(i) < dart.notNull(retained.length); i = dart.notNull(i) + 1) { + list[dartx.length] = retained[dartx.length]; + for (let i = 0; dart.notNull(i) < dart.notNull(retained[dartx.length]); i = dart.notNull(i) + 1) { list[dartx.set](i, retained[dartx.get](i)); } } @@ -1247,7 +1247,7 @@ dart.library('dart/_internal', null, /* Imports */[ static lastWhereList(list, test, orElse) { dart.as(test, dart.functionType(core.bool, [dart.bottom])); dart.as(orElse, dart.functionType(core.Object, [])); - for (let i = dart.notNull(list.length) - 1; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) { + for (let i = dart.notNull(list[dartx.length]) - 1; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) { let element = list[dartx.get](i); if (dart.notNull(dart.dcall(test, element))) return element; @@ -1297,16 +1297,16 @@ dart.library('dart/_internal', null, /* Imports */[ separator = null; if (dart.notNull(list[dartx.isEmpty])) return ""; - if (list.length == 1) + if (list[dartx.length] == 1) return `${list[dartx.get](0)}`; let buffer = new core.StringBuffer(); if (dart.notNull(separator[dartx.isEmpty])) { - for (let i = 0; dart.notNull(i) < dart.notNull(list.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(list[dartx.length]); i = dart.notNull(i) + 1) { buffer.write(list[dartx.get](i)); } } else { buffer.write(list[dartx.get](0)); - for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.notNull(i) + 1) { + for (let i = 1; dart.notNull(i) < dart.notNull(list[dartx.length]); i = dart.notNull(i) + 1) { buffer.write(separator); buffer.write(list[dartx.get](i)); } @@ -1355,7 +1355,7 @@ dart.library('dart/_internal', null, /* Imports */[ static shuffleList(list, random) { if (random == null) random = math.Random.new(); - let length = list.length; + let length = list[dartx.length]; while (dart.notNull(length) > 1) { let pos = random.nextInt(length); length = dart.notNull(length) - 1; @@ -1365,15 +1365,15 @@ dart.library('dart/_internal', null, /* Imports */[ } } static indexOfList(list, element, start) { - return Lists.indexOf(list, element, start, list.length); + return Lists.indexOf(list, element, start, list[dartx.length]); } static lastIndexOfList(list, element, start) { if (start == null) - start = dart.notNull(list.length) - 1; + start = dart.notNull(list[dartx.length]) - 1; return Lists.lastIndexOf(list, element, start); } static _rangeCheck(list, start, end) { - core.RangeError.checkValidRange(start, end, list.length); + core.RangeError.checkValidRange(start, end, list[dartx.length]); } getRangeList(list, start, end) { IterableMixinWorkaround$()._rangeCheck(list, start, end); @@ -1395,7 +1395,7 @@ dart.library('dart/_internal', null, /* Imports */[ otherList = from[dartx.skip](skipCount)[dartx.toList]({growable: false}); otherStart = 0; } - if (dart.notNull(otherStart) + dart.notNull(length) > dart.notNull(otherList.length)) { + if (dart.notNull(otherStart) + dart.notNull(length) > dart.notNull(otherList[dartx.length])) { throw IterableElementError.tooFew(); } Lists.copy(otherList, otherStart, list, start, length); @@ -1406,21 +1406,21 @@ dart.library('dart/_internal', null, /* Imports */[ iterable = iterable[dartx.toList](); } let removeLength = dart.notNull(end) - dart.notNull(start); - let insertLength = iterable.length; + let insertLength = iterable[dartx.length]; if (dart.notNull(removeLength) >= dart.notNull(insertLength)) { let delta = dart.notNull(removeLength) - dart.notNull(insertLength); let insertEnd = dart.notNull(start) + dart.notNull(insertLength); - let newEnd = dart.notNull(list.length) - dart.notNull(delta); + let newEnd = dart.notNull(list[dartx.length]) - dart.notNull(delta); list[dartx.setRange](start, insertEnd, iterable); if (delta != 0) { list[dartx.setRange](insertEnd, newEnd, list, end); - list.length = newEnd; + list[dartx.length] = newEnd; } } else { let delta = dart.notNull(insertLength) - dart.notNull(removeLength); - let newLength = dart.notNull(list.length) + dart.notNull(delta); + let newLength = dart.notNull(list[dartx.length]) + dart.notNull(delta); let insertEnd = dart.notNull(start) + dart.notNull(insertLength); - list.length = newLength; + list[dartx.length] = newLength; list[dartx.setRange](insertEnd, newLength, list, end); list[dartx.setRange](start, insertEnd, iterable); } @@ -1432,13 +1432,13 @@ dart.library('dart/_internal', null, /* Imports */[ } } static insertAllList(list, index, iterable) { - core.RangeError.checkValueInInterval(index, 0, list.length, "index"); + core.RangeError.checkValueInInterval(index, 0, list[dartx.length], "index"); if (!dart.is(iterable, EfficientLength)) { iterable = iterable[dartx.toList]({growable: false}); } - let insertionLength = iterable.length; - list.length = dart.notNull(list.length) + dart.notNull(insertionLength); - list[dartx.setRange](dart.notNull(index) + dart.notNull(insertionLength), list.length, list, index); + let insertionLength = iterable[dartx.length]; + list[dartx.length] = dart.notNull(list[dartx.length]) + dart.notNull(insertionLength); + list[dartx.setRange](dart.notNull(index) + dart.notNull(insertionLength), list[dartx.length], list, index); for (let element of iterable) { list[dartx.set]((() => { let x = index; @@ -1448,7 +1448,7 @@ dart.library('dart/_internal', null, /* Imports */[ } } static setAllList(list, index, iterable) { - core.RangeError.checkValueInInterval(index, 0, list.length, "index"); + core.RangeError.checkValueInInterval(index, 0, list[dartx.length], "index"); for (let element of iterable) { list[dartx.set]((() => { let x = index; @@ -1802,7 +1802,7 @@ dart.library('dart/_internal', null, /* Imports */[ super.ListIterable(); } get length() { - return this[_backedList].length; + return this[_backedList][dartx.length]; } elementAt(index) { core.RangeError.checkValidIndex(index, this); @@ -1824,7 +1824,7 @@ dart.library('dart/_internal', null, /* Imports */[ return dart.notNull(this.containsKey(key)) ? this[_values][dartx.get](dart.as(key, core.int)) : null; } get length() { - return this[_values].length; + return this[_values][dartx.length]; } get values() { return new (SubListIterable$(E))(this[_values], 0, null); @@ -1846,10 +1846,10 @@ dart.library('dart/_internal', null, /* Imports */[ } forEach(f) { dart.as(f, dart.functionType(dart.void, [core.int, E])); - let length = this[_values].length; + let length = this[_values][dartx.length]; for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) { f(i, this[_values][dartx.get](i)); - if (length != this[_values].length) { + if (length != this[_values][dartx.length]) { throw new core.ConcurrentModificationError(this[_values]); } } @@ -1901,10 +1901,10 @@ dart.library('dart/_internal', null, /* Imports */[ super.ListIterable(); } get length() { - return this[_source].length; + return this[_source][dartx.length]; } elementAt(index) { - return this[_source][dartx.elementAt](dart.notNull(this[_source].length) - 1 - dart.notNull(index)); + return this[_source][dartx.elementAt](dart.notNull(this[_source][dartx.length]) - 1 - dart.notNull(index)); } } dart.setSignature(ReversedListIterable, { @@ -1979,7 +1979,7 @@ dart.library('dart/_internal', null, /* Imports */[ return true; if (!dart.is(b, core.List)) return false; - let length = a.length; + let length = a[dartx.length]; if (!dart.equals(length, dart.dload(b, 'length'))) return false; for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) { @@ -1989,7 +1989,7 @@ dart.library('dart/_internal', null, /* Imports */[ return true; } static indexOf(a, element, startIndex, endIndex) { - if (dart.notNull(startIndex) >= dart.notNull(a.length)) { + if (dart.notNull(startIndex) >= dart.notNull(a[dartx.length])) { return -1; } if (dart.notNull(startIndex) < 0) { @@ -2006,8 +2006,8 @@ dart.library('dart/_internal', null, /* Imports */[ if (dart.notNull(startIndex) < 0) { return -1; } - if (dart.notNull(startIndex) >= dart.notNull(a.length)) { - startIndex = dart.notNull(a.length) - 1; + if (dart.notNull(startIndex) >= dart.notNull(a[dartx.length])) { + startIndex = dart.notNull(a[dartx.length]) - 1; } for (let i = startIndex; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) { if (dart.equals(a[dartx.get](i), element)) { @@ -2017,14 +2017,14 @@ dart.library('dart/_internal', null, /* Imports */[ return -1; } static indicesCheck(a, start, end) { - core.RangeError.checkValidRange(start, end, a.length); + core.RangeError.checkValidRange(start, end, a[dartx.length]); } static rangeCheck(a, start, length) { core.RangeError.checkNotNegative(length); core.RangeError.checkNotNegative(start); - if (dart.notNull(start) + dart.notNull(length) > dart.notNull(a.length)) { - let message = `${start} + ${length} must be in the range [0..${a.length}]`; - throw new core.RangeError.range(length, 0, dart.notNull(a.length) - dart.notNull(start), "length", message); + if (dart.notNull(start) + dart.notNull(length) > dart.notNull(a[dartx.length])) { + let message = `${start} + ${length} must be in the range [0..${a[dartx.length]}]`; + throw new core.RangeError.range(length, 0, dart.notNull(a[dartx.length]) - dart.notNull(start), "length", message); } } } @@ -2046,10 +2046,10 @@ dart.library('dart/_internal', null, /* Imports */[ dart.fn(printToConsole, dart.void, [core.String]); class Sort extends core.Object { static sort(a, compare) { - Sort._doSort(a, 0, dart.notNull(a.length) - 1, compare); + Sort._doSort(a, 0, dart.notNull(a[dartx.length]) - 1, compare); } static sortRange(a, from, to, compare) { - if (dart.notNull(from) < 0 || dart.notNull(to) > dart.notNull(a.length) || dart.notNull(to) < dart.notNull(from)) { + if (dart.notNull(from) < 0 || dart.notNull(to) > dart.notNull(a[dartx.length]) || dart.notNull(to) < dart.notNull(from)) { throw "OutOfRange"; } Sort._doSort(a, from, dart.notNull(to) - 1, compare); diff --git a/pkg/dev_compiler/lib/runtime/dart/_isolate_helper.js b/pkg/dev_compiler/lib/runtime/dart/_isolate_helper.js index 6ebc5e3bd62b..0bf4d57a206b 100644 --- a/pkg/dev_compiler/lib/runtime/dart/_isolate_helper.js +++ b/pkg/dev_compiler/lib/runtime/dart/_isolate_helper.js @@ -106,14 +106,14 @@ dart.library('dart/_isolate_helper', null, /* Imports */[ } serializeArray(x) { let serialized = []; - serialized.length = x.length; - for (let i = 0; dart.notNull(i) < dart.notNull(x.length); i = dart.notNull(i) + 1) { + serialized[dartx.length] = x[dartx.length]; + for (let i = 0; dart.notNull(i) < dart.notNull(x[dartx.length]); i = dart.notNull(i) + 1) { serialized[dartx.set](i, this.serialize(x[dartx.get](i))); } return serialized; } serializeArrayInPlace(x) { - for (let i = 0; dart.notNull(i) < dart.notNull(x.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(x[dartx.length]); i = dart.notNull(i) + 1) { x[dartx.set](i, this.serialize(x[dartx.get](i))); } return x; @@ -128,8 +128,8 @@ dart.library('dart/_isolate_helper', null, /* Imports */[ } let keys = dart.as(Object.keys(x), core.List); let values = []; - values.length = keys.length; - for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notNull(i) + 1) { + values[dartx.length] = keys[dartx.length]; + for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = dart.notNull(i) + 1) { values[dartx.set](i, this.serialize(x[keys[dartx.get](i)])); } return ['js-object', keys, values]; @@ -282,7 +282,7 @@ dart.library('dart/_isolate_helper', null, /* Imports */[ return result; } deserializeArrayInPlace(x) { - for (let i = 0; dart.notNull(i) < dart.notNull(x.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(x[dartx.length]); i = dart.notNull(i) + 1) { x[dartx.set](i, this.deserialize(x[dartx.get](i))); } return x; @@ -318,7 +318,7 @@ dart.library('dart/_isolate_helper', null, /* Imports */[ let result = dart.map(); this.deserializedObjects[dartx.add](result); keys = keys[dartx.map](dart.bind(this, 'deserialize'))[dartx.toList](); - for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = dart.notNull(i) + 1) { result.set(keys[dartx.get](i), this.deserialize(values[dartx.get](i))); } return result; @@ -355,7 +355,7 @@ dart.library('dart/_isolate_helper', null, /* Imports */[ let values = dart.as(dart.dindex(x, 2), core.List); let o = {}; this.deserializedObjects[dartx.add](o); - for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = dart.notNull(i) + 1) { o[keys[dartx.get](i)] = this.deserialize(values[dartx.get](i)); } return o; diff --git a/pkg/dev_compiler/lib/runtime/dart/_js_helper.js b/pkg/dev_compiler/lib/runtime/dart/_js_helper.js index 270c436b86c3..fd700b9de579 100644 --- a/pkg/dev_compiler/lib/runtime/dart/_js_helper.js +++ b/pkg/dev_compiler/lib/runtime/dart/_js_helper.js @@ -148,8 +148,8 @@ dart.library('dart/_js_helper', null, /* Imports */[ start = 0; checkString(string); checkInt(start); - if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.length)) { - throw new core.RangeError.range(start, 0, string.length); + if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[dartx.length])) { + throw new core.RangeError.range(start, 0, string[dartx.length]); } return new _AllMatchesIterable(this, string, start); } @@ -167,16 +167,16 @@ dart.library('dart/_js_helper', null, /* Imports */[ let match = dart.as(regexp.exec(string), core.List); if (match == null) return null; - if (match[dartx.get](dart.notNull(match.length) - 1) != null) + if (match[dartx.get](dart.notNull(match[dartx.length]) - 1) != null) return null; - match.length = dart.notNull(match.length) - 1; + match[dartx.length] = dart.notNull(match[dartx.length]) - 1; return new _MatchImplementation(this, dart.as(match, core.List$(core.String))); } matchAsPrefix(string, start) { if (start === void 0) start = 0; - if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.length)) { - throw new core.RangeError.range(start, 0, string.length); + if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[dartx.length])) { + throw new core.RangeError.range(start, 0, string[dartx.length]); } return this[_execAnchored](string, start); } @@ -218,7 +218,7 @@ dart.library('dart/_js_helper', null, /* Imports */[ return this[_match].index; } get end() { - return dart.notNull(this.start) + dart.notNull(this[_match][dartx.get](0).length); + return dart.notNull(this.start) + dart.notNull(this[_match][dartx.get](0)[dartx.length]); } group(index) { return this[_match][dartx.get](index); @@ -227,7 +227,7 @@ dart.library('dart/_js_helper', null, /* Imports */[ return this.group(index); } get groupCount() { - return dart.notNull(this[_match].length) - 1; + return dart.notNull(this[_match][dartx.length]) - 1; } groups(groups) { let out = dart.list([], core.String); @@ -280,7 +280,7 @@ dart.library('dart/_js_helper', null, /* Imports */[ moveNext() { if (this[_string] == null) return false; - if (dart.notNull(this[_nextIndex]) <= dart.notNull(this[_string].length)) { + if (dart.notNull(this[_nextIndex]) <= dart.notNull(this[_string][dartx.length])) { let match = this[_regExp][_execGlobal](this[_string], this[_nextIndex]); if (match != null) { this[_current] = match; @@ -313,7 +313,7 @@ dart.library('dart/_js_helper', null, /* Imports */[ this.pattern = pattern; } get end() { - return dart.notNull(this.start) + dart.notNull(this.pattern.length); + return dart.notNull(this.start) + dart.notNull(this.pattern[dartx.length]); } get(g) { return this.group(g); @@ -346,8 +346,8 @@ dart.library('dart/_js_helper', null, /* Imports */[ }); function allMatchesInStringUnchecked(needle, haystack, startIndex) { let result = core.List$(core.Match).new(); - let length = haystack.length; - let patternLength = needle.length; + let length = haystack[dartx.length]; + let patternLength = needle[dartx.length]; while (true) { let position = haystack[dartx.indexOf](needle, startIndex); if (position == -1) { @@ -599,7 +599,7 @@ dart.library('dart/_js_helper', null, /* Imports */[ maxCharCode = 97 + dart.notNull(radix) - 10 - 1; } let digitsPart = dart.as(dart.dindex(match, digitsIndex), core.String); - for (let i = 0; dart.notNull(i) < dart.notNull(digitsPart.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(digitsPart[dartx.length]); i = dart.notNull(i) + 1) { let characterCode = dart.notNull(digitsPart[dartx.codeUnitAt](0)) | 32; if (dart.notNull(digitsPart[dartx.codeUnitAt](i)) > dart.notNull(maxCharCode)) { return handleError(source); @@ -672,7 +672,7 @@ dart.library('dart/_js_helper', null, /* Imports */[ static _fromCharCodeApply(array) { let result = ""; let kMaxApply = 500; - let end = array.length; + let end = array[dartx.length]; for (let i = 0; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + dart.notNull(kMaxApply)) { let subarray = null; if (dart.notNull(end) <= dart.notNull(kMaxApply)) { diff --git a/pkg/dev_compiler/lib/runtime/dart/_native_typed_data.js b/pkg/dev_compiler/lib/runtime/dart/_native_typed_data.js index 4732d81b622d..d3c9ce03cc3a 100644 --- a/pkg/dev_compiler/lib/runtime/dart/_native_typed_data.js +++ b/pkg/dev_compiler/lib/runtime/dart/_native_typed_data.js @@ -158,8 +158,8 @@ dart.library('dart/_native_typed_data', null, /* Imports */[ this[_storage] = storage; } _slowFromList(list) { - this[_storage] = NativeFloat32List.new(dart.notNull(list.length) * 4); - for (let i = 0; dart.notNull(i) < dart.notNull(list.length); i = dart.notNull(i) + 1) { + this[_storage] = NativeFloat32List.new(dart.notNull(list[dartx.length]) * 4); + for (let i = 0; dart.notNull(i) < dart.notNull(list[dartx.length]); i = dart.notNull(i) + 1) { let e = list[dartx.get](i); this[_storage].set(dart.notNull(i) * 4 + 0, e.x); this[_storage].set(dart.notNull(i) * 4 + 1, e.y); @@ -266,8 +266,8 @@ dart.library('dart/_native_typed_data', null, /* Imports */[ this[_storage] = storage; } _slowFromList(list) { - this[_storage] = NativeInt32List.new(dart.notNull(list.length) * 4); - for (let i = 0; dart.notNull(i) < dart.notNull(list.length); i = dart.notNull(i) + 1) { + this[_storage] = NativeInt32List.new(dart.notNull(list[dartx.length]) * 4); + for (let i = 0; dart.notNull(i) < dart.notNull(list[dartx.length]); i = dart.notNull(i) + 1) { let e = list[dartx.get](i); this[_storage].set(dart.notNull(i) * 4 + 0, e.x); this[_storage].set(dart.notNull(i) * 4 + 1, e.y); @@ -374,8 +374,8 @@ dart.library('dart/_native_typed_data', null, /* Imports */[ this[_storage] = storage; } _slowFromList(list) { - this[_storage] = NativeFloat64List.new(dart.notNull(list.length) * 2); - for (let i = 0; dart.notNull(i) < dart.notNull(list.length); i = dart.notNull(i) + 1) { + this[_storage] = NativeFloat64List.new(dart.notNull(list[dartx.length]) * 2); + for (let i = 0; dart.notNull(i) < dart.notNull(list[dartx.length]); i = dart.notNull(i) + 1) { let e = list[dartx.get](i); this[_storage].set(dart.notNull(i) * 2 + 0, e.x); this[_storage].set(dart.notNull(i) * 2 + 1, e.y); @@ -533,8 +533,8 @@ dart.library('dart/_native_typed_data', null, /* Imports */[ function _ensureNativeList(list) { if (dart.is(list, _interceptors.JSIndexable)) return list; - let result = core.List.new(list.length); - for (let i = 0; dart.notNull(i) < dart.notNull(list.length); i = dart.notNull(i) + 1) { + let result = core.List.new(list[dartx.length]); + for (let i = 0; dart.notNull(i) < dart.notNull(list[dartx.length]); i = dart.notNull(i) + 1) { result[dartx.set](i, list[dartx.get](i)); } return result; diff --git a/pkg/dev_compiler/lib/runtime/dart/collection.js b/pkg/dev_compiler/lib/runtime/dart/collection.js index 6c82e34c9247..18b09824737d 100644 --- a/pkg/dev_compiler/lib/runtime/dart/collection.js +++ b/pkg/dev_compiler/lib/runtime/dart/collection.js @@ -13,7 +13,7 @@ dart.library('dart/collection', null, /* Imports */[ this[_source] = source; } get length() { - return this[_source].length; + return this[_source][dartx.length]; } get(index) { return this[_source][dartx.elementAt](index); @@ -192,7 +192,7 @@ dart.library('dart/collection', null, /* Imports */[ let growable = opts && 'growable' in opts ? opts.growable : true; let result = dart.notNull(growable) ? (() => { let _ = core.List$(E).new(); - _.length = this.length; + _[dartx.length] = this.length; return _; })() : core.List$(E).new(this.length); let i = 0; @@ -1066,7 +1066,7 @@ dart.library('dart/collection', null, /* Imports */[ return dart.toString(buffer); } static _isToStringVisiting(o) { - for (let i = 0; dart.notNull(i) < dart.notNull(IterableBase$()._toStringVisiting.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(IterableBase$()._toStringVisiting[dartx.length]); i = dart.notNull(i) + 1) { if (dart.notNull(core.identical(o, IterableBase$()._toStringVisiting[dartx.get](i)))) return true; } @@ -1087,7 +1087,7 @@ dart.library('dart/collection', null, /* Imports */[ return; let next = `${it.current}`; parts[dartx.add](next); - length = dart.notNull(length) + (dart.notNull(next.length) + dart.notNull(OVERHEAD)); + length = dart.notNull(length) + (dart.notNull(next[dartx.length]) + dart.notNull(OVERHEAD)); count = dart.notNull(count) + 1; } let penultimateString = null; @@ -1109,7 +1109,7 @@ dart.library('dart/collection', null, /* Imports */[ } ultimateString = `${penultimate}`; penultimateString = dart.as(parts[dartx.removeLast](), core.String); - length = dart.notNull(length) + (dart.notNull(ultimateString.length) + dart.notNull(OVERHEAD)); + length = dart.notNull(length) + (dart.notNull(ultimateString[dartx.length]) + dart.notNull(OVERHEAD)); } else { ultimate = it.current; count = dart.notNull(count) + 1; @@ -1129,15 +1129,15 @@ dart.library('dart/collection', null, /* Imports */[ } penultimateString = `${penultimate}`; ultimateString = `${ultimate}`; - length = dart.notNull(length) + (dart.notNull(ultimateString.length) + dart.notNull(penultimateString.length) + 2 * dart.notNull(OVERHEAD)); + length = dart.notNull(length) + (dart.notNull(ultimateString[dartx.length]) + dart.notNull(penultimateString[dartx.length]) + 2 * dart.notNull(OVERHEAD)); } } let elision = null; - if (dart.notNull(count) > dart.notNull(parts.length) + dart.notNull(TAIL_COUNT)) { + if (dart.notNull(count) > dart.notNull(parts[dartx.length]) + dart.notNull(TAIL_COUNT)) { elision = "..."; length = dart.notNull(length) + (dart.notNull(ELLIPSIS_SIZE) + dart.notNull(OVERHEAD)); } - while (dart.notNull(length) > dart.notNull(LENGTH_LIMIT) && dart.notNull(parts.length) > dart.notNull(HEAD_COUNT)) { + while (dart.notNull(length) > dart.notNull(LENGTH_LIMIT) && dart.notNull(parts[dartx.length]) > dart.notNull(HEAD_COUNT)) { length = dart.notNull(length) - dart.notNull(dart.as(dart.dsend(dart.dload(parts[dartx.removeLast](), 'length'), '+', OVERHEAD), core.int)); if (elision == null) { elision = "..."; @@ -1639,25 +1639,25 @@ dart.library('dart/collection', null, /* Imports */[ } } get isEmpty() { - return this.length == 0; + return this[dartx.length] == 0; } get isNotEmpty() { return !dart.notNull(this.isEmpty); } get first() { - if (this.length == 0) + if (this[dartx.length] == 0) throw _internal.IterableElementError.noElement(); return this.get(0); } get last() { - if (this.length == 0) + if (this[dartx.length] == 0) throw _internal.IterableElementError.noElement(); - return this.get(dart.notNull(this.length) - 1); + return this.get(dart.notNull(this[dartx.length]) - 1); } get single() { - if (this.length == 0) + if (this[dartx.length] == 0) throw _internal.IterableElementError.noElement(); - if (dart.notNull(this.length) > 1) + if (dart.notNull(this[dartx.length]) > 1) throw _internal.IterableElementError.tooMany(); return this.get(0); } @@ -1755,7 +1755,7 @@ dart.library('dart/collection', null, /* Imports */[ join(separator) { if (separator === void 0) separator = ""; - if (this.length == 0) + if (this[dartx.length] == 0) return ""; let buffer = new core.StringBuffer(); buffer.writeAll(this, separator); @@ -1818,18 +1818,18 @@ dart.library('dart/collection', null, /* Imports */[ let result = null; if (dart.notNull(growable)) { result = core.List$(E).new(); - result.length = this.length; + result[dartx.length] = this[dartx.length]; } else { - result = core.List$(E).new(this.length); + result = core.List$(E).new(this[dartx.length]); } - for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) { result[dartx.set](i, this.get(i)); } return result; } toSet() { let result = core.Set$(E).new(); - for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) { result.add(this.get(i)); } return result; @@ -1873,30 +1873,30 @@ dart.library('dart/collection', null, /* Imports */[ static _filter(source, test, retainMatching) { dart.as(test, dart.functionType(core.bool, [dart.bottom])); let retained = []; - let length = source.length; + let length = source[dartx.length]; for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) { let element = source[dartx.get](i); if (dart.dcall(test, element) == retainMatching) { retained[dartx.add](element); } - if (length != source.length) { + if (length != source[dartx.length]) { throw new core.ConcurrentModificationError(source); } } - if (retained.length != source.length) { - source[dartx.setRange](0, retained.length, retained); - source.length = retained.length; + if (retained[dartx.length] != source[dartx.length]) { + source[dartx.setRange](0, retained[dartx.length], retained); + source[dartx.length] = retained[dartx.length]; } } clear() { this.length = 0; } removeLast() { - if (this.length == 0) { + if (this[dartx.length] == 0) { throw _internal.IterableElementError.noElement(); } - let result = this.get(dart.notNull(this.length) - 1); - this.length = dart.notNull(this.length) - 1; + let result = this.get(dart.notNull(this[dartx.length]) - 1); + this[dartx.length] = dart.notNull(this[dartx.length]) - 1; return result; } sort(compare) { @@ -1931,7 +1931,7 @@ dart.library('dart/collection', null, /* Imports */[ core.RangeError.checkValidRange(start, end, listLength); let length = dart.notNull(end) - dart.notNull(start); let result = core.List$(E).new(); - result.length = length; + result[dartx.length] = length; for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) { result[dartx.set](i, this.get(dart.notNull(start) + dart.notNull(i))); } @@ -1974,7 +1974,7 @@ dart.library('dart/collection', null, /* Imports */[ otherList = iterable[dartx.skip](skipCount)[dartx.toList]({growable: false}); otherStart = 0; } - if (dart.notNull(otherStart) + dart.notNull(length) > dart.notNull(otherList.length)) { + if (dart.notNull(otherStart) + dart.notNull(length) > dart.notNull(otherList[dartx.length])) { throw _internal.IterableElementError.tooFew(); } if (dart.notNull(otherStart) < dart.notNull(start)) { @@ -1994,7 +1994,7 @@ dart.library('dart/collection', null, /* Imports */[ newContents = newContents[dartx.toList](); } let removeLength = dart.notNull(end) - dart.notNull(start); - let insertLength = newContents.length; + let insertLength = newContents[dartx.length]; if (dart.notNull(removeLength) >= dart.notNull(insertLength)) { let delta = dart.notNull(removeLength) - dart.notNull(insertLength); let insertEnd = dart.notNull(start) + dart.notNull(insertLength); @@ -2051,7 +2051,7 @@ dart.library('dart/collection', null, /* Imports */[ } insert(index, element) { dart.as(element, E); - core.RangeError.checkValueInInterval(index, 0, this.length, "index"); + core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "index"); if (index == this.length) { this.add(element); return; @@ -2065,16 +2065,16 @@ dart.library('dart/collection', null, /* Imports */[ removeAt(index) { let result = this.get(index); this.setRange(index, dart.notNull(this.length) - 1, this, dart.notNull(index) + 1); - this.length = dart.notNull(this.length) - 1; + this[dartx.length] = dart.notNull(this[dartx.length]) - 1; return result; } insertAll(index, iterable) { dart.as(iterable, core.Iterable$(E)); - core.RangeError.checkValueInInterval(index, 0, this.length, "index"); + core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "index"); if (dart.is(iterable, _internal.EfficientLength)) { iterable = iterable[dartx.toList](); } - let insertionLength = iterable.length; + let insertionLength = iterable[dartx.length]; this.length = dart.notNull(this.length) + dart.notNull(insertionLength); this.setRange(dart.notNull(index) + dart.notNull(insertionLength), this.length, this, index); this.setAll(index, iterable); @@ -2082,7 +2082,7 @@ dart.library('dart/collection', null, /* Imports */[ setAll(index, iterable) { dart.as(iterable, core.Iterable$(E)); if (dart.is(iterable, core.List)) { - this.setRange(index, dart.notNull(index) + dart.notNull(iterable.length), iterable); + this.setRange(index, dart.notNull(index) + dart.notNull(iterable[dartx.length]), iterable); } else { for (let element of iterable) { this.set((() => { @@ -2249,7 +2249,7 @@ dart.library('dart/collection', null, /* Imports */[ return this.keys[dartx.contains](key); } get length() { - return this.keys.length; + return this.keys[dartx.length]; } get isEmpty() { return this.keys[dartx.isEmpty]; @@ -2515,7 +2515,7 @@ dart.library('dart/collection', null, /* Imports */[ return map.keys[dartx.map](dart.fn(key => map.get(key))); } static length(map) { - return map.keys.length; + return map.keys[dartx.length]; } static isEmpty(map) { return map.keys[dartx.isEmpty]; @@ -2931,9 +2931,9 @@ dart.library('dart/collection', null, /* Imports */[ } static from(elements) { if (dart.is(elements, core.List)) { - let length = elements.length; + let length = elements[dartx.length]; let queue = new (ListQueue$(E))(dart.notNull(length) + 1); - dart.assert(dart.notNull(queue[_table].length) > dart.notNull(length)); + dart.assert(dart.notNull(queue[_table][dartx.length]) > dart.notNull(length)); let sourceList = elements; queue[_table][dartx.setRange](0, length, dart.as(sourceList, core.Iterable$(E)), 0); queue[_tail] = length; @@ -2941,7 +2941,7 @@ dart.library('dart/collection', null, /* Imports */[ } else { let capacity = ListQueue$()._INITIAL_CAPACITY; if (dart.is(elements, _internal.EfficientLength)) { - capacity = elements.length; + capacity = elements[dartx.length]; } let result = new (ListQueue$(E))(capacity); for (let element of dart.as(elements, core.Iterable$(E))) { @@ -2956,7 +2956,7 @@ dart.library('dart/collection', null, /* Imports */[ forEach(action) { dart.as(action, dart.functionType(dart.void, [E])); let modificationCount = this[_modificationCount]; - for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & dart.notNull(this[_table].length) - 1) { + for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & dart.notNull(this[_table][dartx.length]) - 1) { action(this[_table][dartx.get](i)); this[_checkModification](modificationCount); } @@ -2965,7 +2965,7 @@ dart.library('dart/collection', null, /* Imports */[ return this[_head] == this[_tail]; } get length() { - return dart.notNull(this[_tail]) - dart.notNull(this[_head]) & dart.notNull(this[_table].length) - 1; + return dart.notNull(this[_tail]) - dart.notNull(this[_head]) & dart.notNull(this[_table][dartx.length]) - 1; } get first() { if (this[_head] == this[_tail]) @@ -2975,7 +2975,7 @@ dart.library('dart/collection', null, /* Imports */[ get last() { if (this[_head] == this[_tail]) throw _internal.IterableElementError.noElement(); - return this[_table][dartx.get](dart.notNull(this[_tail]) - 1 & dart.notNull(this[_table].length) - 1); + return this[_table][dartx.get](dart.notNull(this[_tail]) - 1 & dart.notNull(this[_table][dartx.length]) - 1); } get single() { if (this[_head] == this[_tail]) @@ -2986,14 +2986,14 @@ dart.library('dart/collection', null, /* Imports */[ } elementAt(index) { core.RangeError.checkValidIndex(index, this); - return this[_table][dartx.get](dart.notNull(this[_head]) + dart.notNull(index) & dart.notNull(this[_table].length) - 1); + return this[_table][dartx.get](dart.notNull(this[_head]) + dart.notNull(index) & dart.notNull(this[_table][dartx.length]) - 1); } toList(opts) { let growable = opts && 'growable' in opts ? opts.growable : true; let list = null; if (dart.notNull(growable)) { list = core.List$(E).new(); - list.length = this.length; + list[dartx.length] = this.length; } else { list = core.List$(E).new(this.length); } @@ -3008,14 +3008,14 @@ dart.library('dart/collection', null, /* Imports */[ dart.as(elements, core.Iterable$(E)); if (dart.is(elements, core.List)) { let list = dart.as(elements, core.List); - let addCount = list.length; + let addCount = list[dartx.length]; let length = this.length; - if (dart.notNull(length) + dart.notNull(addCount) >= dart.notNull(this[_table].length)) { + if (dart.notNull(length) + dart.notNull(addCount) >= dart.notNull(this[_table][dartx.length])) { this[_preGrow](dart.notNull(length) + dart.notNull(addCount)); this[_table][dartx.setRange](length, dart.notNull(length) + dart.notNull(addCount), dart.as(list, core.Iterable$(E)), 0); this[_tail] = dart.notNull(this[_tail]) + dart.notNull(addCount); } else { - let endSpace = dart.notNull(this[_table].length) - dart.notNull(this[_tail]); + let endSpace = dart.notNull(this[_table][dartx.length]) - dart.notNull(this[_tail]); if (dart.notNull(addCount) < dart.notNull(endSpace)) { this[_table][dartx.setRange](this[_tail], dart.notNull(this[_tail]) + dart.notNull(addCount), dart.as(list, core.Iterable$(E)), 0); this[_tail] = dart.notNull(this[_tail]) + dart.notNull(addCount); @@ -3033,7 +3033,7 @@ dart.library('dart/collection', null, /* Imports */[ } } remove(object) { - for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & dart.notNull(this[_table].length) - 1) { + for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & dart.notNull(this[_table][dartx.length]) - 1) { let element = this[_table][dartx.get](i); if (dart.equals(element, object)) { this[_remove](i); @@ -3056,7 +3056,7 @@ dart.library('dart/collection', null, /* Imports */[ i = this[_remove](i); modificationCount = this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; } else { - i = dart.notNull(i) + 1 & dart.notNull(this[_table].length) - 1; + i = dart.notNull(i) + 1 & dart.notNull(this[_table][dartx.length]) - 1; } } } @@ -3070,7 +3070,7 @@ dart.library('dart/collection', null, /* Imports */[ } clear() { if (this[_head] != this[_tail]) { - for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & dart.notNull(this[_table].length) - 1) { + for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & dart.notNull(this[_table][dartx.length]) - 1) { this[_table][dartx.set](i, null); } this[_head] = this[_tail] = 0; @@ -3086,7 +3086,7 @@ dart.library('dart/collection', null, /* Imports */[ } addFirst(element) { dart.as(element, E); - this[_head] = dart.notNull(this[_head]) - 1 & dart.notNull(this[_table].length) - 1; + this[_head] = dart.notNull(this[_head]) - 1 & dart.notNull(this[_table][dartx.length]) - 1; this[_table][dartx.set](this[_head], element); if (this[_head] == this[_tail]) this[_grow](); @@ -3098,14 +3098,14 @@ dart.library('dart/collection', null, /* Imports */[ this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; let result = this[_table][dartx.get](this[_head]); this[_table][dartx.set](this[_head], null); - this[_head] = dart.notNull(this[_head]) + 1 & dart.notNull(this[_table].length) - 1; + this[_head] = dart.notNull(this[_head]) + 1 & dart.notNull(this[_table][dartx.length]) - 1; return result; } removeLast() { if (this[_head] == this[_tail]) throw _internal.IterableElementError.noElement(); this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; - this[_tail] = dart.notNull(this[_tail]) - 1 & dart.notNull(this[_table].length) - 1; + this[_tail] = dart.notNull(this[_tail]) - 1 & dart.notNull(this[_table][dartx.length]) - 1; let result = this[_table][dartx.get](this[_tail]); this[_table][dartx.set](this[_tail], null); return result; @@ -3131,13 +3131,13 @@ dart.library('dart/collection', null, /* Imports */[ [_add](element) { dart.as(element, E); this[_table][dartx.set](this[_tail], element); - this[_tail] = dart.notNull(this[_tail]) + 1 & dart.notNull(this[_table].length) - 1; + this[_tail] = dart.notNull(this[_tail]) + 1 & dart.notNull(this[_table][dartx.length]) - 1; if (this[_head] == this[_tail]) this[_grow](); this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; } [_remove](offset) { - let mask = dart.notNull(this[_table].length) - 1; + let mask = dart.notNull(this[_table][dartx.length]) - 1; let startDistance = dart.notNull(offset) - dart.notNull(this[_head]) & dart.notNull(mask); let endDistance = dart.notNull(this[_tail]) - dart.notNull(offset) & dart.notNull(mask); if (dart.notNull(startDistance) < dart.notNull(endDistance)) { @@ -3163,23 +3163,23 @@ dart.library('dart/collection', null, /* Imports */[ } } [_grow]() { - let newTable = core.List$(E).new(dart.notNull(this[_table].length) * 2); - let split = dart.notNull(this[_table].length) - dart.notNull(this[_head]); + let newTable = core.List$(E).new(dart.notNull(this[_table][dartx.length]) * 2); + let split = dart.notNull(this[_table][dartx.length]) - dart.notNull(this[_head]); newTable[dartx.setRange](0, split, this[_table], this[_head]); newTable[dartx.setRange](split, dart.notNull(split) + dart.notNull(this[_head]), this[_table], 0); this[_head] = 0; - this[_tail] = this[_table].length; + this[_tail] = this[_table][dartx.length]; this[_table] = newTable; } [_writeToList](target) { dart.as(target, core.List$(E)); - dart.assert(dart.notNull(target.length) >= dart.notNull(this.length)); + dart.assert(dart.notNull(target[dartx.length]) >= dart.notNull(this.length)); if (dart.notNull(this[_head]) <= dart.notNull(this[_tail])) { let length = dart.notNull(this[_tail]) - dart.notNull(this[_head]); target[dartx.setRange](0, length, this[_table], this[_head]); return length; } else { - let firstPartSize = dart.notNull(this[_table].length) - dart.notNull(this[_head]); + let firstPartSize = dart.notNull(this[_table][dartx.length]) - dart.notNull(this[_head]); target[dartx.setRange](0, firstPartSize, this[_table], this[_head]); target[dartx.setRange](firstPartSize, dart.notNull(firstPartSize) + dart.notNull(this[_tail]), this[_table], 0); return dart.notNull(this[_tail]) + dart.notNull(firstPartSize); @@ -3266,7 +3266,7 @@ dart.library('dart/collection', null, /* Imports */[ return false; } this[_current] = dart.as(this[_queue][_table][dartx.get](this[_position]), E); - this[_position] = dart.notNull(this[_position]) + 1 & dart.notNull(this[_queue][_table].length) - 1; + this[_position] = dart.notNull(this[_position]) + 1 & dart.notNull(this[_queue][_table][dartx.length]) - 1; return true; } } @@ -4280,7 +4280,7 @@ dart.library('dart/collection', null, /* Imports */[ forEach(action) { dart.as(action, dart.functionType(dart.void, [K, V])); let keys = this[_computeKeys](); - for (let i = 0, length = keys.length; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) { + for (let i = 0, length = keys[dartx.length]; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) { let key = keys[i]; action(dart.as(key, K), this.get(key)); if (keys !== this[_keys]) { diff --git a/pkg/dev_compiler/lib/runtime/dart/convert.js b/pkg/dev_compiler/lib/runtime/dart/convert.js index 530c1c2603ed..d18ed7446eef 100644 --- a/pkg/dev_compiler/lib/runtime/dart/convert.js +++ b/pkg/dev_compiler/lib/runtime/dart/convert.js @@ -134,7 +134,7 @@ dart.library('dart/convert', null, /* Imports */[ start = 0; if (end === void 0) end = null; - let stringLength = string.length; + let stringLength = string[dartx.length]; core.RangeError.checkValidRange(start, end, stringLength); if (end == null) end = stringLength; @@ -177,7 +177,7 @@ dart.library('dart/convert', null, /* Imports */[ }); class StringConversionSinkMixin extends core.Object { add(str) { - return this.addSlice(str, 0, str.length, false); + return this.addSlice(str, 0, str[dartx.length], false); } asUtf8Sink(allowMalformed) { return new _Utf8ConversionSink(this, allowMalformed); @@ -205,7 +205,7 @@ dart.library('dart/convert', null, /* Imports */[ this[_sink].close(); } addSlice(source, start, end, isLast) { - core.RangeError.checkValidRange(start, end, source.length); + core.RangeError.checkValidRange(start, end, source[dartx.length]); for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) { let codeUnit = source[dartx.codeUnitAt](i); if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { @@ -237,7 +237,7 @@ dart.library('dart/convert', null, /* Imports */[ start = 0; if (end === void 0) end = null; - let byteCount = bytes.length; + let byteCount = bytes[dartx.length]; core.RangeError.checkValidRange(start, end, byteCount); if (end == null) end = byteCount; @@ -356,10 +356,10 @@ dart.library('dart/convert', null, /* Imports */[ this[_utf8Sink].close(); } add(source) { - this.addSlice(source, 0, source.length, false); + this.addSlice(source, 0, source[dartx.length], false); } addSlice(source, start, end, isLast) { - core.RangeError.checkValidRange(start, end, source.length); + core.RangeError.checkValidRange(start, end, source[dartx.length]); for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) { if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) != 0) { if (dart.notNull(i) > dart.notNull(start)) @@ -390,7 +390,7 @@ dart.library('dart/convert', null, /* Imports */[ this[_sink].close(); } add(source) { - for (let i = 0; dart.notNull(i) < dart.notNull(source.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(source[dartx.length]); i = dart.notNull(i) + 1) { if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) != 0) { throw new core.FormatException("Source contains non-ASCII bytes."); } @@ -398,7 +398,7 @@ dart.library('dart/convert', null, /* Imports */[ this[_sink].add(core.String.fromCharCodes(source)); } addSlice(source, start, end, isLast) { - let length = source.length; + let length = source[dartx.length]; core.RangeError.checkValidRange(start, end, length); if (dart.notNull(start) < dart.notNull(end)) { if (start != 0 || end != length) { @@ -445,16 +445,16 @@ dart.library('dart/convert', null, /* Imports */[ this[_bufferIndex] = 0; } add(chunk) { - let freeCount = dart.notNull(this[_buffer].length) - dart.notNull(this[_bufferIndex]); - if (dart.notNull(chunk.length) > dart.notNull(freeCount)) { - let oldLength = this[_buffer].length; - let newLength = dart.notNull(_ByteCallbackSink._roundToPowerOf2(dart.notNull(chunk.length) + dart.notNull(oldLength))) * 2; + let freeCount = dart.notNull(this[_buffer][dartx.length]) - dart.notNull(this[_bufferIndex]); + if (dart.notNull(chunk[dartx.length]) > dart.notNull(freeCount)) { + let oldLength = this[_buffer][dartx.length]; + let newLength = dart.notNull(_ByteCallbackSink._roundToPowerOf2(dart.notNull(chunk[dartx.length]) + dart.notNull(oldLength))) * 2; let grown = typed_data.Uint8List.new(newLength); - grown[dartx.setRange](0, this[_buffer].length, this[_buffer]); + grown[dartx.setRange](0, this[_buffer][dartx.length], this[_buffer]); this[_buffer] = grown; } - this[_buffer][dartx.setRange](this[_bufferIndex], dart.notNull(this[_bufferIndex]) + dart.notNull(chunk.length), chunk); - this[_bufferIndex] = dart.notNull(this[_bufferIndex]) + dart.notNull(chunk.length); + this[_buffer][dartx.setRange](this[_bufferIndex], dart.notNull(this[_bufferIndex]) + dart.notNull(chunk[dartx.length]), chunk); + this[_bufferIndex] = dart.notNull(this[_bufferIndex]) + dart.notNull(chunk[dartx.length]); } static _roundToPowerOf2(v) { dart.assert(dart.notNull(v) > 0); @@ -673,7 +673,7 @@ dart.library('dart/convert', null, /* Imports */[ super.Converter(); } convert(text) { - let val = this[_convert](text, 0, text.length); + let val = this[_convert](text, 0, text[dartx.length]); return val == null ? text : val; } [_convert](text, start, end) { @@ -931,7 +931,7 @@ dart.library('dart/convert', null, /* Imports */[ if (dart.notNull(string[dartx.isEmpty])) return typed_data.Uint8List.new(0); checkAscii: { - for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(string[dartx.length]); i = dart.notNull(i) + 1) { if (dart.notNull(string[dartx.codeUnitAt](i)) >= 128) break checkAscii; } @@ -950,16 +950,16 @@ dart.library('dart/convert', null, /* Imports */[ }; dart.fn(addChunk, dart.void, [typed_data.Uint8List, core.int, core.int]); _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEncodable$], dart.functionType(core.Object, [core.Object])), this[_bufferSize], addChunk); - if (bytes.length == 1) + if (bytes[dartx.length] == 1) return bytes[dartx.get](0); let length = 0; - for (let i = 0; dart.notNull(i) < dart.notNull(bytes.length); i = dart.notNull(i) + 1) { - length = dart.notNull(length) + dart.notNull(bytes[dartx.get](i).length); + for (let i = 0; dart.notNull(i) < dart.notNull(bytes[dartx.length]); i = dart.notNull(i) + 1) { + length = dart.notNull(length) + dart.notNull(bytes[dartx.get](i)[dartx.length]); } let result = typed_data.Uint8List.new(length); - for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes.length); i = dart.notNull(i) + 1) { + for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes[dartx.length]); i = dart.notNull(i) + 1) { let byteList = bytes[dartx.get](i); - let end = dart.notNull(offset) + dart.notNull(byteList.length); + let end = dart.notNull(offset) + dart.notNull(byteList[dartx.length]); result.setRange(offset, end, byteList); offset = end; } @@ -1115,7 +1115,7 @@ dart.library('dart/convert', null, /* Imports */[ } writeStringContent(s) { let offset = 0; - let length = s.length; + let length = s[dartx.length]; for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) { let charCode = s[dartx.codeUnitAt](i); if (dart.notNull(charCode) > dart.notNull(_JsonStringifier.BACKSLASH)) @@ -1176,7 +1176,7 @@ dart.library('dart/convert', null, /* Imports */[ } } [_checkCycle](object) { - for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen].length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen][dartx.length]); i = dart.notNull(i) + 1) { if (dart.notNull(core.identical(object, this[_seen][dartx.get](i)))) { throw new JsonCyclicError(object); } @@ -1239,9 +1239,9 @@ dart.library('dart/convert', null, /* Imports */[ } writeList(list) { this.writeString('['); - if (dart.notNull(list.length) > 0) { + if (dart.notNull(list[dartx.length]) > 0) { this.writeObject(list[dartx.get](0)); - for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.notNull(i) + 1) { + for (let i = 1; dart.notNull(i) < dart.notNull(list[dartx.length]); i = dart.notNull(i) + 1) { this.writeString(','); this.writeObject(list[dartx.get](i)); } @@ -1302,7 +1302,7 @@ dart.library('dart/convert', null, /* Imports */[ this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; this.writeIndentation(this[_indentLevel]); this.writeObject(list[dartx.get](0)); - for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.notNull(i) + 1) { + for (let i = 1; dart.notNull(i) < dart.notNull(list[dartx.length]); i = dart.notNull(i) + 1) { this.writeString(',\n'); this.writeIndentation(this[_indentLevel]); this.writeObject(list[dartx.get](i)); @@ -1434,14 +1434,14 @@ dart.library('dart/convert', null, /* Imports */[ this.writeAsciiString(dart[dartx.toString](number)); } writeAsciiString(string) { - for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(string[dartx.length]); i = dart.notNull(i) + 1) { let char = string[dartx.codeUnitAt](i); dart.assert(dart.notNull(char) <= 127); this.writeByte(char); } } writeString(string) { - this.writeStringSlice(string, 0, string.length); + this.writeStringSlice(string, 0, string[dartx.length]); } writeStringSlice(string, start, end) { for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) { @@ -1527,7 +1527,7 @@ dart.library('dart/convert', null, /* Imports */[ } writeIndentation(count) { let indent = this.indent; - let indentLength = indent.length; + let indentLength = indent[dartx.length]; if (indentLength == 1) { let char = indent[dartx.get](0); while (dart.notNull(count) > 0) { @@ -1627,7 +1627,7 @@ dart.library('dart/convert', null, /* Imports */[ this[_sink].close(); } add(source) { - this.addSlice(source, 0, source.length, false); + this.addSlice(source, 0, source[dartx.length], false); } [_addSliceToSink](source, start, end, isLast) { this[_sink].add(core.String.fromCharCodes(source, start, end)); @@ -1635,7 +1635,7 @@ dart.library('dart/convert', null, /* Imports */[ this.close(); } addSlice(source, start, end, isLast) { - core.RangeError.checkValidRange(start, end, source.length); + core.RangeError.checkValidRange(start, end, source[dartx.length]); for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) { let char = source[dartx.get](i); if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char) < 0) { @@ -1663,7 +1663,7 @@ dart.library('dart/convert', null, /* Imports */[ super._Latin1DecoderSink(sink); } addSlice(source, start, end, isLast) { - core.RangeError.checkValidRange(start, end, source.length); + core.RangeError.checkValidRange(start, end, source[dartx.length]); for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) { let char = source[dartx.get](i); if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char) < 0) { @@ -1690,7 +1690,7 @@ dart.library('dart/convert', null, /* Imports */[ } convert(data) { let lines = core.List$(core.String).new(); - _LineSplitterSink._addSlice(data, 0, data.length, true, dart.bind(lines, dartx.add)); + _LineSplitterSink._addSlice(data, 0, data[dartx.length], true, dart.bind(lines, dartx.add)); return lines; } startChunkedConversion(sink) { @@ -1717,7 +1717,7 @@ dart.library('dart/convert', null, /* Imports */[ if (this[_carry] != null) { chunk = dart.notNull(this[_carry]) + dart.notNull(chunk[dartx.substring](start, end)); start = 0; - end = chunk.length; + end = chunk[dartx.length]; this[_carry] = null; } this[_carry] = _LineSplitterSink._addSlice(chunk, start, end, isLast, dart.bind(this[_sink], 'add')); @@ -1915,7 +1915,7 @@ dart.library('dart/convert', null, /* Imports */[ } close() {} addSlice(str, start, end, isLast) { - if (start != 0 || end != str.length) { + if (start != 0 || end != str[dartx.length]) { for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) { this[_stringSink].writeCharCode(str[dartx.codeUnitAt](i)); } @@ -1968,7 +1968,7 @@ dart.library('dart/convert', null, /* Imports */[ return this[_sink].add(str); } addSlice(str, start, end, isLast) { - if (start == 0 && end == str.length) { + if (start == 0 && end == str[dartx.length]) { this.add(str); } else { this.add(str[dartx.substring](start, end)); @@ -2000,7 +2000,7 @@ dart.library('dart/convert', null, /* Imports */[ this[_sink].close(); } add(chunk) { - this.addSlice(chunk, 0, chunk.length, false); + this.addSlice(chunk, 0, chunk[dartx.length], false); } addSlice(codeUnits, startIndex, endIndex, isLast) { this[_decoder].convert(codeUnits, startIndex, endIndex); @@ -2031,19 +2031,19 @@ dart.library('dart/convert', null, /* Imports */[ if (dart.notNull(this[_buffer].isNotEmpty)) { let accumulated = dart.toString(this[_buffer]); this[_buffer].clear(); - this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, true); + this[_chunkedSink].addSlice(accumulated, 0, accumulated[dartx.length], true); } else { this[_chunkedSink].close(); } } add(chunk) { - this.addSlice(chunk, 0, chunk.length, false); + this.addSlice(chunk, 0, chunk[dartx.length], false); } addSlice(chunk, startIndex, endIndex, isLast) { this[_decoder].convert(chunk, startIndex, endIndex); if (dart.notNull(this[_buffer].isNotEmpty)) { let accumulated = dart.toString(this[_buffer]); - this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, isLast); + this[_chunkedSink].addSlice(accumulated, 0, accumulated[dartx.length], isLast); this[_buffer].clear(); return; } @@ -2104,7 +2104,7 @@ dart.library('dart/convert', null, /* Imports */[ start = 0; if (end === void 0) end = null; - let stringLength = string.length; + let stringLength = string[dartx.length]; core.RangeError.checkValidRange(start, end, stringLength); if (end == null) end = stringLength; @@ -2205,7 +2205,7 @@ dart.library('dart/convert', null, /* Imports */[ for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); stringIndex = dart.notNull(stringIndex) + 1) { let codeUnit = str[dartx.codeUnitAt](stringIndex); if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { - if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer].length)) + if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer][dartx.length])) break; this[_buffer][dartx.set]((() => { let x = this[_bufferIndex]; @@ -2213,7 +2213,7 @@ dart.library('dart/convert', null, /* Imports */[ return x; })(), codeUnit); } else if (dart.notNull(_isLeadSurrogate(codeUnit))) { - if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer].length)) + if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer][dartx.length])) break; let nextCodeUnit = str[dartx.codeUnitAt](dart.notNull(stringIndex) + 1); let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); @@ -2223,7 +2223,7 @@ dart.library('dart/convert', null, /* Imports */[ } else { let rune = codeUnit; if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { - if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffer].length)) + if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffer][dartx.length])) break; this[_buffer][dartx.set]((() => { let x = this[_bufferIndex]; @@ -2237,7 +2237,7 @@ dart.library('dart/convert', null, /* Imports */[ })(), 128 | dart.notNull(rune) & 63); } else { dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); - if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffer].length)) + if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffer][dartx.length])) break; this[_buffer][dartx.set]((() => { let x = this[_bufferIndex]; @@ -2309,7 +2309,7 @@ dart.library('dart/convert', null, /* Imports */[ start = this[_fillBuffer](str, start, end); let isLastSlice = dart.notNull(isLast) && start == end; if (start == dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str[dartx.codeUnitAt](start)))) { - if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.notNull(this[_buffer].length) - 3) { + if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.notNull(this[_buffer][dartx.length]) - 3) { let hasBeenCombined = this[_writeSurrogate](str[dartx.codeUnitAt](start), 0); dart.assert(!dart.notNull(hasBeenCombined)); } else { @@ -2342,7 +2342,7 @@ dart.library('dart/convert', null, /* Imports */[ start = 0; if (end === void 0) end = null; - let length = codeUnits.length; + let length = codeUnits[dartx.length]; core.RangeError.checkValidRange(start, end, length); if (end == null) end = length; @@ -2580,7 +2580,7 @@ dart.library('dart/convert', null, /* Imports */[ let map = new _JsonMap(e); let processed = map[_processed]; let keys = map[_computeKeys](); - for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = dart.notNull(i) + 1) { let key = keys[dartx.get](i); let revived = dart.dcall(reviver, key, walk(e[key])); processed[key] = revived; @@ -2632,7 +2632,7 @@ dart.library('dart/convert', null, /* Imports */[ } } get length() { - return dart.notNull(this[_isUpgraded]) ? this[_upgradedMap].length : this[_computeKeys]().length; + return dart.notNull(this[_isUpgraded]) ? this[_upgradedMap].length : this[_computeKeys]()[dartx.length]; } get isEmpty() { return this.length == 0; @@ -2673,7 +2673,7 @@ dart.library('dart/convert', null, /* Imports */[ if (dart.notNull(this[_isUpgraded])) return this[_upgradedMap].containsValue(value); let keys = this[_computeKeys](); - for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = dart.notNull(i) + 1) { let key = keys[dartx.get](i); if (dart.equals(this.get(key), value)) return true; @@ -2714,7 +2714,7 @@ dart.library('dart/convert', null, /* Imports */[ if (dart.notNull(this[_isUpgraded])) return this[_upgradedMap].forEach(f); let keys = this[_computeKeys](); - for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = dart.notNull(i) + 1) { let key = keys[dartx.get](i); let value = _JsonMap._getProperty(this[_processed], key); if (dart.notNull(_JsonMap._isUnprocessed(value))) { @@ -2750,7 +2750,7 @@ dart.library('dart/convert', null, /* Imports */[ return this[_upgradedMap]; let result = dart.map(); let keys = this[_computeKeys](); - for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = dart.notNull(i) + 1) { let key = keys[dartx.get](i); result.set(key, this.get(key)); } diff --git a/pkg/dev_compiler/lib/runtime/dart/core.js b/pkg/dev_compiler/lib/runtime/dart/core.js index 9954c7ffecec..daddf3297142 100644 --- a/pkg/dev_compiler/lib/runtime/dart/core.js +++ b/pkg/dev_compiler/lib/runtime/dart/core.js @@ -888,7 +888,7 @@ dart.library('dart/core', null, /* Imports */[ let sb = new StringBuffer(); let i = 0; if (this[_arguments] != null) { - for (; dart.notNull(i) < dart.notNull(this[_arguments].length); i = dart.notNull(i) + 1) { + for (; dart.notNull(i) < dart.notNull(this[_arguments][dartx.length]); i = dart.notNull(i) + 1) { if (dart.notNull(i) > 0) { sb.write(", "); } @@ -911,7 +911,7 @@ dart.library('dart/core', null, /* Imports */[ } else { let actualParameters = dart.toString(sb); sb = new StringBuffer(); - for (let i = 0; dart.notNull(i) < dart.notNull(this[_existingArgumentNames].length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(this[_existingArgumentNames][dartx.length]); i = dart.notNull(i) + 1) { if (dart.notNull(i) > 0) { sb.write(", "); } @@ -1078,7 +1078,7 @@ dart.library('dart/core', null, /* Imports */[ } if (offset == -1) { let source = dart.as(this.source, String); - if (dart.notNull(source.length) > 78) { + if (dart.notNull(source[dartx.length]) > 78) { source = dart.notNull(source[dartx.substring](0, 75)) + "..."; } return `${report}\n${source}`; @@ -1133,7 +1133,7 @@ dart.library('dart/core', null, /* Imports */[ } } let slice = dart.as(dart.dsend(this.source, 'substring', start, end), String); - let markOffset = dart.notNull(offset) - dart.notNull(start) + dart.notNull(prefix.length); + let markOffset = dart.notNull(offset) - dart.notNull(start) + dart.notNull(prefix[dartx.length]); return `${report}${prefix}${slice}${postfix}\n${" "[dartx['*']](markOffset)}^\n`; } } @@ -1415,7 +1415,7 @@ dart.library('dart/core', null, /* Imports */[ static filled(length, fill) { let result = List$(E).new(length); if (length != 0 && fill != null) { - for (let i = 0; dart.notNull(i) < dart.notNull(result.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(result[dartx.length]); i = dart.notNull(i) + 1) { result[dartx.set](i, fill); } } @@ -1436,7 +1436,7 @@ dart.library('dart/core', null, /* Imports */[ let result = null; if (dart.notNull(growable)) { result = dart.list([], E); - result.length = length; + result[dartx.length] = length; } else { result = List$(E).new(length); } @@ -1637,7 +1637,7 @@ dart.library('dart/core', null, /* Imports */[ return String._stringFromIterable(charCodes, start, end); } let list = dart.as(charCodes, List); - let len = list.length; + let len = list[dartx.length]; if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(len)) { throw new RangeError.range(start, 0, len); } @@ -1660,9 +1660,9 @@ dart.library('dart/core', null, /* Imports */[ } static _stringFromIterable(charCodes, start, end) { if (dart.notNull(start) < 0) - throw new RangeError.range(start, 0, charCodes.length); + throw new RangeError.range(start, 0, charCodes[dartx.length]); if (end != null && dart.notNull(end) < dart.notNull(start)) { - throw new RangeError.range(end, start, charCodes.length); + throw new RangeError.range(end, start, charCodes[dartx.length]); } let it = charCodes[dartx.iterator]; for (let i = 0; dart.notNull(i) < dart.notNull(start); i = dart.notNull(i) + 1) { @@ -1706,12 +1706,12 @@ dart.library('dart/core', null, /* Imports */[ return new RuneIterator(this.string); } get last() { - if (this.string.length == 0) { + if (this.string[dartx.length] == 0) { throw new StateError('No elements.'); } - let length = this.string.length; + let length = this.string[dartx.length]; let code = this.string[dartx.codeUnitAt](dart.notNull(length) - 1); - if (dart.notNull(_isTrailSurrogate(code)) && dart.notNull(this.string.length) > 1) { + if (dart.notNull(_isTrailSurrogate(code)) && dart.notNull(this.string[dartx.length]) > 1) { let previousCode = this.string[dartx.codeUnitAt](dart.notNull(length) - 2); if (dart.notNull(_isLeadSurrogate(previousCode))) { return _combineSurrogatePair(previousCode, code); @@ -1755,11 +1755,11 @@ dart.library('dart/core', null, /* Imports */[ this[_position] = index; this[_nextPosition] = index; this[_currentCodePoint] = null; - RangeError.checkValueInInterval(index, 0, string.length); + RangeError.checkValueInInterval(index, 0, string[dartx.length]); this[_checkSplitSurrogate](index); } [_checkSplitSurrogate](index) { - if (dart.notNull(index) > 0 && dart.notNull(index) < dart.notNull(this.string.length) && dart.notNull(_isLeadSurrogate(this.string[dartx.codeUnitAt](dart.notNull(index) - 1))) && dart.notNull(_isTrailSurrogate(this.string[dartx.codeUnitAt](index)))) { + if (dart.notNull(index) > 0 && dart.notNull(index) < dart.notNull(this.string[dartx.length]) && dart.notNull(_isLeadSurrogate(this.string[dartx.codeUnitAt](dart.notNull(index) - 1))) && dart.notNull(_isTrailSurrogate(this.string[dartx.codeUnitAt](index)))) { throw new ArgumentError(`Index inside surrogate pair: ${index}`); } } @@ -1774,7 +1774,7 @@ dart.library('dart/core', null, /* Imports */[ reset(rawIndex) { if (rawIndex === void 0) rawIndex = 0; - RangeError.checkValueInInterval(rawIndex, 0, this.string.length, "rawIndex"); + RangeError.checkValueInInterval(rawIndex, 0, this.string[dartx.length], "rawIndex"); this[_checkSplitSurrogate](rawIndex); this[_position] = this[_nextPosition] = rawIndex; this[_currentCodePoint] = null; @@ -1794,13 +1794,13 @@ dart.library('dart/core', null, /* Imports */[ } moveNext() { this[_position] = this[_nextPosition]; - if (this[_position] == this.string.length) { + if (this[_position] == this.string[dartx.length]) { this[_currentCodePoint] = null; return false; } let codeUnit = this.string[dartx.codeUnitAt](this[_position]); let nextPosition = dart.notNull(this[_position]) + 1; - if (dart.notNull(_isLeadSurrogate(codeUnit)) && dart.notNull(nextPosition) < dart.notNull(this.string.length)) { + if (dart.notNull(_isLeadSurrogate(codeUnit)) && dart.notNull(nextPosition) < dart.notNull(this.string[dartx.length])) { let nextCodeUnit = this.string[dartx.codeUnitAt](nextPosition); if (dart.notNull(_isTrailSurrogate(nextCodeUnit))) { this[_nextPosition] = dart.notNull(nextPosition) + 1; @@ -1856,7 +1856,7 @@ dart.library('dart/core', null, /* Imports */[ this[_contents] = `${content}`; } get length() { - return this[_contents].length; + return this[_contents][dartx.length]; } get isEmpty() { return this.length == 0; @@ -1956,7 +1956,7 @@ dart.library('dart/core', null, /* Imports */[ if (this[_host] == null) return ""; if (dart.notNull(this[_host][dartx.startsWith]('['))) { - return this[_host][dartx.substring](1, dart.notNull(this[_host].length) - 1); + return this[_host][dartx.substring](1, dart.notNull(this[_host][dartx.length]) - 1); } return this[_host]; } @@ -1998,7 +1998,7 @@ dart.library('dart/core', null, /* Imports */[ let pathStart = 0; let char = EOI; let parseAuth = () => { - if (index == uri.length) { + if (index == uri[dartx.length]) { char = EOI; return; } @@ -2006,7 +2006,7 @@ dart.library('dart/core', null, /* Imports */[ let lastColon = -1; let lastAt = -1; char = uri[dartx.codeUnitAt](index); - while (dart.notNull(index) < dart.notNull(uri.length)) { + while (dart.notNull(index) < dart.notNull(uri[dartx.length])) { char = uri[dartx.codeUnitAt](index); if (char == Uri._SLASH || char == Uri._QUESTION || char == Uri._NUMBER_SIGN) { break; @@ -2020,7 +2020,7 @@ dart.library('dart/core', null, /* Imports */[ lastColon = -1; let endBracket = uri[dartx.indexOf](']', dart.notNull(index) + 1); if (endBracket == -1) { - index = uri.length; + index = uri[dartx.length]; char = EOI; break; } else { @@ -2052,7 +2052,7 @@ dart.library('dart/core', null, /* Imports */[ hostEnd = lastColon; } host = Uri._makeHost(uri, hostStart, hostEnd, true); - if (dart.notNull(index) < dart.notNull(uri.length)) { + if (dart.notNull(index) < dart.notNull(uri[dartx.length])) { char = uri[dartx.codeUnitAt](index); } }; @@ -2062,7 +2062,7 @@ dart.library('dart/core', null, /* Imports */[ let ALLOW_AUTH = 2; let state = NOT_IN_PATH; let i = index; - while (dart.notNull(i) < dart.notNull(uri.length)) { + while (dart.notNull(i) < dart.notNull(uri[dartx.length])) { char = uri[dartx.codeUnitAt](i); if (char == Uri._QUESTION || char == Uri._NUMBER_SIGN) { state = NOT_IN_PATH; @@ -2078,7 +2078,7 @@ dart.library('dart/core', null, /* Imports */[ scheme = Uri._makeScheme(uri, i); i = dart.notNull(i) + 1; pathStart = i; - if (i == uri.length) { + if (i == uri[dartx.length]) { char = EOI; state = NOT_IN_PATH; } else { @@ -2100,7 +2100,7 @@ dart.library('dart/core', null, /* Imports */[ if (state == ALLOW_AUTH) { dart.assert(char == Uri._SLASH); index = dart.notNull(index) + 1; - if (index == uri.length) { + if (index == uri[dartx.length]) { char = EOI; state = NOT_IN_PATH; } else { @@ -2119,7 +2119,7 @@ dart.library('dart/core', null, /* Imports */[ } dart.assert(state == IN_PATH || state == NOT_IN_PATH); if (state == IN_PATH) { - while ((index = dart.notNull(index) + 1) < dart.notNull(uri.length)) { + while ((index = dart.notNull(index) + 1) < dart.notNull(uri[dartx.length])) { char = uri[dartx.codeUnitAt](index); if (char == Uri._QUESTION || char == Uri._NUMBER_SIGN) { break; @@ -2135,13 +2135,13 @@ dart.library('dart/core', null, /* Imports */[ if (char == Uri._QUESTION) { let numberSignIndex = uri[dartx.indexOf]('#', dart.notNull(index) + 1); if (dart.notNull(numberSignIndex) < 0) { - query = Uri._makeQuery(uri, dart.notNull(index) + 1, uri.length, null); + query = Uri._makeQuery(uri, dart.notNull(index) + 1, uri[dartx.length], null); } else { query = Uri._makeQuery(uri, dart.notNull(index) + 1, numberSignIndex, null); - fragment = Uri._makeFragment(uri, dart.notNull(numberSignIndex) + 1, uri.length); + fragment = Uri._makeFragment(uri, dart.notNull(numberSignIndex) + 1, uri[dartx.length]); } } else if (char == Uri._NUMBER_SIGN) { - fragment = Uri._makeFragment(uri, dart.notNull(index) + 1, uri.length); + fragment = Uri._makeFragment(uri, dart.notNull(index) + 1, uri[dartx.length]); } return new Uri._internal(scheme, userinfo, host, port, path, query, fragment); } @@ -2202,7 +2202,7 @@ dart.library('dart/core', null, /* Imports */[ if (authority != null && dart.notNull(authority[dartx.isNotEmpty])) { let hostStart = 0; let hasUserInfo = false; - for (let i = 0; dart.notNull(i) < dart.notNull(authority.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(authority[dartx.length]); i = dart.notNull(i) + 1) { if (authority[dartx.codeUnitAt](i) == Uri._AT_SIGN) { hasUserInfo = true; userInfo = authority[dartx.substring](0, i); @@ -2211,22 +2211,22 @@ dart.library('dart/core', null, /* Imports */[ } } let hostEnd = hostStart; - if (dart.notNull(hostStart) < dart.notNull(authority.length) && authority[dartx.codeUnitAt](hostStart) == Uri._LEFT_BRACKET) { - for (; dart.notNull(hostEnd) < dart.notNull(authority.length); hostEnd = dart.notNull(hostEnd) + 1) { + if (dart.notNull(hostStart) < dart.notNull(authority[dartx.length]) && authority[dartx.codeUnitAt](hostStart) == Uri._LEFT_BRACKET) { + for (; dart.notNull(hostEnd) < dart.notNull(authority[dartx.length]); hostEnd = dart.notNull(hostEnd) + 1) { if (authority[dartx.codeUnitAt](hostEnd) == Uri._RIGHT_BRACKET) break; } - if (hostEnd == authority.length) { + if (hostEnd == authority[dartx.length]) { throw new FormatException("Invalid IPv6 host entry.", authority, hostStart); } Uri.parseIPv6Address(authority, dart.notNull(hostStart) + 1, hostEnd); hostEnd = dart.notNull(hostEnd) + 1; - if (hostEnd != authority.length && authority[dartx.codeUnitAt](hostEnd) != Uri._COLON) { + if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt](hostEnd) != Uri._COLON) { throw new FormatException("Invalid end of authority", authority, hostEnd); } } let hasPort = false; - for (; dart.notNull(hostEnd) < dart.notNull(authority.length); hostEnd = dart.notNull(hostEnd) + 1) { + for (; dart.notNull(hostEnd) < dart.notNull(authority[dartx.length]); hostEnd = dart.notNull(hostEnd) + 1) { if (authority[dartx.codeUnitAt](hostEnd) == Uri._COLON) { let portString = authority[dartx.substring](dart.notNull(hostEnd) + 1); if (dart.notNull(portString[dartx.isNotEmpty])) @@ -2300,7 +2300,7 @@ dart.library('dart/core', null, /* Imports */[ path = `\\${path[dartx.substring](7)}`; } else { path = path[dartx.substring](4); - if (dart.notNull(path.length) < 3 || path[dartx.codeUnitAt](1) != Uri._COLON || path[dartx.codeUnitAt](2) != Uri._BACKSLASH) { + if (dart.notNull(path[dartx.length]) < 3 || path[dartx.codeUnitAt](1) != Uri._COLON || path[dartx.codeUnitAt](2) != Uri._BACKSLASH) { throw new ArgumentError("Windows paths with \\\\?\\ prefix must be absolute"); } } @@ -2308,17 +2308,17 @@ dart.library('dart/core', null, /* Imports */[ path = path[dartx.replaceAll]("/", "\\"); } let sep = "\\"; - if (dart.notNull(path.length) > 1 && path[dartx.get](1) == ":") { + if (dart.notNull(path[dartx.length]) > 1 && path[dartx.get](1) == ":") { Uri._checkWindowsDriveLetter(path[dartx.codeUnitAt](0), true); - if (path.length == 2 || path[dartx.codeUnitAt](2) != Uri._BACKSLASH) { + if (path[dartx.length] == 2 || path[dartx.codeUnitAt](2) != Uri._BACKSLASH) { throw new ArgumentError("Windows paths with drive letter must be absolute"); } let pathSegments = path[dartx.split](sep); Uri._checkWindowsPathReservedCharacters(pathSegments, true, 1); return Uri.new({scheme: "file", pathSegments: pathSegments}); } - if (dart.notNull(path.length) > 0 && path[dartx.get](0) == sep) { - if (dart.notNull(path.length) > 1 && path[dartx.get](1) == sep) { + if (dart.notNull(path[dartx.length]) > 0 && path[dartx.get](0) == sep) { + if (dart.notNull(path[dartx.length]) > 1 && path[dartx.get](1) == sep) { let pathStart = path[dartx.indexOf]("\\", 2); let hostPart = pathStart == -1 ? path[dartx.substring](2) : path[dartx.substring](2, pathStart); let pathPart = pathStart == -1 ? "" : path[dartx.substring](dart.notNull(pathStart) + 1); @@ -2348,14 +2348,14 @@ dart.library('dart/core', null, /* Imports */[ let fragment = opts && 'fragment' in opts ? opts.fragment : null; let schemeChanged = false; if (scheme != null) { - scheme = Uri._makeScheme(scheme, scheme.length); + scheme = Uri._makeScheme(scheme, scheme[dartx.length]); schemeChanged = true; } else { scheme = this.scheme; } let isFile = scheme == "file"; if (userInfo != null) { - userInfo = Uri._makeUserInfo(userInfo, 0, userInfo.length); + userInfo = Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]); } else { userInfo = this.userInfo; } @@ -2368,7 +2368,7 @@ dart.library('dart/core', null, /* Imports */[ } } if (host != null) { - host = Uri._makeHost(host, 0, host.length, false); + host = Uri._makeHost(host, 0, host[dartx.length], false); } else if (dart.notNull(this.hasAuthority)) { host = this.host; } else if (dart.notNull(userInfo[dartx.isNotEmpty]) || port != null || dart.notNull(isFile)) { @@ -2389,7 +2389,7 @@ dart.library('dart/core', null, /* Imports */[ query = this.query; } if (fragment != null) { - fragment = Uri._makeFragment(fragment, 0, fragment.length); + fragment = Uri._makeFragment(fragment, 0, fragment[dartx.length]); } else if (dart.notNull(this.hasFragment)) { fragment = this.fragment; } @@ -2587,7 +2587,7 @@ dart.library('dart/core', null, /* Imports */[ return Uri._normalize(fragment, start, end, dart.as(Uri._queryCharTable, List$(int))); } static _stringOrNullLength(s) { - return s == null ? 0 : s.length; + return s == null ? 0 : s[dartx.length]; } static _isHexDigit(char) { if (dart.notNull(Uri._NINE) >= dart.notNull(char)) @@ -2604,7 +2604,7 @@ dart.library('dart/core', null, /* Imports */[ } static _normalizeEscape(source, index, lowerCase) { dart.assert(source[dartx.codeUnitAt](index) == Uri._PERCENT); - if (dart.notNull(index) + 2 >= dart.notNull(source.length)) { + if (dart.notNull(index) + 2 >= dart.notNull(source[dartx.length])) { return "%"; } let firstDigit = source[dartx.codeUnitAt](dart.notNull(index) + 1); @@ -2748,7 +2748,7 @@ dart.library('dart/core', null, /* Imports */[ return dart.notNull(base[dartx.substring](0, dart.notNull(baseEnd) + 1)) + dart.notNull(reference[dartx.substring](dart.notNull(refStart) - 3 * dart.notNull(backCount))); } [_hasDotSegments](path) { - if (dart.notNull(path.length) > 0 && path[dartx.codeUnitAt](0) == Uri._DOT) + if (dart.notNull(path[dartx.length]) > 0 && path[dartx.codeUnitAt](0) == Uri._DOT) return true; let index = path[dartx.indexOf]("/."); return index != -1; @@ -2761,7 +2761,7 @@ dart.library('dart/core', null, /* Imports */[ for (let segment of path[dartx.split]("/")) { appendSlash = false; if (segment == "..") { - if (!dart.notNull(output[dartx.isEmpty]) && (output.length != 1 || output[dartx.get](0) != "")) + if (!dart.notNull(output[dartx.isEmpty]) && (output[dartx.length] != 1 || output[dartx.get](0) != "")) output[dartx.removeLast](); appendSlash = true; } else if ("." == segment) { @@ -2881,7 +2881,7 @@ dart.library('dart/core', null, /* Imports */[ [_toWindowsFilePath]() { let hasDriveLetter = false; let segments = this.pathSegments; - if (dart.notNull(segments.length) > 0 && segments[dartx.get](0).length == 2 && segments[dartx.get](0)[dartx.codeUnitAt](1) == Uri._COLON) { + if (dart.notNull(segments[dartx.length]) > 0 && segments[dartx.get](0)[dartx.length] == 2 && segments[dartx.get](0)[dartx.codeUnitAt](1) == Uri._COLON) { Uri._checkWindowsDriveLetter(segments[dartx.get](0)[dartx.codeUnitAt](0), false); Uri._checkWindowsPathReservedCharacters(segments, false, 1); hasDriveLetter = true; @@ -2897,7 +2897,7 @@ dart.library('dart/core', null, /* Imports */[ result.write("\\"); } result.writeAll(segments, "\\"); - if (dart.notNull(hasDriveLetter) && segments.length == 1) + if (dart.notNull(hasDriveLetter) && segments[dartx.length] == 1) result.write("\\"); return dart.toString(result); } @@ -2997,7 +2997,7 @@ dart.library('dart/core', null, /* Imports */[ }; dart.fn(error, dart.void, [String]); let bytes = host[dartx.split]('.'); - if (bytes.length != 4) { + if (bytes[dartx.length] != 4) { error('IPv4 address should contain exactly 4 parts'); } return dart.as(bytes[dartx.map](dart.fn(byteString => { @@ -3014,7 +3014,7 @@ dart.library('dart/core', null, /* Imports */[ if (end === void 0) end = null; if (end == null) - end = host.length; + end = host[dartx.length]; let error = (msg, position) => { if (position === void 0) position = null; @@ -3032,7 +3032,7 @@ dart.library('dart/core', null, /* Imports */[ return value; }; dart.fn(parseHex, int, [int, int]); - if (dart.notNull(host.length) < 2) + if (dart.notNull(host[dartx.length]) < 2) error('address is too short'); let parts = dart.list([], int); let wildcardSeen = false; @@ -3058,7 +3058,7 @@ dart.library('dart/core', null, /* Imports */[ partStart = dart.notNull(i) + 1; } } - if (parts.length == 0) + if (parts[dartx.length] == 0) error('too few parts'); let atEnd = partStart == end; let isLastWildcard = parts[dartx.last] == -1; @@ -3081,17 +3081,17 @@ dart.library('dart/core', null, /* Imports */[ } if (dart.notNull(wildcardSeen)) { - if (dart.notNull(parts.length) > 7) { + if (dart.notNull(parts[dartx.length]) > 7) { error('an address with a wildcard must have less than 7 parts'); } - } else if (parts.length != 8) { + } else if (parts[dartx.length] != 8) { error('an address without a wildcard must contain exactly 8 parts'); } let bytes = List$(int).new(16); - for (let i = 0, index = 0; dart.notNull(i) < dart.notNull(parts.length); i = dart.notNull(i) + 1) { + for (let i = 0, index = 0; dart.notNull(i) < dart.notNull(parts[dartx.length]); i = dart.notNull(i) + 1) { let value = parts[dartx.get](i); if (value == -1) { - let wildCardLength = 9 - dart.notNull(parts.length); + let wildCardLength = 9 - dart.notNull(parts[dartx.length]); for (let j = 0; dart.notNull(j) < dart.notNull(wildCardLength); j = dart.notNull(j) + 1) { bytes[dartx.set](index, 0); bytes[dartx.set](dart.notNull(index) + 1, 0); @@ -3116,7 +3116,7 @@ dart.library('dart/core', null, /* Imports */[ dart.fn(byteToHex); let result = new StringBuffer(); let bytes = encoding.encode(text); - for (let i = 0; dart.notNull(i) < dart.notNull(bytes.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(bytes[dartx.length]); i = dart.notNull(i) + 1) { let byte = bytes[dartx.get](i); if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[dartx.get](dart.notNull(byte) >> 4)) & 1 << (dart.notNull(byte) & 15)) != 0) { result.writeCharCode(byte); @@ -3150,7 +3150,7 @@ dart.library('dart/core', null, /* Imports */[ let plusToSpace = opts && 'plusToSpace' in opts ? opts.plusToSpace : false; let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; let simple = true; - for (let i = 0; dart.notNull(i) < dart.notNull(text.length) && dart.notNull(simple); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(text[dartx.length]) && dart.notNull(simple); i = dart.notNull(i) + 1) { let codeUnit = text[dartx.codeUnitAt](i); simple = codeUnit != Uri._PERCENT && codeUnit != Uri._PLUS; } @@ -3163,13 +3163,13 @@ dart.library('dart/core', null, /* Imports */[ } } else { bytes = List$(int).new(); - for (let i = 0; dart.notNull(i) < dart.notNull(text.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(text[dartx.length]); i = dart.notNull(i) + 1) { let codeUnit = text[dartx.codeUnitAt](i); if (dart.notNull(codeUnit) > 127) { throw new ArgumentError("Illegal percent encoding in URI"); } if (codeUnit == Uri._PERCENT) { - if (dart.notNull(i) + 3 > dart.notNull(text.length)) { + if (dart.notNull(i) + 3 > dart.notNull(text[dartx.length])) { throw new ArgumentError('Truncated URI'); } bytes[dartx.add](Uri._hexCharPairToByte(text, dart.notNull(i) + 1)); diff --git a/pkg/dev_compiler/lib/runtime/dart/isolate.js b/pkg/dev_compiler/lib/runtime/dart/isolate.js index dc371ad98979..e6ba40285cda 100644 --- a/pkg/dev_compiler/lib/runtime/dart/isolate.js +++ b/pkg/dev_compiler/lib/runtime/dart/isolate.js @@ -54,7 +54,7 @@ dart.library('dart/isolate', null, /* Imports */[ throw new core.UnimplementedError("packageRoot"); try { if (dart.is(args, core.List)) { - for (let i = 0; dart.notNull(i) < dart.notNull(args.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(args[dartx.length]); i = dart.notNull(i) + 1) { if (!(typeof args[dartx.get](i) == 'string')) { throw new core.ArgumentError(`Args must be a list of Strings ${args}`); } diff --git a/pkg/dev_compiler/lib/src/codegen/js_codegen.dart b/pkg/dev_compiler/lib/src/codegen/js_codegen.dart index d6f057584a7a..99ece9c88e0c 100644 --- a/pkg/dev_compiler/lib/src/codegen/js_codegen.dart +++ b/pkg/dev_compiler/lib/src/codegen/js_codegen.dart @@ -2676,8 +2676,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor { // Dart "extension" methods. Used for JS Array, Boolean, Number, String. if (allowExtensions && _extensionTypes.contains(type.element)) { - // Special case `length`. We can call it directly. - if (name != 'length') return js.call('dartx.#', _propertyName(name)); + return js.call('dartx.#', _propertyName(name)); } return _propertyName(name); diff --git a/pkg/dev_compiler/test/codegen/expect/BenchmarkBase.js b/pkg/dev_compiler/test/codegen/expect/BenchmarkBase.js index a395c7829f03..970537789042 100644 --- a/pkg/dev_compiler/test/codegen/expect/BenchmarkBase.js +++ b/pkg/dev_compiler/test/codegen/expect/BenchmarkBase.js @@ -10,10 +10,10 @@ dart.library('BenchmarkBase', null, /* Imports */[ } } static listEquals(expected, actual) { - if (expected.length != actual.length) { - throw `Lists have different lengths: ${expected.length} vs ${actual.length}`; + if (expected[dartx.length] != actual[dartx.length]) { + throw `Lists have different lengths: ${expected[dartx.length]} vs ${actual[dartx.length]}`; } - for (let i = 0; dart.notNull(i) < dart.notNull(actual.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(actual[dartx.length]); i = dart.notNull(i) + 1) { Expect.equals(expected[dartx.get](i), actual[dartx.get](i)); } } diff --git a/pkg/dev_compiler/test/codegen/expect/DeltaBlue.js b/pkg/dev_compiler/test/codegen/expect/DeltaBlue.js index cf3a6684b258..f528b619e12c 100644 --- a/pkg/dev_compiler/test/codegen/expect/DeltaBlue.js +++ b/pkg/dev_compiler/test/codegen/expect/DeltaBlue.js @@ -353,7 +353,7 @@ dart.library('DeltaBlue', null, /* Imports */[ let unsatisfied = this.removePropagateFrom(out); let strength = REQUIRED; do { - for (let i = 0; dart.notNull(i) < dart.notNull(unsatisfied.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(unsatisfied[dartx.length]); i = dart.notNull(i) + 1) { let u = unsatisfied[dartx.get](i); if (dart.equals(u.strength, strength)) this.incrementalAdd(u); @@ -368,7 +368,7 @@ dart.library('DeltaBlue', null, /* Imports */[ let mark = this.newMark(); let plan = new Plan(); let todo = sources; - while (dart.notNull(todo.length) > 0) { + while (dart.notNull(todo[dartx.length]) > 0) { let c = todo[dartx.removeLast](); if (c.output().mark != mark && dart.notNull(c.inputsKnown(mark))) { plan.addConstraint(c); @@ -380,7 +380,7 @@ dart.library('DeltaBlue', null, /* Imports */[ } extractPlanFromConstraints(constraints) { let sources = dart.list([], Constraint); - for (let i = 0; dart.notNull(i) < dart.notNull(constraints.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(constraints[dartx.length]); i = dart.notNull(i) + 1) { let c = constraints[dartx.get](i); if (dart.notNull(c.isInput()) && dart.notNull(c.isSatisfied())) sources[dartx.add](c); @@ -389,7 +389,7 @@ dart.library('DeltaBlue', null, /* Imports */[ } addPropagate(c, mark) { let todo = dart.list([c], Constraint); - while (dart.notNull(todo.length) > 0) { + while (dart.notNull(todo[dartx.length]) > 0) { let d = todo[dartx.removeLast](); if (d.output().mark == mark) { this.incrementalRemove(c); @@ -406,15 +406,15 @@ dart.library('DeltaBlue', null, /* Imports */[ out.stay = true; let unsatisfied = dart.list([], Constraint); let todo = dart.list([out], Variable); - while (dart.notNull(todo.length) > 0) { + while (dart.notNull(todo[dartx.length]) > 0) { let v = todo[dartx.removeLast](); - for (let i = 0; dart.notNull(i) < dart.notNull(v.constraints.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(v.constraints[dartx.length]); i = dart.notNull(i) + 1) { let c = v.constraints[dartx.get](i); if (!dart.notNull(c.isSatisfied())) unsatisfied[dartx.add](c); } let determining = v.determinedBy; - for (let i = 0; dart.notNull(i) < dart.notNull(v.constraints.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(v.constraints[dartx.length]); i = dart.notNull(i) + 1) { let next = v.constraints[dartx.get](i); if (!dart.equals(next, determining) && dart.notNull(next.isSatisfied())) { next.recalculate(); @@ -426,7 +426,7 @@ dart.library('DeltaBlue', null, /* Imports */[ } addConstraintsConsumingTo(v, coll) { let determining = v.determinedBy; - for (let i = 0; dart.notNull(i) < dart.notNull(v.constraints.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(v.constraints[dartx.length]); i = dart.notNull(i) + 1) { let c = v.constraints[dartx.get](i); if (!dart.equals(c, determining) && dart.notNull(c.isSatisfied())) coll[dartx.add](c); @@ -453,10 +453,10 @@ dart.library('DeltaBlue', null, /* Imports */[ this.list[dartx.add](c); } size() { - return this.list.length; + return this.list[dartx.length]; } execute() { - for (let i = 0; dart.notNull(i) < dart.notNull(this.list.length); i = dart.notNull(i) + 1) { + for (let i = 0; dart.notNull(i) < dart.notNull(this.list[dartx.length]); i = dart.notNull(i) + 1) { this.list[dartx.get](i).execute(); } } diff --git a/pkg/dev_compiler/test/codegen/expect/cascade.js b/pkg/dev_compiler/test/codegen/expect/cascade.js index ab5728a7916a..0a273d9eb6c8 100644 --- a/pkg/dev_compiler/test/codegen/expect/cascade.js +++ b/pkg/dev_compiler/test/codegen/expect/cascade.js @@ -50,7 +50,7 @@ dart.library('cascade', null, /* Imports */[ dart.fn(test_mutate_outside_cascade, dart.void, []); function test_VariableDeclaration_single() { let a = []; - a.length = 2; + a[dartx.length] = 2; a[dartx.add](42); core.print(a); } @@ -58,7 +58,7 @@ dart.library('cascade', null, /* Imports */[ function test_VariableDeclaration_last() { let a = 42, b = (() => { let _ = []; - _.length = 2; + _[dartx.length] = 2; _[dartx.add](a); return _; })(); @@ -68,7 +68,7 @@ dart.library('cascade', null, /* Imports */[ function test_VariableDeclaration_first() { let a = (() => { let _ = []; - _.length = 2; + _[dartx.length] = 2; _[dartx.add](3); return _; })(), b = 2;