Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Unified Diff: lib/runtime/dart/core.js

Issue 1093143004: fixes #52, fields shadowing getters/setters or other fields (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/runtime/dart/convert.js ('k') | lib/runtime/dart/isolate.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/runtime/dart/core.js
diff --git a/lib/runtime/dart/core.js b/lib/runtime/dart/core.js
index 9c781a03433c26852c7ec9e28c779e90be7df37f..9dbfba47d124fb7adbe65bc807ea8b4fac3c9946 100644
--- a/lib/runtime/dart/core.js
+++ b/lib/runtime/dart/core.js
@@ -29,13 +29,13 @@ var core;
class JsName extends Object {
JsName(opts) {
let name = opts && 'name' in opts ? opts.name : null;
- this.name = name;
+ dart.initField(JsName, this, 'name', name);
}
}
class JsPeerInterface extends Object {
JsPeerInterface(opts) {
let name = opts && 'name' in opts ? opts.name : null;
- this.name = name;
+ dart.initField(JsPeerInterface, this, 'name', name);
}
}
class SupportJsExtensionMethod extends Object {
@@ -44,7 +44,7 @@ var core;
}
class Deprecated extends Object {
Deprecated(expires) {
- this.expires = expires;
+ dart.initField(Deprecated, this, 'expires', expires);
}
toString() {
return `Deprecated feature. Will be removed ${this.expires}`;
@@ -195,8 +195,8 @@ var core;
}
fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opts) {
let isUtc = opts && 'isUtc' in opts ? opts.isUtc : false;
- this.millisecondsSinceEpoch = millisecondsSinceEpoch;
- this.isUtc = isUtc;
+ dart.initField(DateTime, this, 'millisecondsSinceEpoch', millisecondsSinceEpoch);
+ dart.initField(DateTime, this, 'isUtc', isUtc);
if (dart.notNull(millisecondsSinceEpoch.abs()) > dart.notNull(DateTime[_MAX_MILLISECONDS_SINCE_EPOCH])) {
throw new ArgumentError(millisecondsSinceEpoch);
}
@@ -307,12 +307,12 @@ var core;
return new Duration({milliseconds: dart.notNull(ms) - dart.notNull(otherMs)});
}
[_internal](year, month, day, hour, minute, second, millisecond, isUtc) {
- this.isUtc = typeof isUtc == 'boolean' ? isUtc : dart.throw_(new ArgumentError(isUtc));
- this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primitives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecond, isUtc)), int);
+ dart.initField(DateTime, this, 'isUtc', typeof isUtc == 'boolean' ? isUtc : dart.throw_(new ArgumentError(isUtc)));
+ dart.initField(DateTime, this, 'millisecondsSinceEpoch', dart.as(_js_helper.checkInt(_js_helper.Primitives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecond, isUtc)), int));
}
[_now]() {
- this.isUtc = false;
- this.millisecondsSinceEpoch = _js_helper.Primitives.dateNow();
+ dart.initField(DateTime, this, 'isUtc', false);
+ dart.initField(DateTime, this, 'millisecondsSinceEpoch', _js_helper.Primitives.dateNow());
}
static [_brokenDownDateToMillisecondsSinceEpoch](year, month, day, hour, minute, second, millisecond, isUtc) {
return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecond, isUtc), int);
@@ -436,7 +436,7 @@ var core;
this[_microseconds](dart.notNull(days) * dart.notNull(Duration.MICROSECONDS_PER_DAY) + dart.notNull(hours) * dart.notNull(Duration.MICROSECONDS_PER_HOUR) + dart.notNull(minutes) * dart.notNull(Duration.MICROSECONDS_PER_MINUTE) + dart.notNull(seconds) * dart.notNull(Duration.MICROSECONDS_PER_SECOND) + dart.notNull(milliseconds) * dart.notNull(Duration.MICROSECONDS_PER_MILLISECOND) + dart.notNull(microseconds));
}
[_microseconds](duration) {
- this[_duration] = duration;
+ dart.initField(Duration, this, _duration, duration);
}
['+'](other) {
return new Duration[_microseconds](dart.notNull(this[_duration]) + dart.notNull(other[_duration]));
@@ -587,10 +587,10 @@ var core;
ArgumentError(message) {
if (message === void 0)
message = null;
- this.message = message;
- this.invalidValue = null;
+ dart.initField(ArgumentError, this, 'message', message);
+ dart.initField(ArgumentError, this, 'invalidValue', null);
this[_hasValue] = false;
- this.name = null;
+ dart.initField(ArgumentError, this, 'name', null);
super.Error();
}
value(value, name, message) {
@@ -598,9 +598,9 @@ var core;
name = null;
if (message === void 0)
message = "Invalid argument";
- this.name = name;
- this.message = message;
- this.invalidValue = value;
+ dart.initField(ArgumentError, this, 'name', name);
+ dart.initField(ArgumentError, this, 'message', message);
+ dart.initField(ArgumentError, this, 'invalidValue', value);
this[_hasValue] = true;
super.Error();
}
@@ -628,8 +628,8 @@ var core;
dart.defineNamedConstructor(ArgumentError, 'notNull');
class RangeError extends ArgumentError {
RangeError(message) {
- this.start = null;
- this.end = null;
+ dart.initField(RangeError, this, 'start', null);
+ dart.initField(RangeError, this, 'end', null);
super.ArgumentError(message);
}
value(value, name, message) {
@@ -637,8 +637,8 @@ var core;
name = null;
if (message === void 0)
message = null;
- this.start = null;
- this.end = null;
+ dart.initField(RangeError, this, 'start', null);
+ dart.initField(RangeError, this, 'end', null);
super.value(value, name, message != null ? message : "Value not in range");
}
range(invalidValue, minValue, maxValue, name, message) {
@@ -646,8 +646,8 @@ var core;
name = null;
if (message === void 0)
message = null;
- this.start = minValue;
- this.end = maxValue;
+ dart.initField(RangeError, this, 'start', minValue);
+ dart.initField(RangeError, this, 'end', maxValue);
super.value(invalidValue, name, message != null ? message : "Invalid value");
}
index(index, indexable, name, message, length) {
@@ -735,8 +735,8 @@ var core;
message = null;
if (length === void 0)
length = null;
- this.indexable = indexable;
- this.length = dart.as(length != null ? length : dart.dload(indexable, 'length'), int);
+ dart.initField(IndexError, this, 'indexable', indexable);
+ dart.initField(IndexError, this, 'length', dart.as(length != null ? length : dart.dload(indexable, 'length'), int));
super.value(invalidValue, name, message != null ? message : "Index out of range");
}
get start() {
@@ -829,7 +829,7 @@ var core;
}
class UnsupportedError extends Error {
UnsupportedError(message) {
- this.message = message;
+ dart.initField(UnsupportedError, this, 'message', message);
super.Error();
}
toString() {
@@ -840,7 +840,7 @@ var core;
UnimplementedError(message) {
if (message === void 0)
message = null;
- this.message = message;
+ dart.initField(UnimplementedError, this, 'message', message);
super.Error();
}
toString() {
@@ -850,7 +850,7 @@ var core;
UnimplementedError[dart.implements] = () => [UnsupportedError];
class StateError extends Error {
StateError(message) {
- this.message = message;
+ dart.initField(StateError, this, 'message', message);
super.Error();
}
toString() {
@@ -861,7 +861,7 @@ var core;
ConcurrentModificationError(modifiedObject) {
if (modifiedObject === void 0)
modifiedObject = null;
- this.modifiedObject = modifiedObject;
+ dart.initField(ConcurrentModificationError, this, 'modifiedObject', modifiedObject);
super.Error();
}
toString() {
@@ -897,7 +897,7 @@ var core;
CyclicInitializationError(variableName) {
if (variableName === void 0)
variableName = null;
- this.variableName = variableName;
+ dart.initField(CyclicInitializationError, this, 'variableName', variableName);
super.Error();
}
toString() {
@@ -932,9 +932,9 @@ var core;
source = null;
if (offset === void 0)
offset = -1;
- this.message = message;
- this.source = source;
- this.offset = offset;
+ dart.initField(FormatException, this, 'message', message);
+ dart.initField(FormatException, this, 'source', source);
+ dart.initField(FormatException, this, 'offset', offset);
}
toString() {
let report = "FormatException";
@@ -1030,7 +1030,7 @@ var core;
Expando(name) {
if (name === void 0)
name = null;
- this.name = name;
+ dart.initField(Expando, this, 'name', name);
}
toString() {
return `Expando:${this.name}`;
@@ -1129,10 +1129,10 @@ var core;
return _Generator;
});
let _Generator = _Generator$();
+ let _id = dart.JsSymbol('_id');
let _end = dart.JsSymbol('_end');
let _start = dart.JsSymbol('_start');
let _generator = dart.JsSymbol('_generator');
- let _id = dart.JsSymbol('_id');
let $iterator = dart.JsSymbol('$iterator');
let $skip = dart.JsSymbol('$skip');
let $take = dart.JsSymbol('$take');
@@ -1354,8 +1354,8 @@ var core;
return Stopwatch[_frequency];
}
Stopwatch() {
- this[_start] = null;
- this[_stop] = null;
+ dart.initField(Stopwatch, this, _start, null);
+ dart.initField(Stopwatch, this, _stop, null);
Stopwatch[_initTicker]();
}
start() {
@@ -1478,7 +1478,7 @@ var core;
get Runes() {
class Runes extends collection.IterableBase$(int) {
Runes(string) {
- this.string = string;
+ dart.initField(Runes, this, 'string', string);
super.IterableBase();
}
get [exports.$iterator]() {
@@ -1520,16 +1520,16 @@ var core;
let _checkSplitSurrogate = dart.JsSymbol('_checkSplitSurrogate');
class RuneIterator extends Object {
RuneIterator(string) {
- this.string = string;
- this[_position] = 0;
- this[_nextPosition] = 0;
- this[_currentCodePoint] = null;
+ dart.initField(RuneIterator, this, 'string', string);
+ dart.initField(RuneIterator, this, _position, 0);
+ dart.initField(RuneIterator, this, _nextPosition, 0);
+ dart.initField(RuneIterator, this, _currentCodePoint, null);
}
at(string, index) {
- this.string = string;
- this[_position] = index;
- this[_nextPosition] = index;
- this[_currentCodePoint] = null;
+ dart.initField(RuneIterator, this, 'string', string);
+ dart.initField(RuneIterator, this, _position, index);
+ dart.initField(RuneIterator, this, _nextPosition, index);
+ dart.initField(RuneIterator, this, _currentCodePoint, null);
RangeError.checkValueInInterval(index, 0, string.length);
this[_checkSplitSurrogate](index);
}
@@ -1616,7 +1616,7 @@ var core;
StringBuffer(content) {
if (content === void 0)
content = "";
- this[_contents] = `${content}`;
+ dart.initField(StringBuffer, this, _contents, `${content}`);
}
get length() {
return this[_contents].length;
@@ -1709,6 +1709,7 @@ var core;
let _makeWindowsFileUrl = dart.JsSymbol('_makeWindowsFileUrl');
let _makeFileUri = dart.JsSymbol('_makeFileUri');
let _checkNonWindowsPathReservedCharacters = dart.JsSymbol('_checkNonWindowsPathReservedCharacters');
+ let $forEach = dart.JsSymbol('$forEach');
let _checkWindowsPathReservedCharacters = dart.JsSymbol('_checkWindowsPathReservedCharacters');
let _checkWindowsDriveLetter = dart.JsSymbol('_checkWindowsDriveLetter');
let _UPPER_CASE_A = dart.JsSymbol('_UPPER_CASE_A');
@@ -1716,6 +1717,8 @@ var core;
let _LOWER_CASE_A = dart.JsSymbol('_LOWER_CASE_A');
let _LOWER_CASE_Z = dart.JsSymbol('_LOWER_CASE_Z');
let _BACKSLASH = dart.JsSymbol('_BACKSLASH');
+ let $map = dart.JsSymbol('$map');
+ let $toList = dart.JsSymbol('$toList');
let _normalizeRegName = dart.JsSymbol('_normalizeRegName');
let _isRegNameChar = dart.JsSymbol('_isRegNameChar');
let _PERCENT = dart.JsSymbol('_PERCENT');
@@ -1741,6 +1744,8 @@ var core;
let _DOT = dart.JsSymbol('_DOT');
let _hasDotSegments = dart.JsSymbol('_hasDotSegments');
let _removeDotSegments = dart.JsSymbol('_removeDotSegments');
+ let $isEmpty = dart.JsSymbol('$isEmpty');
+ let $removeLast = dart.JsSymbol('$removeLast');
let _toWindowsFilePath = dart.JsSymbol('_toWindowsFilePath');
let _toFilePath = dart.JsSymbol('_toFilePath');
let _isPathAbsolute = dart.JsSymbol('_isPathAbsolute');
@@ -1748,15 +1753,10 @@ var core;
let _unreserved2396Table = dart.JsSymbol('_unreserved2396Table');
let _uriDecode = dart.JsSymbol('_uriDecode');
let _encodeFullTable = dart.JsSymbol('_encodeFullTable');
+ let $fold = dart.JsSymbol('$fold');
let _SPACE = dart.JsSymbol('_SPACE');
let _PLUS = dart.JsSymbol('_PLUS');
let _hexCharPairToByte = dart.JsSymbol('_hexCharPairToByte');
- let $forEach = dart.JsSymbol('$forEach');
- let $map = dart.JsSymbol('$map');
- let $toList = dart.JsSymbol('$toList');
- let $isEmpty = dart.JsSymbol('$isEmpty');
- let $removeLast = dart.JsSymbol('$removeLast');
- let $fold = dart.JsSymbol('$fold');
class Uri extends Object {
get authority() {
if (!dart.notNull(this.hasAuthority))
@@ -1965,15 +1965,15 @@ var core;
throw new FormatException(message, uri, index);
}
[_internal](scheme, userInfo, host, port, path, query, fragment) {
- this.scheme = scheme;
- this[_userInfo] = userInfo;
- this[_host] = host;
- this[_port] = port;
- this[_path] = path;
- this[_query] = query;
- this[_fragment] = fragment;
- this[_pathSegments] = null;
- this[_queryParameters] = null;
+ dart.initField(Uri, this, 'scheme', scheme);
+ dart.initField(Uri, this, _userInfo, userInfo);
+ dart.initField(Uri, this, _host, host);
+ dart.initField(Uri, this, _port, port);
+ dart.initField(Uri, this, _path, path);
+ dart.initField(Uri, this, _query, query);
+ dart.initField(Uri, this, _fragment, fragment);
+ dart.initField(Uri, this, _pathSegments, null);
+ dart.initField(Uri, this, _queryParameters, null);
}
Uri(opts) {
let scheme = opts && 'scheme' in opts ? opts.scheme : "";
« no previous file with comments | « lib/runtime/dart/convert.js ('k') | lib/runtime/dart/isolate.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698