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

Unified Diff: frog/minfrog

Issue 9143001: Fixes 2 tests and a crash (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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
Index: frog/minfrog
diff --git a/frog/minfrog b/frog/minfrog
index 420727aecdcafd5091e14b97daab2e42f6cef08a..949ba0b086a9d7e7e7870012d61e98e65f4b6802 100755
--- a/frog/minfrog
+++ b/frog/minfrog
@@ -115,6 +115,9 @@ Object.prototype.addMethod$2 = function($0, $1) {
Object.prototype.addSource$1 = function($0) {
return this.noSuchMethod("addSource", [$0]);
};
+Object.prototype.binop$4 = function($0, $1, $2, $3) {
+ return this.noSuchMethod("binop", [$0, $1, $2, $3]);
+};
Object.prototype.block$0 = function() {
return this.noSuchMethod("block", []);
};
@@ -181,6 +184,9 @@ Object.prototype.getConstructor$1 = function($0) {
Object.prototype.getFactory$2 = function($0, $1) {
return this.noSuchMethod("getFactory", [$0, $1]);
};
+Object.prototype.getGlobalValue$0 = function() {
+ return this.noSuchMethod("getGlobalValue", []);
+};
Object.prototype.getKeys$0 = function() {
return this.noSuchMethod("getKeys", []);
};
@@ -298,6 +304,12 @@ Object.prototype.substring$1 = function($0) {
Object.prototype.substring$2 = function($0, $1) {
return this.noSuchMethod("substring", [$0, $1]);
};
+Object.prototype.toDouble$0 = function() {
+ return this.noSuchMethod("toDouble", []);
+};
+Object.prototype.toInt$0 = function() {
+ return this.noSuchMethod("toInt", []);
+};
Object.prototype.toRadixString$1 = function($0) {
return this.noSuchMethod("toRadixString", [$0]);
};
@@ -325,7 +337,7 @@ Clock.now = function() {
return new Date().getTime();
}
Clock.frequency = function() {
- return 1000;
+ return (1000);
}
// ********** Code for IllegalAccessException **************
function IllegalAccessException() {
@@ -344,9 +356,9 @@ function NoSuchMethodException(_receiver, _functionName, _arguments) {
}
NoSuchMethodException.prototype.toString = function() {
var sb = new StringBufferImpl("");
- for (var i = 0;
+ for (var i = (0);
i < this._arguments.get$length(); i++) {
- if (i > 0) {
+ if (i > (0)) {
sb.add(", ");
}
sb.add(this._arguments.$index(i));
@@ -483,7 +495,7 @@ function _print(obj) {
}
function _map(itemsAndKeys) {
var ret = new LinkedHashMapImplementation();
- for (var i = 0;
+ for (var i = (0);
i < itemsAndKeys.get$length(); ) {
ret.$setindex(itemsAndKeys.$index(i++), itemsAndKeys.$index(i++));
}
@@ -568,19 +580,19 @@ ListFactory.prototype.addAll = function(collection) {
}
}
ListFactory.prototype.clear = function() {
- this.set$length(0);
+ this.set$length((0));
}
ListFactory.prototype.removeLast = function() {
return this.pop();
}
ListFactory.prototype.last = function() {
- return this[this.get$length() - 1];
+ return this[this.get$length() - (1)];
}
ListFactory.prototype.getRange = function(start, length) {
return this.slice(start, start + length);
}
ListFactory.prototype.isEmpty = function() {
- return this.get$length() == 0;
+ return this.get$length() == (0);
}
ListFactory.prototype.iterator = function() {
return new ListIterator(this);
@@ -612,11 +624,12 @@ ListFactory_Expression = ListFactory;
ListFactory_K = ListFactory;
ListFactory_dart_core_String = ListFactory;
ListFactory_V = ListFactory;
+ListFactory_Value = ListFactory;
ListFactory_int = ListFactory;
// ********** Code for ListIterator **************
function ListIterator(array) {
this._array = array;
- this._pos = 0;
+ this._pos = (0);
// Initializers done
}
ListIterator.prototype.hasNext = function() {
@@ -624,7 +637,7 @@ ListIterator.prototype.hasNext = function() {
}
ListIterator.prototype.next = function() {
if (!this.hasNext()) {
- $throw(const$7/*const NoMoreElementsException()*/);
+ $throw(const$7);
}
return this._array.$index(this._pos++);
}
@@ -650,7 +663,7 @@ function ImmutableList(length) {
}
ImmutableList.ImmutableList$from$factory = function(other) {
var list = new ImmutableList(other.get$length());
- for (var i = 0;
+ for (var i = (0);
i < other.get$length(); i++) {
list._setindex(i, other.$index(i));
}
@@ -660,7 +673,7 @@ ImmutableList.prototype.get$length = function() {
return this._length;
}
ImmutableList.prototype.set$length = function(length) {
- $throw(const$126/*const IllegalAccessException()*/);
+ $throw(const$126);
}
Object.defineProperty(ImmutableList.prototype, "length", {
get: ImmutableList.prototype.get$length,
@@ -670,25 +683,25 @@ ImmutableList.prototype._setindex = function(index, value) {
return this[index] = value;
}
ImmutableList.prototype.$setindex = function(index, value) {
- $throw(const$126/*const IllegalAccessException()*/);
+ $throw(const$126);
}
ImmutableList.prototype.sort = function(compare) {
- $throw(const$126/*const IllegalAccessException()*/);
+ $throw(const$126);
}
ImmutableList.prototype.add = function(element) {
- $throw(const$126/*const IllegalAccessException()*/);
+ $throw(const$126);
}
ImmutableList.prototype.addLast = function(element) {
- $throw(const$126/*const IllegalAccessException()*/);
+ $throw(const$126);
}
ImmutableList.prototype.addAll = function(elements) {
- $throw(const$126/*const IllegalAccessException()*/);
+ $throw(const$126);
}
ImmutableList.prototype.clear = function() {
- $throw(const$126/*const IllegalAccessException()*/);
+ $throw(const$126);
}
ImmutableList.prototype.removeLast = function() {
- $throw(const$126/*const IllegalAccessException()*/);
+ $throw(const$126);
}
ImmutableList.prototype.toString = function() {
return ListFactory.ListFactory$from$factory(this).toString();
@@ -730,42 +743,44 @@ NumImplementation.prototype.toRadixString = function(radix) {
NumImplementation.prototype.compareTo = function(other) {
var thisValue = this.toDouble();
if (thisValue < other) {
- return -1;
+ return (-1);
}
else if (thisValue > other) {
- return 1;
+ return (1);
}
else if (thisValue == other) {
- if (thisValue == 0) {
+ if (thisValue == (0)) {
var thisIsNegative = this.isNegative();
var otherIsNegative = other.isNegative();
- if ($eq(thisIsNegative, otherIsNegative)) return 0;
- if (thisIsNegative) return -1;
- return 1;
+ if ($eq(thisIsNegative, otherIsNegative)) return (0);
+ if (thisIsNegative) return (-1);
+ return (1);
}
- return 0;
+ return (0);
}
else if (this.isNaN()) {
if (other.isNaN()) {
- return 0;
+ return (0);
}
- return 1;
+ return (1);
}
else {
- return -1;
+ return (-1);
}
}
NumImplementation.prototype.compareTo$1 = NumImplementation.prototype.compareTo;
NumImplementation.prototype.hashCode$0 = NumImplementation.prototype.hashCode;
+NumImplementation.prototype.toDouble$0 = NumImplementation.prototype.toDouble;
+NumImplementation.prototype.toInt$0 = NumImplementation.prototype.toInt;
NumImplementation.prototype.toRadixString$1 = NumImplementation.prototype.toRadixString;
// ********** Code for HashMapImplementation **************
function HashMapImplementation() {
// Initializers done
- this._numberOfEntries = 0;
- this._numberOfDeleted = 0;
- this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementation._INITIAL_CAPACITY*/);
- this._keys = new Array(8/*HashMapImplementation._INITIAL_CAPACITY*/);
- this._values = new Array(8/*HashMapImplementation._INITIAL_CAPACITY*/);
+ this._numberOfEntries = (0);
+ this._numberOfDeleted = (0);
+ this._loadLimit = HashMapImplementation._computeLoadLimit((8));
+ this._keys = new Array((8));
+ this._values = new Array((8));
}
HashMapImplementation.HashMapImplementation$from$factory = function(other) {
var result = new HashMapImplementation_K$V();
@@ -776,29 +791,29 @@ HashMapImplementation.HashMapImplementation$from$factory = function(other) {
return result;
}
HashMapImplementation._computeLoadLimit = function(capacity) {
- return $truncdiv((capacity * 3), 4);
+ return $truncdiv((capacity * (3)), (4));
}
HashMapImplementation._firstProbe = function(hashCode, length) {
- return hashCode & (length - 1);
+ return hashCode & (length - (1));
}
HashMapImplementation._nextProbe = function(currentProbe, numberOfProbes, length) {
- return (currentProbe + numberOfProbes) & (length - 1);
+ return (currentProbe + numberOfProbes) & (length - (1));
}
HashMapImplementation.prototype._probeForAdding = function(key) {
var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$length());
- var numberOfProbes = 1;
+ var numberOfProbes = (1);
var initialHash = hash;
- var insertionIndex = -1;
+ var insertionIndex = (-1);
while (true) {
var existingKey = this._keys.$index(hash);
if (existingKey == null) {
- if (insertionIndex < 0) return hash;
+ if (insertionIndex < (0)) return hash;
return insertionIndex;
}
else if ($eq(existingKey, key)) {
return hash;
}
- else if ((insertionIndex < 0) && (const$2/*HashMapImplementation._DELETED_KEY*/ === existingKey)) {
+ else if ((insertionIndex < (0)) && (const$2 == existingKey)) {
insertionIndex = hash;
}
hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length());
@@ -806,19 +821,19 @@ HashMapImplementation.prototype._probeForAdding = function(key) {
}
HashMapImplementation.prototype._probeForLookup = function(key) {
var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$length());
- var numberOfProbes = 1;
+ var numberOfProbes = (1);
var initialHash = hash;
while (true) {
var existingKey = this._keys.$index(hash);
- if (existingKey == null) return -1;
+ if (existingKey == null) return (-1);
if ($eq(existingKey, key)) return hash;
hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length());
}
}
HashMapImplementation.prototype._ensureCapacity = function() {
- var newNumberOfEntries = this._numberOfEntries + 1;
+ var newNumberOfEntries = this._numberOfEntries + (1);
if (newNumberOfEntries >= this._loadLimit) {
- this._grow(this._keys.get$length() * 2);
+ this._grow(this._keys.get$length() * (2));
return;
}
var capacity = this._keys.get$length();
@@ -829,7 +844,7 @@ HashMapImplementation.prototype._ensureCapacity = function() {
}
}
HashMapImplementation._isPowerOfTwo = function(x) {
- return ((x & (x - 1)) == 0);
+ return ((x & (x - (1))) == (0));
}
HashMapImplementation.prototype._grow = function(newCapacity) {
var capacity = this._keys.get$length();
@@ -838,10 +853,10 @@ HashMapImplementation.prototype._grow = function(newCapacity) {
var oldValues = this._values;
this._keys = new Array(newCapacity);
this._values = new Array(newCapacity);
- for (var i = 0;
+ for (var i = (0);
i < capacity; i++) {
var key = oldKeys.$index(i);
- if (key == null || key === const$2/*HashMapImplementation._DELETED_KEY*/) {
+ if (key == null || key == const$2) {
continue;
}
var value = oldValues.$index(i);
@@ -849,12 +864,12 @@ HashMapImplementation.prototype._grow = function(newCapacity) {
this._keys.$setindex(newIndex, key);
this._values.$setindex(newIndex, value);
}
- this._numberOfDeleted = 0;
+ this._numberOfDeleted = (0);
}
HashMapImplementation.prototype.$setindex = function(key, value) {
this._ensureCapacity();
var index = this._probeForAdding(key);
- if ((this._keys.$index(index) == null) || (this._keys.$index(index) === const$2/*HashMapImplementation._DELETED_KEY*/)) {
+ if ((this._keys.$index(index) == null) || (this._keys.$index(index) == const$2)) {
this._numberOfEntries++;
}
this._keys.$setindex(index, key);
@@ -862,46 +877,46 @@ HashMapImplementation.prototype.$setindex = function(key, value) {
}
HashMapImplementation.prototype.$index = function(key) {
var index = this._probeForLookup(key);
- if (index < 0) return null;
+ if (index < (0)) return null;
return this._values.$index(index);
}
HashMapImplementation.prototype.putIfAbsent = function(key, ifAbsent) {
var index = this._probeForLookup(key);
- if (index >= 0) return this._values.$index(index);
+ if (index >= (0)) return this._values.$index(index);
var value = ifAbsent();
this.$setindex(key, value);
return value;
}
HashMapImplementation.prototype.remove = function(key) {
var index = this._probeForLookup(key);
- if (index >= 0) {
+ if (index >= (0)) {
this._numberOfEntries--;
var value = this._values.$index(index);
this._values.$setindex(index);
- this._keys.$setindex(index, const$2/*HashMapImplementation._DELETED_KEY*/);
+ this._keys.$setindex(index, const$2);
this._numberOfDeleted++;
return value;
}
return null;
}
HashMapImplementation.prototype.isEmpty = function() {
- return this._numberOfEntries == 0;
+ return this._numberOfEntries == (0);
}
HashMapImplementation.prototype.get$length = function() {
return this._numberOfEntries;
}
HashMapImplementation.prototype.forEach = function(f) {
var length = this._keys.get$length();
- for (var i = 0;
+ for (var i = (0);
i < length; i++) {
- if ((this._keys.$index(i) != null) && (this._keys.$index(i) !== const$2/*HashMapImplementation._DELETED_KEY*/)) {
+ if ((this._keys.$index(i) != null) && (this._keys.$index(i) != const$2)) {
f(this._keys.$index(i), this._values.$index(i));
}
}
}
HashMapImplementation.prototype.getKeys = function() {
var list = new Array(this.get$length());
- var i = 0;
+ var i = (0);
this.forEach(function _(key, value) {
list.$setindex(i++, key);
}
@@ -910,7 +925,7 @@ HashMapImplementation.prototype.getKeys = function() {
}
HashMapImplementation.prototype.getValues = function() {
var list = new Array(this.get$length());
- var i = 0;
+ var i = (0);
this.forEach(function _(key, value) {
list.$setindex(i++, value);
}
@@ -918,7 +933,7 @@ HashMapImplementation.prototype.getValues = function() {
return list;
}
HashMapImplementation.prototype.containsKey = function(key) {
- return (this._probeForLookup(key) != -1);
+ return (this._probeForLookup(key) != (-1));
}
HashMapImplementation.prototype.containsKey$1 = HashMapImplementation.prototype.containsKey;
HashMapImplementation.prototype.forEach$1 = function($0) {
@@ -931,36 +946,36 @@ HashMapImplementation.prototype.isEmpty$0 = HashMapImplementation.prototype.isEm
$inherits(HashMapImplementation_E$E, HashMapImplementation);
function HashMapImplementation_E$E() {
// Initializers done
- this._numberOfEntries = 0;
- this._numberOfDeleted = 0;
- this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementation._INITIAL_CAPACITY*/);
- this._keys = new Array(8/*HashMapImplementation._INITIAL_CAPACITY*/);
- this._values = new Array(8/*HashMapImplementation._INITIAL_CAPACITY*/);
+ this._numberOfEntries = (0);
+ this._numberOfDeleted = (0);
+ this._loadLimit = HashMapImplementation._computeLoadLimit((8));
+ this._keys = new Array((8));
+ this._values = new Array((8));
}
HashMapImplementation_E$E._computeLoadLimit = function(capacity) {
- return $truncdiv((capacity * 3), 4);
+ return $truncdiv((capacity * (3)), (4));
}
HashMapImplementation_E$E._firstProbe = function(hashCode, length) {
- return hashCode & (length - 1);
+ return hashCode & (length - (1));
}
HashMapImplementation_E$E._nextProbe = function(currentProbe, numberOfProbes, length) {
- return (currentProbe + numberOfProbes) & (length - 1);
+ return (currentProbe + numberOfProbes) & (length - (1));
}
HashMapImplementation_E$E.prototype._probeForAdding = function(key) {
var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$length());
- var numberOfProbes = 1;
+ var numberOfProbes = (1);
var initialHash = hash;
- var insertionIndex = -1;
+ var insertionIndex = (-1);
while (true) {
var existingKey = this._keys.$index(hash);
if (existingKey == null) {
- if (insertionIndex < 0) return hash;
+ if (insertionIndex < (0)) return hash;
return insertionIndex;
}
else if ($eq(existingKey, key)) {
return hash;
}
- else if ((insertionIndex < 0) && (const$2/*HashMapImplementation._DELETED_KEY*/ === existingKey)) {
+ else if ((insertionIndex < (0)) && (const$2 == existingKey)) {
insertionIndex = hash;
}
hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length());
@@ -968,19 +983,19 @@ HashMapImplementation_E$E.prototype._probeForAdding = function(key) {
}
HashMapImplementation_E$E.prototype._probeForLookup = function(key) {
var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$length());
- var numberOfProbes = 1;
+ var numberOfProbes = (1);
var initialHash = hash;
while (true) {
var existingKey = this._keys.$index(hash);
- if (existingKey == null) return -1;
+ if (existingKey == null) return (-1);
if ($eq(existingKey, key)) return hash;
hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length());
}
}
HashMapImplementation_E$E.prototype._ensureCapacity = function() {
- var newNumberOfEntries = this._numberOfEntries + 1;
+ var newNumberOfEntries = this._numberOfEntries + (1);
if (newNumberOfEntries >= this._loadLimit) {
- this._grow(this._keys.get$length() * 2);
+ this._grow(this._keys.get$length() * (2));
return;
}
var capacity = this._keys.get$length();
@@ -991,7 +1006,7 @@ HashMapImplementation_E$E.prototype._ensureCapacity = function() {
}
}
HashMapImplementation_E$E._isPowerOfTwo = function(x) {
- return ((x & (x - 1)) == 0);
+ return ((x & (x - (1))) == (0));
}
HashMapImplementation_E$E.prototype._grow = function(newCapacity) {
var capacity = this._keys.get$length();
@@ -1000,10 +1015,10 @@ HashMapImplementation_E$E.prototype._grow = function(newCapacity) {
var oldValues = this._values;
this._keys = new Array(newCapacity);
this._values = new Array(newCapacity);
- for (var i = 0;
+ for (var i = (0);
i < capacity; i++) {
var key = oldKeys.$index(i);
- if (key == null || key === const$2/*HashMapImplementation._DELETED_KEY*/) {
+ if (key == null || key == const$2) {
continue;
}
var value = oldValues.$index(i);
@@ -1011,12 +1026,12 @@ HashMapImplementation_E$E.prototype._grow = function(newCapacity) {
this._keys.$setindex(newIndex, key);
this._values.$setindex(newIndex, value);
}
- this._numberOfDeleted = 0;
+ this._numberOfDeleted = (0);
}
HashMapImplementation_E$E.prototype.$setindex = function(key, value) {
this._ensureCapacity();
var index = this._probeForAdding(key);
- if ((this._keys.$index(index) == null) || (this._keys.$index(index) === const$2/*HashMapImplementation._DELETED_KEY*/)) {
+ if ((this._keys.$index(index) == null) || (this._keys.$index(index) == const$2)) {
this._numberOfEntries++;
}
this._keys.$setindex(index, key);
@@ -1024,31 +1039,31 @@ HashMapImplementation_E$E.prototype.$setindex = function(key, value) {
}
HashMapImplementation_E$E.prototype.remove = function(key) {
var index = this._probeForLookup(key);
- if (index >= 0) {
+ if (index >= (0)) {
this._numberOfEntries--;
var value = this._values.$index(index);
this._values.$setindex(index);
- this._keys.$setindex(index, const$2/*HashMapImplementation._DELETED_KEY*/);
+ this._keys.$setindex(index, const$2);
this._numberOfDeleted++;
return value;
}
return null;
}
HashMapImplementation_E$E.prototype.isEmpty = function() {
- return this._numberOfEntries == 0;
+ return this._numberOfEntries == (0);
}
HashMapImplementation_E$E.prototype.forEach = function(f) {
var length = this._keys.get$length();
- for (var i = 0;
+ for (var i = (0);
i < length; i++) {
- if ((this._keys.$index(i) != null) && (this._keys.$index(i) !== const$2/*HashMapImplementation._DELETED_KEY*/)) {
+ if ((this._keys.$index(i) != null) && (this._keys.$index(i) != const$2)) {
f(this._keys.$index(i), this._values.$index(i));
}
}
}
HashMapImplementation_E$E.prototype.getKeys = function() {
var list = new Array(this.get$length());
- var i = 0;
+ var i = (0);
this.forEach(function _(key, value) {
list.$setindex(i++, key);
}
@@ -1056,7 +1071,7 @@ HashMapImplementation_E$E.prototype.getKeys = function() {
return list;
}
HashMapImplementation_E$E.prototype.containsKey = function(key) {
- return (this._probeForLookup(key) != -1);
+ return (this._probeForLookup(key) != (-1));
}
// ********** Code for HashMapImplementation_K$DoubleLinkedQueueEntry_KeyValuePair_K$V **************
$inherits(HashMapImplementation_K$DoubleLinkedQueueEntry_KeyValuePair_K$V, HashMapImplementation);
@@ -1065,18 +1080,18 @@ function HashMapImplementation_K$DoubleLinkedQueueEntry_KeyValuePair_K$V() {}
$inherits(HashMapImplementation_K$V, HashMapImplementation);
function HashMapImplementation_K$V() {
// Initializers done
- this._numberOfEntries = 0;
- this._numberOfDeleted = 0;
- this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementation._INITIAL_CAPACITY*/);
- this._keys = new Array(8/*HashMapImplementation._INITIAL_CAPACITY*/);
- this._values = new Array(8/*HashMapImplementation._INITIAL_CAPACITY*/);
+ this._numberOfEntries = (0);
+ this._numberOfDeleted = (0);
+ this._loadLimit = HashMapImplementation._computeLoadLimit((8));
+ this._keys = new Array((8));
+ this._values = new Array((8));
}
HashMapImplementation_K$V._computeLoadLimit = function(capacity) {
- return $truncdiv((capacity * 3), 4);
+ return $truncdiv((capacity * (3)), (4));
}
-// ********** Code for HashMapImplementation_dart_core_String$EvaluatedValue **************
-$inherits(HashMapImplementation_dart_core_String$EvaluatedValue, HashMapImplementation);
-function HashMapImplementation_dart_core_String$EvaluatedValue() {}
+// ********** Code for HashMapImplementation_dart_core_String$Value **************
+$inherits(HashMapImplementation_dart_core_String$Value, HashMapImplementation);
+function HashMapImplementation_dart_core_String$Value() {}
// ********** Code for HashSetImplementation **************
function HashSetImplementation() {
// Initializers done
@@ -1173,21 +1188,21 @@ $inherits(HashSetImplementation_Type, HashSetImplementation);
function HashSetImplementation_Type() {}
// ********** Code for HashSetIterator **************
function HashSetIterator(set_) {
- this._nextValidIndex = -1;
+ this._nextValidIndex = (-1);
this._entries = set_._backingMap._keys;
// Initializers done
this._advance();
}
HashSetIterator.prototype.hasNext = function() {
if (this._nextValidIndex >= this._entries.get$length()) return false;
- if (this._entries.$index(this._nextValidIndex) === const$2/*HashMapImplementation._DELETED_KEY*/) {
+ if (this._entries.$index(this._nextValidIndex) == const$2) {
Jennifer Messerly 2012/01/09 19:06:54 Nice. I think this actually improves readability.
this._advance();
}
return this._nextValidIndex < this._entries.get$length();
}
HashSetIterator.prototype.next = function() {
if (!this.hasNext()) {
- $throw(const$7/*const NoMoreElementsException()*/);
+ $throw(const$7);
}
var res = this._entries.$index(this._nextValidIndex);
this._advance();
@@ -1196,19 +1211,19 @@ HashSetIterator.prototype.next = function() {
HashSetIterator.prototype._advance = function() {
var length = this._entries.get$length();
var entry;
- var deletedKey = const$2/*HashMapImplementation._DELETED_KEY*/;
+ var deletedKey = const$2;
do {
if (++this._nextValidIndex >= length) break;
entry = this._entries.$index(this._nextValidIndex);
}
- while ((entry == null) || (entry === deletedKey))
+ while ((entry == null) || (entry == deletedKey))
}
HashSetIterator.prototype.hasNext$0 = HashSetIterator.prototype.hasNext;
HashSetIterator.prototype.next$0 = HashSetIterator.prototype.next;
// ********** Code for HashSetIterator_E **************
$inherits(HashSetIterator_E, HashSetIterator);
function HashSetIterator_E(set_) {
- this._nextValidIndex = -1;
+ this._nextValidIndex = (-1);
this._entries = set_._backingMap._keys;
// Initializers done
this._advance();
@@ -1216,12 +1231,12 @@ function HashSetIterator_E(set_) {
HashSetIterator_E.prototype._advance = function() {
var length = this._entries.get$length();
var entry;
- var deletedKey = const$2/*HashMapImplementation._DELETED_KEY*/;
+ var deletedKey = const$2;
do {
if (++this._nextValidIndex >= length) break;
entry = this._entries.$index(this._nextValidIndex);
}
- while ((entry == null) || (entry === deletedKey))
+ while ((entry == null) || (entry == deletedKey))
}
// ********** Code for _DeletedKeySentinel **************
function _DeletedKeySentinel() {
@@ -1272,7 +1287,7 @@ LinkedHashMapImplementation.prototype.putIfAbsent = function(key, ifAbsent) {
}
LinkedHashMapImplementation.prototype.getKeys = function() {
var list = new Array(this.get$length());
- var index = 0;
+ var index = (0);
this._list.forEach(function _(entry) {
list.$setindex(index++, entry.key);
}
@@ -1281,7 +1296,7 @@ LinkedHashMapImplementation.prototype.getKeys = function() {
}
LinkedHashMapImplementation.prototype.getValues = function() {
var list = new Array(this.get$length());
- var index = 0;
+ var index = (0);
this._list.forEach(function _(entry) {
list.$setindex(index++, entry.value);
}
@@ -1301,7 +1316,7 @@ LinkedHashMapImplementation.prototype.get$length = function() {
return this._map.get$length();
}
LinkedHashMapImplementation.prototype.isEmpty = function() {
- return this.get$length() == 0;
+ return this.get$length() == (0);
}
LinkedHashMapImplementation.prototype.containsKey$1 = LinkedHashMapImplementation.prototype.containsKey;
LinkedHashMapImplementation.prototype.forEach$1 = function($0) {
@@ -1397,13 +1412,13 @@ function _DoubleLinkedQueueEntrySentinel() {
this._link(this, this);
}
_DoubleLinkedQueueEntrySentinel.prototype.remove = function() {
- $throw(const$1/*const EmptyQueueException()*/);
+ $throw(const$1);
}
_DoubleLinkedQueueEntrySentinel.prototype._asNonSentinelEntry = function() {
return null;
}
_DoubleLinkedQueueEntrySentinel.prototype.get$element = function() {
- $throw(const$1/*const EmptyQueueException()*/);
+ $throw(const$1);
}
// ********** Code for _DoubleLinkedQueueEntrySentinel_E **************
$inherits(_DoubleLinkedQueueEntrySentinel_E, _DoubleLinkedQueueEntrySentinel);
@@ -1457,7 +1472,7 @@ DoubleLinkedQueue.prototype.lastEntry = function() {
return this._sentinel.previousEntry();
}
DoubleLinkedQueue.prototype.get$length = function() {
- var counter = 0;
+ var counter = (0);
this.forEach(function _(element) {
counter++;
}
@@ -1465,11 +1480,11 @@ DoubleLinkedQueue.prototype.get$length = function() {
return counter;
}
DoubleLinkedQueue.prototype.isEmpty = function() {
- return (this._sentinel._next === this._sentinel);
+ return (this._sentinel._next == this._sentinel);
}
DoubleLinkedQueue.prototype.forEach = function(f) {
var entry = this._sentinel._next;
- while (entry !== this._sentinel) {
+ while (entry != this._sentinel) {
var nextEntry = entry._next;
f(entry._element);
entry = nextEntry;
@@ -1477,7 +1492,7 @@ DoubleLinkedQueue.prototype.forEach = function(f) {
}
DoubleLinkedQueue.prototype.every = function(f) {
var entry = this._sentinel._next;
- while (entry !== this._sentinel) {
+ while (entry != this._sentinel) {
var nextEntry = entry._next;
if (!f(entry._element)) return false;
entry = nextEntry;
@@ -1486,7 +1501,7 @@ DoubleLinkedQueue.prototype.every = function(f) {
}
DoubleLinkedQueue.prototype.some = function(f) {
var entry = this._sentinel._next;
- while (entry !== this._sentinel) {
+ while (entry != this._sentinel) {
var nextEntry = entry._next;
if (f(entry._element)) return true;
entry = nextEntry;
@@ -1496,7 +1511,7 @@ DoubleLinkedQueue.prototype.some = function(f) {
DoubleLinkedQueue.prototype.filter = function(f) {
var other = new DoubleLinkedQueue();
var entry = this._sentinel._next;
- while (entry !== this._sentinel) {
+ while (entry != this._sentinel) {
var nextEntry = entry._next;
if (f(entry._element)) other.addLast(entry._element);
entry = nextEntry;
@@ -1541,7 +1556,7 @@ DoubleLinkedQueue_KeyValuePair_K$V.prototype.lastEntry = function() {
}
DoubleLinkedQueue_KeyValuePair_K$V.prototype.forEach = function(f) {
var entry = this._sentinel._next;
- while (entry !== this._sentinel) {
+ while (entry != this._sentinel) {
var nextEntry = entry._next;
f(entry._element);
entry = nextEntry;
@@ -1554,11 +1569,11 @@ function _DoubleLinkedQueueIterator(_sentinel) {
this._currentEntry = this._sentinel;
}
_DoubleLinkedQueueIterator.prototype.hasNext = function() {
- return this._currentEntry._next !== this._sentinel;
+ return this._currentEntry._next != this._sentinel;
}
_DoubleLinkedQueueIterator.prototype.next = function() {
if (!this.hasNext()) {
- $throw(const$7/*const NoMoreElementsException()*/);
+ $throw(const$7);
}
this._currentEntry = this._currentEntry._next;
return this._currentEntry.get$element();
@@ -1600,12 +1615,12 @@ StopwatchImplementation.prototype.stop = function() {
}
StopwatchImplementation.prototype.elapsed = function() {
if (this._start == null) {
- return 0;
+ return (0);
}
return (this._stop == null) ? (Clock.now() - this._start) : (this._stop - this._start);
}
StopwatchImplementation.prototype.elapsedInMs = function() {
- return $truncdiv((this.elapsed() * 1000), this.frequency());
+ return $truncdiv((this.elapsed() * (1000)), this.frequency());
}
StopwatchImplementation.prototype.frequency = function() {
return Clock.frequency();
@@ -1621,7 +1636,7 @@ StringBufferImpl.prototype.get$length = function() {
return this._length;
}
StringBufferImpl.prototype.isEmpty = function() {
- return this._length == 0;
+ return this._length == (0);
}
StringBufferImpl.prototype.add = function(obj) {
var str = obj.toString();
@@ -1639,12 +1654,12 @@ StringBufferImpl.prototype.addAll = function(objects) {
}
StringBufferImpl.prototype.clear = function() {
this._buffer = new Array();
- this._length = 0;
+ this._length = (0);
return this;
}
StringBufferImpl.prototype.toString = function() {
- if (this._buffer.get$length() == 0) return "";
- if (this._buffer.get$length() == 1) return this._buffer.$index(0);
+ if (this._buffer.get$length() == (0)) return "";
+ if (this._buffer.get$length() == (1)) return this._buffer.$index((0));
var result = StringBase.concatAll(this._buffer);
this._buffer.clear();
this._buffer.add(result);
@@ -1663,9 +1678,9 @@ StringBase.createFromCharCodes = function(charCodes) {
return String.fromCharCode.apply(null, charCodes);
}
StringBase.join = function(strings, separator) {
- if (strings.get$length() == 0) return "";
- var s = strings.$index(0);
- for (var i = 1;
+ if (strings.get$length() == (0)) return "";
+ var s = strings.$index((0));
+ for (var i = (1);
i < strings.get$length(); i++) {
s = s + separator + strings.$index(i);
}
@@ -1688,7 +1703,7 @@ StringImplementation.prototype.startsWith = function(other) {
return other == this.substring(0, other.length);
}
StringImplementation.prototype.isEmpty = function() {
- return this.length == 0;
+ return this.length == (0);
}
StringImplementation.prototype.contains = function(pattern, startIndex) {
'use strict'; return this.indexOf(pattern, startIndex) >= 0;
@@ -1705,7 +1720,7 @@ StringImplementation.prototype.replaceFirst = function(from, to) {
var $$list = from.allMatches(this);
for (var $$i = from.allMatches(this).iterator(); $$i.hasNext$0(); ) {
var match = $$i.next$0();
- return this.substring(0, match.start$0()) + to + this.substring(match.end$0());
+ return this.substring((0), match.start$0()) + to + this.substring(match.end$0());
}
}
StringImplementation.prototype._replaceAll = function(from, to) {
@@ -1718,7 +1733,7 @@ StringImplementation.prototype.replaceAll = function(from, to) {
if ((typeof(from) == 'string')) return this._replaceAll(from, to);
if (!!(from && from.is$RegExp())) return this._replaceRegExp(from.get$dynamic().get$_global(), to);
var buffer = new StringBufferImpl("");
- var lastMatchEnd = 0;
+ var lastMatchEnd = (0);
var $$list = from.allMatches(this);
for (var $$i = from.allMatches(this).iterator(); $$i.hasNext$0(); ) {
var match = $$i.next$0();
@@ -2016,11 +2031,11 @@ function joinPaths(path1, path2) {
var $$list = path2.split("/");
for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
var piece = $$list.$index($$i);
- if ($eq(piece, "..") && pieces.get$length() > 0 && $ne(pieces.last$0(), ".") && $ne(pieces.last$0(), "..")) {
+ if ($eq(piece, "..") && pieces.get$length() > (0) && $ne(pieces.last$0(), ".") && $ne(pieces.last$0(), "..")) {
pieces.removeLast$0();
}
else if ($ne(piece, "")) {
- if (pieces.get$length() > 0 && $eq(pieces.last$0(), ".")) {
+ if (pieces.get$length() > (0) && $eq(pieces.last$0(), ".")) {
pieces.removeLast$0();
}
pieces.add$1(piece);
@@ -2030,20 +2045,20 @@ function joinPaths(path1, path2) {
}
function dirname(path) {
var lastSlash = path.lastIndexOf("/", path.length);
- if (lastSlash == -1) {
+ if (lastSlash == (-1)) {
return ".";
}
else {
- return path.substring(0, lastSlash);
+ return path.substring((0), lastSlash);
}
}
function basename(path) {
var lastSlash = path.lastIndexOf("/", path.length);
- if (lastSlash == -1) {
+ if (lastSlash == (-1)) {
return path;
}
else {
- return path.substring(lastSlash + 1);
+ return path.substring(lastSlash + (1));
}
}
// ********** Library file_system_node **************
@@ -2064,7 +2079,7 @@ NodeFileSystem.prototype.fileExists = function(filename) {
// ********** Library lang **************
// ********** Code for CodeWriter **************
function CodeWriter() {
- this._indentation = 0
+ this._indentation = (0)
this._pendingIndent = false
this.writeComments = true
this._buf = new StringBufferImpl("");
@@ -2075,9 +2090,9 @@ CodeWriter.prototype.get$text = function() {
}
CodeWriter.prototype._indent = function() {
this._pendingIndent = false;
- for (var i = 0;
+ for (var i = (0);
i < this._indentation; i++) {
- this._buf.add(" "/*CodeWriter.INDENTATION*/);
+ this._buf.add(" ");
}
}
CodeWriter.prototype.comment = function(text) {
@@ -2086,15 +2101,15 @@ CodeWriter.prototype.comment = function(text) {
}
}
CodeWriter.prototype.write = function(text) {
- if (text.length == 0) return;
+ if (text.length == (0)) return;
if (this._pendingIndent) this._indent();
- if (text.indexOf("\n") != -1) {
+ if (text.indexOf("\n") != (-1)) {
var lines = text.split("\n");
- for (var i = 0;
- i < lines.get$length() - 1; i++) {
+ for (var i = (0);
+ i < lines.get$length() - (1); i++) {
this.writeln(lines.$index(i));
}
- this.write(lines.$index(lines.get$length() - 1));
+ this.write(lines.$index(lines.get$length() - (1)));
}
else {
this._buf.add(text);
@@ -2104,7 +2119,7 @@ CodeWriter.prototype.writeln = function(text) {
if (text != null) {
this.write(text);
}
- if (!text.endsWith("\n")) this._buf.add("\n"/*CodeWriter.NEWLINE*/);
+ if (!text.endsWith("\n")) this._buf.add("\n");
this._pendingIndent = true;
}
CodeWriter.prototype.enterBlock = function(text) {
@@ -2143,38 +2158,38 @@ CoreJs.prototype.useOperator = function(name) {
switch (name) {
case ":ne":
- code = "function $ne(x, y) {\n if (x == null) return y != null;\n return (typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'boolean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(y) == 'string')\n ? x != y : !x.$eq(y);\n}"/*null._NE_FUNCTION*/;
+ code = "function $ne(x, y) {\n if (x == null) return y != null;\n return (typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'boolean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(y) == 'string')\n ? x != y : !x.$eq(y);\n}";
break;
case ":eq":
- code = "function $eq(x, y) {\n if (x == null) return y == null;\n return (typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'boolean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(y) == 'string')\n ? x == y : x.$eq(y);\n}\n// TODO(jimhug): Should this or should it not match equals?\nObject.prototype.$eq = function(other) { return this === other; }"/*null._EQ_FUNCTION*/;
+ code = "function $eq(x, y) {\n if (x == null) return y == null;\n return (typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'boolean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(y) == 'string')\n ? x == y : x.$eq(y);\n}\n// TODO(jimhug): Should this or should it not match equals?\nObject.prototype.$eq = function(other) { return this === other; }";
break;
case ":bit_not":
- code = "function $bit_not(x) {\n return (typeof(x) == 'number') ? ~x : x.$bit_not();\n}"/*null._BIT_NOT_FUNCTION*/;
+ code = "function $bit_not(x) {\n return (typeof(x) == 'number') ? ~x : x.$bit_not();\n}";
break;
case ":negate":
- code = "function $negate(x) {\n return (typeof(x) == 'number') ? -x : x.$negate();\n}"/*null._NEGATE_FUNCTION*/;
+ code = "function $negate(x) {\n return (typeof(x) == 'number') ? -x : x.$negate();\n}";
break;
case ":add":
- code = "function $add(x, y) {\n return ((typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'string'))\n ? x + y : x.$add(y);\n}"/*null._ADD_FUNCTION*/;
+ code = "function $add(x, y) {\n return ((typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'string'))\n ? x + y : x.$add(y);\n}";
break;
case ":truncdiv":
this.useThrow = true;
- code = "function $truncdiv(x, y) {\n if (typeof(x) == 'number' && typeof(y) == 'number') {\n if (y == 0) $throw(new IntegerDivisionByZeroException());\n var tmp = x / y;\n return (tmp < 0) ? Math.ceil(tmp) : Math.floor(tmp);\n } else {\n return x.$truncdiv(y);\n }\n}"/*null._TRUNCDIV_FUNCTION*/;
+ code = "function $truncdiv(x, y) {\n if (typeof(x) == 'number' && typeof(y) == 'number') {\n if (y == 0) $throw(new IntegerDivisionByZeroException());\n var tmp = x / y;\n return (tmp < 0) ? Math.ceil(tmp) : Math.floor(tmp);\n } else {\n return x.$truncdiv(y);\n }\n}";
break;
case ":mod":
- code = "function $mod(x, y) {\n if (typeof(x) == 'number' && typeof(y) == 'number') {\n var result = x % y;\n if (result == 0) {\n return 0; // Make sure we don't return -0.0.\n } else if (result < 0) {\n if (y < 0) {\n return result - y;\n } else {\n return result + y;\n }\n }\n return result;\n } else {\n return x.$mod(y);\n }\n}"/*null._MOD_FUNCTION*/;
+ code = "function $mod(x, y) {\n if (typeof(x) == 'number' && typeof(y) == 'number') {\n var result = x % y;\n if (result == 0) {\n return 0; // Make sure we don't return -0.0.\n } else if (result < 0) {\n if (y < 0) {\n return result - y;\n } else {\n return result + y;\n }\n }\n return result;\n } else {\n return x.$mod(y);\n }\n}";
break;
default:
@@ -2191,49 +2206,49 @@ CoreJs.prototype.ensureDynamicProto = function() {
if (this._generatedDynamicProto) return;
this._generatedDynamicProto = true;
this.ensureTypeNameOf();
- this.writer.writeln("function $dynamic(name) {\n var f = Object.prototype[name];\n if (f && f.methods) return f.methods;\n\n var methods = {};\n if (f) methods.Object = f;\n function $dynamicBind() {\n // Find the target method\n var obj = this;\n var tag = obj.$typeNameOf();\n var method = methods[tag];\n if (!method) {\n var table = $dynamicMetadata;\n for (var i = 0; i < table.length; i++) {\n var entry = table[i];\n if (entry.map.hasOwnProperty(tag)) {\n method = methods[entry.tag];\n if (method) break;\n }\n }\n }\n method = method || methods.Object;\n // Patch the prototype, but don't overwrite an existing stub, like\n // the one on Object.prototype.\n var proto = Object.getPrototypeOf(obj);\n if (!proto.hasOwnProperty(name)) proto[name] = method;\n\n return method.apply(this, Array.prototype.slice.call(arguments));\n };\n $dynamicBind.methods = methods;\n Object.prototype[name] = $dynamicBind;\n return methods;\n}\nif (typeof $dynamicMetadata == 'undefined') $dynamicMetadata = [];\n\nfunction $dynamicSetMetadata(inputTable) {\n // TODO: Deal with light isolates.\n var table = [];\n for (var i = 0; i < inputTable.length; i++) {\n var tag = inputTable[i][0];\n var tags = inputTable[i][1];\n var map = {};\n var tagNames = tags.split('|');\n for (var j = 0; j < tagNames.length; j++) {\n map[tagNames[j]] = true;\n }\n table.push({tag: tag, tags: tags, map: map});\n }\n $dynamicMetadata = table;\n}\n"/*null._DYNAMIC_FUNCTION*/);
+ this.writer.writeln("function $dynamic(name) {\n var f = Object.prototype[name];\n if (f && f.methods) return f.methods;\n\n var methods = {};\n if (f) methods.Object = f;\n function $dynamicBind() {\n // Find the target method\n var obj = this;\n var tag = obj.$typeNameOf();\n var method = methods[tag];\n if (!method) {\n var table = $dynamicMetadata;\n for (var i = 0; i < table.length; i++) {\n var entry = table[i];\n if (entry.map.hasOwnProperty(tag)) {\n method = methods[entry.tag];\n if (method) break;\n }\n }\n }\n method = method || methods.Object;\n // Patch the prototype, but don't overwrite an existing stub, like\n // the one on Object.prototype.\n var proto = Object.getPrototypeOf(obj);\n if (!proto.hasOwnProperty(name)) proto[name] = method;\n\n return method.apply(this, Array.prototype.slice.call(arguments));\n };\n $dynamicBind.methods = methods;\n Object.prototype[name] = $dynamicBind;\n return methods;\n}\nif (typeof $dynamicMetadata == 'undefined') $dynamicMetadata = [];\n\nfunction $dynamicSetMetadata(inputTable) {\n // TODO: Deal with light isolates.\n var table = [];\n for (var i = 0; i < inputTable.length; i++) {\n var tag = inputTable[i][0];\n var tags = inputTable[i][1];\n var map = {};\n var tagNames = tags.split('|');\n for (var j = 0; j < tagNames.length; j++) {\n map[tagNames[j]] = true;\n }\n table.push({tag: tag, tags: tags, map: map});\n }\n $dynamicMetadata = table;\n}\n");
}
CoreJs.prototype.ensureTypeNameOf = function() {
if (this._generatedTypeNameOf) return;
this._generatedTypeNameOf = true;
- this.writer.writeln("Object.prototype.$typeNameOf = function() {\n if ((typeof(window) != 'undefined' && window.constructor.name == 'DOMWindow')\n || typeof(process) != 'undefined') { // fast-path for Chrome and Node\n return this.constructor.name;\n }\n var str = Object.prototype.toString.call(this);\n str = str.substring(8, str.length - 1);\n if (str == 'Window') {\n str = 'DOMWindow';\n } else if (str == 'Document') {\n str = 'HTMLDocument';\n }\n return str;\n}"/*null._TYPE_NAME_OF_FUNCTION*/);
+ this.writer.writeln("Object.prototype.$typeNameOf = function() {\n if ((typeof(window) != 'undefined' && window.constructor.name == 'DOMWindow')\n || typeof(process) != 'undefined') { // fast-path for Chrome and Node\n return this.constructor.name;\n }\n var str = Object.prototype.toString.call(this);\n str = str.substring(8, str.length - 1);\n if (str == 'Window') {\n str = 'DOMWindow';\n } else if (str == 'Document') {\n str = 'HTMLDocument';\n }\n return str;\n}");
}
CoreJs.prototype.ensureInheritsHelper = function() {
if (this._generatedInherits) return;
this._generatedInherits = true;
- this.writer.writeln("/** Implements extends for Dart classes on JavaScript prototypes. */\nfunction $inherits(child, parent) {\n if (child.prototype.__proto__) {\n child.prototype.__proto__ = parent.prototype;\n } else {\n function tmp() {};\n tmp.prototype = parent.prototype;\n child.prototype = new tmp();\n child.prototype.constructor = child;\n }\n}"/*null._INHERITS_FUNCTION*/);
+ this.writer.writeln("/** Implements extends for Dart classes on JavaScript prototypes. */\nfunction $inherits(child, parent) {\n if (child.prototype.__proto__) {\n child.prototype.__proto__ = parent.prototype;\n } else {\n function tmp() {};\n tmp.prototype = parent.prototype;\n child.prototype = new tmp();\n child.prototype.constructor = child;\n }\n}");
}
CoreJs.prototype.generate = function(w) {
w.write(this.writer.get$text());
this.writer = w;
if (this.useNotNullBool) {
this.useThrow = true;
- w.writeln("function $notnull_bool(test) {\n if (test === true || test === false) return test;\n $throw(new TypeError(test, 'bool'));\n}"/*null._NOTNULL_BOOL_FUNCTION*/);
+ w.writeln("function $notnull_bool(test) {\n if (test === true || test === false) return test;\n $throw(new TypeError(test, 'bool'));\n}");
}
if (this.useThrow) {
- w.writeln("function $throw(e) {\n // If e is not a value, we can use V8's captureStackTrace utility method.\n // TODO(jmesserly): capture the stack trace on other JS engines.\n if (e && (typeof e == 'object') && Error.captureStackTrace) {\n // TODO(jmesserly): this will clobber the e.stack property\n Error.captureStackTrace(e, $throw);\n }\n throw e;\n}"/*null._THROW_FUNCTION*/);
+ w.writeln("function $throw(e) {\n // If e is not a value, we can use V8's captureStackTrace utility method.\n // TODO(jmesserly): capture the stack trace on other JS engines.\n if (e && (typeof e == 'object') && Error.captureStackTrace) {\n // TODO(jmesserly): this will clobber the e.stack property\n Error.captureStackTrace(e, $throw);\n }\n throw e;\n}");
}
if (this.useIndex) {
- w.writeln("Object.prototype.$index = function(i) {\n var proto = Object.getPrototypeOf(this);\n if (proto !== Object) {\n proto.$index = function(i) { return this[i]; }\n }\n return this[i];\n}\nArray.prototype.$index = function(i) { return this[i]; }\nString.prototype.$index = function(i) { return this[i]; }"/*null._INDEX_OPERATORS*/);
+ w.writeln("Object.prototype.$index = function(i) {\n var proto = Object.getPrototypeOf(this);\n if (proto !== Object) {\n proto.$index = function(i) { return this[i]; }\n }\n return this[i];\n}\nArray.prototype.$index = function(i) { return this[i]; }\nString.prototype.$index = function(i) { return this[i]; }");
}
if (this.useSetIndex) {
- w.writeln("Object.prototype.$setindex = function(i, value) {\n var proto = Object.getPrototypeOf(this);\n if (proto !== Object) {\n proto.$setindex = function(i, value) { return this[i] = value; }\n }\n return this[i] = value;\n}\nArray.prototype.$setindex = function(i, value) { return this[i] = value; }"/*null._SETINDEX_OPERATORS*/);
+ w.writeln("Object.prototype.$setindex = function(i, value) {\n var proto = Object.getPrototypeOf(this);\n if (proto !== Object) {\n proto.$setindex = function(i, value) { return this[i] = value; }\n }\n return this[i] = value;\n}\nArray.prototype.$setindex = function(i, value) { return this[i] = value; }");
}
if (this.useIsolates) {
if (this.useWrap0) {
- w.writeln("// Wrap a 0-arg dom-callback to bind it with the current isolate:\nfunction $wrap_call$0(fn) { return fn && fn.wrap$call$0(); }\nFunction.prototype.wrap$call$0 = function() {\n var isolateContext = $globalState.currentContext;\n var self = this;\n this.wrap$0 = function() {\n isolateContext.eval(self);\n $globalState.topEventLoop.run();\n };\n this.wrap$call$0 = function() { return this.wrap$0; };\n return this.wrap$0;\n}"/*null._WRAP_CALL0_FUNCTION*/);
+ w.writeln("// Wrap a 0-arg dom-callback to bind it with the current isolate:\nfunction $wrap_call$0(fn) { return fn && fn.wrap$call$0(); }\nFunction.prototype.wrap$call$0 = function() {\n var isolateContext = $globalState.currentContext;\n var self = this;\n this.wrap$0 = function() {\n isolateContext.eval(self);\n $globalState.topEventLoop.run();\n };\n this.wrap$call$0 = function() { return this.wrap$0; };\n return this.wrap$0;\n}");
}
if (this.useWrap1) {
- w.writeln("// Wrap a 1-arg dom-callback to bind it with the current isolate:\nfunction $wrap_call$1(fn) { return fn && fn.wrap$call$1(); }\nFunction.prototype.wrap$call$1 = function() {\n var isolateContext = $globalState.currentContext;\n var self = this;\n this.wrap$1 = function(arg) {\n isolateContext.eval(function() { self(arg); });\n $globalState.topEventLoop.run();\n };\n this.wrap$call$1 = function() { return this.wrap$1; };\n return this.wrap$1;\n}"/*null._WRAP_CALL1_FUNCTION*/);
+ w.writeln("// Wrap a 1-arg dom-callback to bind it with the current isolate:\nfunction $wrap_call$1(fn) { return fn && fn.wrap$call$1(); }\nFunction.prototype.wrap$call$1 = function() {\n var isolateContext = $globalState.currentContext;\n var self = this;\n this.wrap$1 = function(arg) {\n isolateContext.eval(function() { self(arg); });\n $globalState.topEventLoop.run();\n };\n this.wrap$call$1 = function() { return this.wrap$1; };\n return this.wrap$1;\n}");
}
- w.writeln("var $globalThis = this;\nvar $globals = null;\nvar $globalState = null;"/*null._ISOLATE_INIT_CODE*/);
+ w.writeln("var $globalThis = this;\nvar $globals = null;\nvar $globalState = null;");
}
else {
if (this.useWrap0) {
- w.writeln("function $wrap_call$0(fn) { return fn; }"/*null._EMPTY_WRAP_CALL0_FUNCTION*/);
+ w.writeln("function $wrap_call$0(fn) { return fn; }");
}
if (this.useWrap1) {
- w.writeln("function $wrap_call$1(fn) { return fn; }"/*null._EMPTY_WRAP_CALL1_FUNCTION*/);
+ w.writeln("function $wrap_call$1(fn) { return fn; }");
}
}
var $$list = orderValuesByKeys(this._usedOperators);
@@ -2280,7 +2295,7 @@ Element.prototype.get$avoidNativeName = function() {
return false;
}
Element.prototype.get$jsnamePriority = function() {
- return this.get$isNative() ? 2 : (this.get$library().get$isCore() ? 1 : 0);
+ return this.get$isNative() ? (2) : (this.get$library().get$isCore() ? (1) : (0));
}
Element.prototype.resolve = function() {
@@ -2332,7 +2347,7 @@ Element.prototype.resolveType = function(node, typeErrors) {
return null;
}
var typeArgs = [];
- for (var i = 0;
+ for (var i = (0);
i < typeRef.typeArguments.get$length(); i++) {
typeArgs.add$1(this.resolveType(typeRef.typeArguments.$index(i), typeErrors));
}
@@ -2378,7 +2393,7 @@ WorldGenerator.prototype.run = function() {
this.genMethod($globals.world.coreimpl.types.$index("EventLoop").getMember$1("run"));
}
this.corejs.useIsolates = true;
- var isolateMain = $globals.world.coreimpl.topType.resolveMember("startRootIsolate").members.$index(0);
+ var isolateMain = $globals.world.coreimpl.topType.resolveMember("startRootIsolate").members.$index((0));
var isolateMainTarget = new Value.type$ctor($globals.world.coreimpl.topType, this.main.get$span());
mainCall = isolateMain.invoke(metaGen, null, isolateMainTarget, new Arguments(null, [this.main._get(metaGen, this.main.definition, null, false)]), false);
}
@@ -2441,20 +2456,25 @@ WorldGenerator.prototype.getAllTypes = function(libs) {
}
return types;
}
-WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, dependencies) {
+WorldGenerator.prototype.globalForStaticField = function(field, exp, dependencies) {
this.hasStatics = true;
- var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname());
- if (!this.globals.containsKey(fullname)) {
- this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory(field, fieldValue, dependencies));
+ var key = ("" + field.declaringType.get$jsname() + "." + field.get$jsname());
+ var ret = this.globals.$index(key);
+ if (ret == null) {
+ ret = new GlobalValue(exp.get$type(), exp.get$code(), field.isFinal, field, null, exp, exp.span, dependencies);
+ this.globals.$setindex(key, ret);
}
- return this.globals.$index(fullname);
+ return ret;
}
WorldGenerator.prototype.globalForConst = function(exp, dependencies) {
- var key = exp.get$type().get$jsname() + ":" + exp.canonicalCode;
- if (!this.globals.containsKey(key)) {
- this.globals.$setindex(key, GlobalValue.GlobalValue$fromConst$factory(this.globals.get$length(), exp, dependencies));
+ var key = exp.get$type().get$jsname() + ":" + exp.get$code();
+ var ret = this.globals.$index(key);
+ if (ret == null) {
+ var name = ("const$" + this.globals.get$length());
+ ret = new GlobalValue(exp.get$type(), name, true, null, name, exp, exp.span, dependencies);
+ this.globals.$setindex(key, ret);
}
- return this.globals.$index(key);
+ return ret;
}
WorldGenerator.prototype.writeTypes = function(lib) {
if (lib.isWritten) return;
@@ -2464,7 +2484,7 @@ WorldGenerator.prototype.writeTypes = function(lib) {
var import_ = $$list.$index($$i);
this.writeTypes(import_.get$library());
}
- for (var i = 0;
+ for (var i = (0);
i < lib.sources.get$length(); i++) {
lib.sources.$index(i).set$orderInLibrary(i);
}
@@ -2494,7 +2514,7 @@ WorldGenerator.prototype.writeTypes = function(lib) {
}
}
}
- else if (type.get$isFunction() && type.get$varStubs().get$length() > 0) {
+ else if (type.get$isFunction() && type.get$varStubs().get$length() > (0)) {
this.writer.comment(("// ********** Code for " + type.get$jsname() + " **************"));
this._writeDynamicStubs(type);
}
@@ -2586,7 +2606,7 @@ WorldGenerator.prototype.writeType = function(type) {
}
if (type.get$isTop()) {
}
- else if (type.get$constructors().get$length() == 0) {
+ else if (type.get$constructors().get$length() == (0)) {
if (!type.get$isNative()) {
this.writer.writeln(("function " + type.get$jsname() + "() {}"));
}
@@ -2738,7 +2758,7 @@ WorldGenerator.prototype.get$_writeMethod = function() {
return this._writeMethod.bind(this);
}
WorldGenerator.prototype.writeGlobals = function() {
- if (this.globals.get$length() > 0) {
+ if (this.globals.get$length() > (0)) {
this.writer.comment("// ********** Globals **************");
var list = this.globals.getValues();
list.sort$1((function (a, b) {
@@ -2764,7 +2784,7 @@ WorldGenerator.prototype.writeGlobals = function() {
if (this.hasStatics) {
this.writer.writeln("var $globals = {};");
}
- if (this.globals.get$length() > 0) {
+ if (this.globals.get$length() > (0)) {
this.writer.writeln("$static_init();");
}
}
@@ -2837,8 +2857,8 @@ WorldGenerator.prototype.writeDynamicDispatchMetadata = function() {
var constantPart = ("'" + Strings.join(subtags, "|") + "'");
if ($ne(constantPart, "''")) expressions.add$1(constantPart);
var expression;
- if ($eq(expressions.get$length(), 1)) {
- expression = expressions.$index(0);
+ if ($eq(expressions.get$length(), (1))) {
+ expression = expressions.$index((0));
}
else {
expression = ("[" + Strings.join(expressions, ",") + "].join('|')");
@@ -2879,10 +2899,10 @@ WorldGenerator.prototype._orderCollectionValues = function(collection) {
WorldGenerator.prototype._compareMembers = function(x, y) {
if (x.get$span() != null && y.get$span() != null) {
var spans = x.get$span().compareTo$1(y.get$span());
- if (spans != 0) return spans;
+ if (spans != (0)) return spans;
}
- if (x.get$span() == null) return 1;
- if (y.get$span() == null) return -1;
+ if (x.get$span() == null) return (1);
+ if (y.get$span() == null) return (-1);
return x.get$name().compareTo$1(y.get$name());
}
WorldGenerator.prototype.get$_compareMembers = function() {
@@ -2960,7 +2980,7 @@ BlockScope.prototype.create = function(name, type, span, isFinal, isParameter) {
$globals.world.error(("duplicate name \"" + name + "\""), span);
}
if (!isParameter) {
- var index = 0;
+ var index = (0);
while (this._isDefinedInParent(jsName)) {
jsName = ("" + name + (index++));
}
@@ -3025,7 +3045,7 @@ MethodGenerator.prototype.getTemp = function(value) {
}
MethodGenerator.prototype.forceTemp = function(value) {
var name;
- if (this._freeTemps.get$length() > 0) {
+ if (this._freeTemps.get$length() > (0)) {
name = this._freeTemps.removeLast();
}
else {
@@ -3039,15 +3059,15 @@ MethodGenerator.prototype.assignTemp = function(tmp, v) {
return v;
}
else {
- return new Value(v.get$type(), ("(" + tmp.code + " = " + v.code + ")"), v.span, true);
+ return new Value(v.get$type(), ("(" + tmp.get$code() + " = " + v.get$code() + ")"), v.span, true);
}
}
MethodGenerator.prototype.freeTemp = function(value) {
- if (this._usedTemps.remove(value.code)) {
- this._freeTemps.add(value.code);
+ if (this._usedTemps.remove(value.get$code())) {
+ this._freeTemps.add(value.get$code());
}
else {
- $globals.world.internalError(("tried to free unused value or non-temp \"" + value.code + "\""));
+ $globals.world.internalError(("tried to free unused value or non-temp \"" + value.get$code() + "\""));
}
}
MethodGenerator.prototype.run = function() {
@@ -3072,7 +3092,7 @@ MethodGenerator.prototype.run = function() {
MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) {
var paramCode = this._paramCode;
var names = null;
- if (this.captures != null && this.captures.get$length() > 0) {
+ if (this.captures != null && this.captures.get$length() > (0)) {
names = ListFactory.ListFactory$from$factory(this.captures);
names.sort$1((function (x, y) {
return x.compareTo$1(y);
@@ -3122,7 +3142,7 @@ MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) {
if (this.needsThis) {
defWriter.writeln("var $this = this; // closure support");
}
- if (this._usedTemps.get$length() > 0 || this._freeTemps.get$length() > 0) {
+ if (this._usedTemps.get$length() > (0) || this._freeTemps.get$length() > (0)) {
this._freeTemps.addAll(this._usedTemps);
this._freeTemps.sort((function (x, y) {
return x.compareTo$1(y);
@@ -3173,7 +3193,7 @@ MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) {
optValues.add$1(MethodGenerator._escapeString(param.get$value().get$code()));
}
}
- if (optNames.get$length() > 0) {
+ if (optNames.get$length() > (0)) {
var start = "";
if (meth.isStatic) {
if (!meth.declaringType.get$isTop()) {
@@ -3251,7 +3271,7 @@ MethodGenerator.prototype.writeBody = function() {
}
initializerCall = init;
}
- else if ((init instanceof BinaryExpression) && TokenKind.kindFromAssign(init.get$op().get$kind()) == 0) {
+ else if ((init instanceof BinaryExpression) && TokenKind.kindFromAssign(init.get$op().get$kind()) == (0)) {
var left = init.get$x();
if (!((left instanceof DotExpression) && (left.get$self() instanceof ThisExpression) || (left instanceof VarExpression))) {
$globals.world.error("invalid left side of initializer", left.get$span());
@@ -3285,7 +3305,7 @@ MethodGenerator.prototype.writeBody = function() {
if (initializerCall != null) {
var target = this._writeInitializerCall(initializerCall);
if (!target.get$isSuper()) {
- if (initializers.get$length() > 0) {
+ if (initializers.get$length() > (0)) {
var $$list = this.method.get$parameters();
for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
var p = $$list.$index($$i);
@@ -3295,8 +3315,8 @@ MethodGenerator.prototype.writeBody = function() {
}
}
}
- if (declaredInitializers != null && declaredInitializers.get$length() > 1) {
- var init = $eq(declaredInitializers.$index(0), initializerCall) ? declaredInitializers.$index(1) : declaredInitializers.$index(0);
+ if (declaredInitializers != null && declaredInitializers.get$length() > (1)) {
+ var init = $eq(declaredInitializers.$index((0)), initializerCall) ? declaredInitializers.$index((1)) : declaredInitializers.$index((0));
$globals.world.error("no initialization allowed on redirecting constructors", init.get$span());
}
initializedFields = null;
@@ -3368,7 +3388,7 @@ MethodGenerator.prototype._makeArgs = function(arguments) {
}
MethodGenerator.prototype._invokeNative = function(name, arguments) {
var args = Arguments.get$EMPTY();
- if (arguments.get$length() > 0) {
+ if (arguments.get$length() > (0)) {
args = new Arguments(null, arguments);
}
var method = $globals.world.corelib.topType.members.$index(name);
@@ -3437,15 +3457,15 @@ MethodGenerator.prototype.visitDietStatement = function(node) {
}
MethodGenerator.prototype.visitVariableDefinition = function(node) {
var isFinal = false;
- if (node.modifiers != null && $eq(node.modifiers.$index(0).get$kind(), 98/*TokenKind.FINAL*/)) {
+ if (node.modifiers != null && $eq(node.modifiers.$index((0)).get$kind(), (98))) {
isFinal = true;
}
this.writer.write("var ");
var type = this.method.resolveType(node.type, false);
- for (var i = 0;
+ for (var i = (0);
i < node.names.get$length(); i++) {
var thisType = type;
- if (i > 0) {
+ if (i > (0)) {
this.writer.write(", ");
}
var name = node.names.$index(i).get$name();
@@ -3517,8 +3537,8 @@ MethodGenerator.prototype.visitAssertStatement = function(node) {
var test = this.visitValue(node.test);
if ($globals.options.enableAsserts) {
var span = node.test.span;
- var line = span.get$file().getLine$1(span.get$start()) + 1;
- var column = span.get$file().getColumn$2(line - 1, span.get$start()) + 1;
+ var line = span.get$file().getLine$1(span.get$start()) + (1);
+ var column = span.get$file().getColumn$2(line - (1), span.get$start()) + (1);
var args = [test, Value.fromString(span.get$text(), node.span), Value.fromString(span.get$file().get$filename(), node.span), Value.fromInt(line, node.span), Value.fromInt(column, node.span)];
var tp = $globals.world.corelib.topType;
var f = tp.getMember$1("_assert");
@@ -3618,7 +3638,7 @@ MethodGenerator.prototype.visitForInStatement = function(node) {
var listVar = list;
if (list.get$needsTemp()) {
listVar = this._scope.create("$list", list.get$type(), null, false, false);
- this.writer.writeln(("var " + listVar.code + " = " + list.get$code() + ";"));
+ this.writer.writeln(("var " + listVar.get$code() + " = " + list.get$code() + ";"));
}
if (list.get$type().get$isList()) {
var tmpi = this._scope.create("$i", $globals.world.numType, null, false, false);
@@ -3642,19 +3662,19 @@ MethodGenerator.prototype.visitForInStatement = function(node) {
}
MethodGenerator.prototype._genToDartException = function(ex) {
var result = this._invokeNative("_toDartException", [ex]);
- this.writer.writeln(("" + ex.code + " = " + result.get$code() + ";"));
+ this.writer.writeln(("" + ex.get$code() + " = " + result.get$code() + ";"));
}
MethodGenerator.prototype._genStackTraceOf = function(trace, ex) {
var result = this._invokeNative("_stackTraceOf", [ex]);
- this.writer.writeln(("var " + trace.code + " = " + result.get$code() + ";"));
+ this.writer.writeln(("var " + trace.get$code() + " = " + result.get$code() + ";"));
}
MethodGenerator.prototype.visitTryStatement = function(node) {
this.writer.enterBlock("try {");
this._pushBlock(false);
this.visitStatementsInBlock(node.body);
this._popBlock();
- if (node.catches.get$length() == 1) {
- var catch_ = node.catches.$index(0);
+ if (node.catches.get$length() == (1)) {
+ var catch_ = node.catches.$index((0));
this._pushBlock(false);
var exType = this.method.resolveType(catch_.get$exception().get$type(), false);
var ex = this._scope.declare(catch_.get$exception());
@@ -3669,10 +3689,10 @@ MethodGenerator.prototype.visitTryStatement = function(node) {
var test = ex.instanceOf$3$isTrue$forceCheck(this, exType, catch_.get$exception().get$span(), false, true);
this.writer.writeln(("if (" + test.get$code() + ") throw " + ex.get$code() + ";"));
}
- this.visitStatementsInBlock(node.catches.$index(0).get$body());
+ this.visitStatementsInBlock(node.catches.$index((0)).get$body());
this._popBlock();
}
- else if (node.catches.get$length() > 0) {
+ else if (node.catches.get$length() > (0)) {
this._pushBlock(false);
var ex = this._scope.create("$ex", $globals.world.varType, null, false, false);
this._scope.rethrow = ex;
@@ -3687,7 +3707,7 @@ MethodGenerator.prototype.visitTryStatement = function(node) {
}
this._genToDartException(ex);
var needsRethrow = true;
- for (var i = 0;
+ for (var i = (0);
i < node.catches.get$length(); i++) {
var catch_ = node.catches.$index(i);
this._pushBlock(false);
@@ -3695,14 +3715,14 @@ MethodGenerator.prototype.visitTryStatement = function(node) {
var tmp = this._scope.declare(catch_.get$exception());
if (!tmpType.get$isVarOrObject()) {
var test = ex.instanceOf$3$isTrue$forceCheck(this, tmpType, catch_.get$exception().get$span(), true, true);
- if (i == 0) {
+ if (i == (0)) {
this.writer.enterBlock(("if (" + test.get$code() + ") {"));
}
else {
this.writer.nextBlock(("} else if (" + test.get$code() + ") {"));
}
}
- else if (i > 0) {
+ else if (i > (0)) {
this.writer.nextBlock("} else {");
}
this.writer.writeln(("var " + tmp.get$code() + " = " + ex.get$code() + ";"));
@@ -3713,10 +3733,10 @@ MethodGenerator.prototype.visitTryStatement = function(node) {
this.visitStatementsInBlock(catch_.get$body());
this._popBlock();
if (tmpType.get$isVarOrObject()) {
- if (i + 1 < node.catches.get$length()) {
- $globals.world.error("Unreachable catch clause", node.catches.$index(i + 1).get$span());
+ if (i + (1) < node.catches.get$length()) {
+ $globals.world.error("Unreachable catch clause", node.catches.$index(i + (1)).get$span());
}
- if (i > 0) {
+ if (i > (0)) {
this.writer.exitBlock("}");
}
needsRethrow = false;
@@ -3749,11 +3769,11 @@ MethodGenerator.prototype.visitSwitchStatement = function(node) {
$globals.world.error("unimplemented: labeled case statement", case_.get$span());
}
this._pushBlock(false);
- for (var i = 0;
+ for (var i = (0);
i < case_.get$cases().get$length(); i++) {
var expr = case_.get$cases().$index(i);
if (expr == null) {
- if (i < case_.get$cases().get$length() - 1) {
+ if (i < case_.get$cases().get$length() - (1)) {
$globals.world.error("default clause must be the last case", case_.get$span());
}
this.writer.writeln("default:");
@@ -3765,8 +3785,8 @@ MethodGenerator.prototype.visitSwitchStatement = function(node) {
}
this.writer.enterBlock("");
var caseExits = this._visitAllStatements(case_.get$statements(), false);
- if ($ne(case_, node.cases.$index(node.cases.get$length() - 1)) && !caseExits) {
- var span = case_.get$statements().$index(case_.get$statements().get$length() - 1).get$span();
+ if ($ne(case_, node.cases.$index(node.cases.get$length() - (1))) && !caseExits) {
+ var span = case_.get$statements().$index(case_.get$statements().get$length() - (1)).get$span();
this.writer.writeln("$throw(new FallThroughError());");
$globals.world.gen.corejs.useThrow = true;
}
@@ -3777,12 +3797,12 @@ MethodGenerator.prototype.visitSwitchStatement = function(node) {
return false;
}
MethodGenerator.prototype._visitAllStatements = function(statementList, exits) {
- for (var i = 0;
+ for (var i = (0);
i < statementList.get$length(); i++) {
var stmt = statementList.$index(i);
exits = stmt.visit$1(this);
- if ($ne(stmt, statementList.$index(statementList.get$length() - 1)) && exits) {
- $globals.world.warning("unreachable code", statementList.$index(i + 1).get$span());
+ if ($ne(stmt, statementList.$index(statementList.get$length() - (1))) && exits) {
+ $globals.world.warning("unreachable code", statementList.$index(i + (1)).get$span());
}
}
return exits;
@@ -3874,12 +3894,7 @@ MethodGenerator.prototype.visitCallExpression = function(node) {
var name = ":call";
if ((node.target instanceof DotExpression)) {
var dot = node.target;
- if ((dot.self instanceof LiteralExpression)) {
- target = (new ParenExpression(dot.self, dot.self.span)).visit(this);
- }
- else {
- target = dot.self.visit(this);
- }
+ target = dot.self.visit(this);
name = dot.name.name;
position = dot.name;
}
@@ -3908,48 +3923,23 @@ MethodGenerator.prototype._expressionNeedsParens = function(e) {
}
MethodGenerator.prototype.visitBinaryExpression = function(node, isVoid) {
var kind = node.op.kind;
- if (kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/) {
+ if (kind == (35) || kind == (34)) {
var x = this.visitTypedValue(node.x, $globals.world.nonNullBool);
var y = this.visitTypedValue(node.y, $globals.world.nonNullBool);
- var code = ("" + x.get$code() + " " + node.op + " " + y.get$code());
- if (x.get$isConst() && y.get$isConst()) {
- var value = (kind == 35/*TokenKind.AND*/) ? x.get$actualValue() && y.get$actualValue() : x.get$actualValue() || y.get$actualValue();
- return Value.fromBool(value, node.span);
- }
- return new Value($globals.world.nonNullBool, code, node.span, true);
+ return x.binop$4(kind, y, this, node);
}
- else if (kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenKind.NE_STRICT*/) {
+ else if (kind == (50) || kind == (51)) {
var x = this.visitValue(node.x);
var y = this.visitValue(node.y);
- if (x.get$isConst() && y.get$isConst()) {
- var xVal = x.get$actualValue();
- var yVal = y.get$actualValue();
- var value = kind == 50/*TokenKind.EQ_STRICT*/ ? $eq(xVal, yVal) : $ne(xVal, yVal);
- return Value.fromBool(value, node.span);
- }
- if ($eq(x.get$code(), "null") || $eq(y.get$code(), "null")) {
- var op = node.op.toString().substring(0, 2);
- return new Value($globals.world.nonNullBool, ("" + x.get$code() + " " + op + " " + y.get$code()), node.span, true);
- }
- else {
- return new Value($globals.world.nonNullBool, ("" + x.get$code() + " " + node.op + " " + y.get$code()), node.span, true);
- }
+ return x.binop$4(kind, y, this, node);
}
var assignKind = TokenKind.kindFromAssign(node.op.kind);
- if (assignKind == -1) {
+ if (assignKind == (-1)) {
var x = this.visitValue(node.x);
var y = this.visitValue(node.y);
- var name = TokenKind.binaryMethodName(node.op.kind);
- if (node.op.kind == 49/*TokenKind.NE*/) {
- name = ":ne";
- }
- if (name == null) {
- $globals.world.internalError(("unimplemented binary op " + node.op), node.span);
- return;
- }
- return x.invoke$4(this, name, node, new Arguments(null, [y]));
+ return x.binop$4(kind, y, this, node);
}
- else if ((assignKind != 0) && this._expressionNeedsParens(node.y)) {
+ else if ((assignKind != (0)) && this._expressionNeedsParens(node.y)) {
return this._visitAssign(assignKind, node.x, new ParenExpression(node.y, node.y.span), node, to$call$1(null), isVoid);
}
else {
@@ -3987,7 +3977,7 @@ MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap
if ($globals.options.forceDynamic && !members.get$isStatic()) {
members = this.findMembers(xn.name.name);
}
- if (kind == 0) {
+ if (kind == (0)) {
return x.set_$4(this, name, position, y);
}
else if (!members.get$treatAsField() || members.get$containsMethods()) {
@@ -4008,7 +3998,7 @@ MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap
}
members = new MemberSet(member, false);
if (!members.get$treatAsField() || members.get$containsMethods()) {
- if (kind != 0) {
+ if (kind != (0)) {
var right = members._get$3(this, position, x);
right = captureOriginal(right);
y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arguments(null, [y]));
@@ -4024,11 +4014,11 @@ MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap
$globals.world.error(("final variable \"" + x.get$code() + "\" is not assignable"), position.span);
}
y = y.convertTo$2(this, x.get$type());
- if (kind == 0) {
+ if (kind == (0)) {
x = captureOriginal(x);
return new Value(y.get$type(), ("" + x.get$code() + " = " + y.get$code()), position.span, true);
}
- else if (x.get$type().get$isNum() && y.get$type().get$isNum() && (kind != 46/*TokenKind.TRUNCDIV*/)) {
+ else if (x.get$type().get$isNum() && y.get$type().get$isNum() && (kind != (46))) {
x = captureOriginal(x);
var op = TokenKind.kindToString(kind);
return new Value(y.get$type(), ("" + x.get$code() + " " + op + "= " + y.get$code()), position.span, true);
@@ -4046,7 +4036,7 @@ MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c
var y = this.visitValue(yn);
var tmptarget = target;
var tmpindex = index;
- if (kind != 0) {
+ if (kind != (0)) {
tmptarget = this.getTemp(target);
tmpindex = this.getTemp(index);
index = this.assignTemp(tmpindex, index);
@@ -4072,7 +4062,7 @@ MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap
var target = xn.self.visit(this);
var y = this.visitValue(yn);
var tmptarget = target;
- if (kind != 0) {
+ if (kind != (0)) {
tmptarget = this.getTemp(target);
var right = tmptarget.get_$3(this, xn.name.name, xn.name);
right = captureOriginal(right);
@@ -4085,41 +4075,41 @@ MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap
MethodGenerator.prototype.visitUnaryExpression = function(node) {
var value = this.visitValue(node.self);
switch (node.op.kind) {
- case 16/*TokenKind.INCR*/:
- case 17/*TokenKind.DECR*/:
+ case (16):
+ case (17):
if (value.get$type().get$isNum()) {
return new Value(value.get$type(), ("" + node.op + value.get$code()), node.span, true);
}
else {
- var kind = (16/*TokenKind.INCR*/ == node.op.kind ? 42/*TokenKind.ADD*/ : 43/*TokenKind.SUB*/);
- var operand = new LiteralExpression(Value.fromInt(1, node.span), node.span);
+ var kind = ((16) == node.op.kind ? (42) : (43));
+ var operand = new LiteralExpression(Value.fromInt((1), node.span), node.span);
var assignValue = this._visitAssign(kind, node.self, operand, node, to$call$1(null), false);
return new Value(assignValue.get$type(), ("(" + assignValue.get$code() + ")"), node.span, true);
}
- case 19/*TokenKind.NOT*/:
+ case (19):
if (value.get$type().get$isBool() && value.get$isConst()) {
var newVal = !value.get$actualValue();
- return EvaluatedValue.EvaluatedValue$factory(value.get$type(), newVal, ("" + newVal), node.span);
+ return Value.fromBool(newVal, node.span);
}
else {
var newVal = value.convertTo$2(this, $globals.world.nonNullBool);
return new Value(newVal.get$type(), ("!" + newVal.get$code()), node.span, true);
}
- case 42/*TokenKind.ADD*/:
+ case (42):
return value.convertTo$2(this, $globals.world.numType);
- case 43/*TokenKind.SUB*/:
- case 18/*TokenKind.BIT_NOT*/:
+ case (43):
+ case (18):
- if (node.op.kind == 18/*TokenKind.BIT_NOT*/) {
+ if (node.op.kind == (18)) {
return value.invoke$4(this, ":bit_not", node, Arguments.get$EMPTY());
}
- else if (node.op.kind == 43/*TokenKind.SUB*/) {
+ else if (node.op.kind == (43)) {
return value.invoke$4(this, ":negate", node, Arguments.get$EMPTY());
}
else {
@@ -4145,8 +4135,8 @@ MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) {
if (value.get$type().get$isNum() && !value.get$isFinal()) {
return new Value(value.get$type(), ("" + value.get$code() + node.op), node.span, true);
}
- var kind = (16/*TokenKind.INCR*/ == node.op.kind) ? 42/*TokenKind.ADD*/ : 43/*TokenKind.SUB*/;
- var operand = new LiteralExpression(Value.fromInt(1, node.span), node.span);
+ var kind = ((16) == node.op.kind) ? (42) : (43);
+ var operand = new LiteralExpression(Value.fromInt((1), node.span), node.span);
var tmpleft = null, left = null;
var ret = this._visitAssign(kind, node.body, operand, node, (function (l) {
if (isVoid) {
@@ -4176,7 +4166,7 @@ MethodGenerator.prototype.visitNewExpression = function(node) {
if ($eq(constructorName, "") && !(typeRef instanceof GenericTypeReference) && typeRef.get$names() != null) {
var names = ListFactory.ListFactory$from$factory(typeRef.get$names());
constructorName = names.removeLast$0().get$name();
- if ($eq(names.get$length(), 0)) names = null;
+ if ($eq(names.get$length(), (0))) names = null;
typeRef = new NameTypeReference(typeRef.get$isFinal(), typeRef.get$name(), names, typeRef.get$span());
}
var type = this.method.resolveType(typeRef, true);
@@ -4213,92 +4203,69 @@ MethodGenerator.prototype.visitNewExpression = function(node) {
return m.invoke$4(this, node, target, this._makeArgs(node.arguments));
}
MethodGenerator.prototype.visitListExpression = function(node) {
- var argsCode = [];
var argValues = [];
- var type = null;
- if (node.type != null) {
- type = this.method.resolveType(node.type, true).get$typeArgsInOrder().$index(0);
+ var listType = $globals.world.listType;
+ var type = $globals.world.varType;
+ if (node.itemType != null) {
+ type = this.method.resolveType(node.itemType, true);
if (node.isConst && ((type instanceof ParameterType) || type.get$hasTypeParams())) {
$globals.world.error("type parameter cannot be used in const list literals");
}
+ listType = listType.getOrMakeConcreteType$1([type]);
}
var $$list = node.values;
for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
var item = $$list.$index($$i);
var arg = this.visitTypedValue(item, type);
argValues.add$1(arg);
- if (node.isConst) {
- if (!arg.get$isConst()) {
- $globals.world.error("const list can only contain const values", item.get$span());
- argsCode.add$1(arg.get$code());
- }
- else {
- argsCode.add$1(arg.get$canonicalCode());
- }
- }
- else {
- argsCode.add$1(arg.get$code());
+ if (node.isConst && !arg.get$isConst()) {
+ $globals.world.error("const list can only contain const values", arg.get$span());
}
}
$globals.world.listFactoryType.markUsed();
- var code = ("[" + Strings.join(argsCode, ", ") + "]");
- var value = new Value($globals.world.listType, code, node.span, true);
- if (node.isConst) {
- var immutableList = $globals.world.immutableListType;
- var immutableListCtor = immutableList.getConstructor("from");
- var result = immutableListCtor.invoke$4(this, node, new Value.type$ctor(value.get$type(), node.span), new Arguments(null, [value]));
- value = $globals.world.gen.globalForConst(ConstListValue.ConstListValue$factory(immutableList, argValues, ("const " + code), result.get$code(), node.span), argValues);
- }
- return value;
+ var ret = new ListValue(argValues, node.isConst, listType, node.span);
+ if (ret.get$isConst()) return ret.getGlobalValue$0();
+ return ret;
}
MethodGenerator.prototype.visitMapExpression = function(node) {
- if (node.items.get$length() == 0 && !node.isConst) {
+ if (node.items.get$length() == (0) && !node.isConst) {
return $globals.world.mapType.getConstructor("").invoke$4(this, node, new Value.type$ctor($globals.world.mapType, node.span), Arguments.get$EMPTY());
}
- var argValues = [];
- var argsCode = [];
- var type = null;
- if (node.type != null) {
- type = this.method.resolveType(node.type, true).get$typeArgsInOrder().$index(1);
- if (node.isConst && ((type instanceof ParameterType) || type.get$hasTypeParams())) {
- $globals.world.error("type parameter cannot be used in const map literals");
- }
- }
- for (var i = 0;
- i < node.items.get$length(); i += 2) {
- var key = this.visitTypedValue(node.items.$index(i), $globals.world.stringType);
- var valueItem = node.items.$index(i + 1);
- var value = this.visitTypedValue(valueItem, type);
- argValues.add$1(key);
- argValues.add$1(value);
- if (node.isConst) {
- if (!key.get$isConst() || !value.get$isConst()) {
- $globals.world.error("const map can only contain const values", valueItem.get$span());
- argsCode.add$1(key.get$code());
- argsCode.add$1(value.get$code());
+ var values = new Array();
+ var valueType = $globals.world.varType, keyType = $globals.world.stringType;
+ var mapType = $globals.world.mapType;
+ if (node.valueType != null) {
+ if (node.keyType != null) {
+ keyType = this.method.resolveType(node.keyType, true);
+ if (!keyType.get$isString()) {
+ $globals.world.error("the key type of a map literal must be \"String\"", keyType.get$span());
}
- else {
- argsCode.add$1(key.get$canonicalCode());
- argsCode.add$1(value.get$canonicalCode());
+ if (node.isConst && ((keyType instanceof ParameterType) || keyType.get$hasTypeParams())) {
+ $globals.world.error("type parameter cannot be used in const map literals");
}
}
- else {
- argsCode.add$1(key.get$code());
- argsCode.add$1(value.get$code());
+ valueType = this.method.resolveType(node.valueType, true);
+ if (node.isConst && ((valueType instanceof ParameterType) || valueType.get$hasTypeParams())) {
+ $globals.world.error("type parameter cannot be used in const map literals");
}
+ mapType = mapType.getOrMakeConcreteType$1([keyType, valueType]);
}
- var argList = ("[" + Strings.join(argsCode, ", ") + "]");
- var items = new Value($globals.world.listType, argList, node.span, true);
- var tp = $globals.world.corelib.topType;
- var f = node.isConst ? tp.getMember$1("_constMap") : tp.getMember$1("_map");
- var value = f.invoke(this, node, new Value.type$ctor(tp, null), new Arguments(null, [items]), false);
- if (node.isConst) {
- value = ConstMapValue.ConstMapValue$factory(value.get$type(), argValues, value.get$code(), value.get$code(), value.get$span());
- return $globals.world.gen.globalForConst(value, argValues);
- }
- else {
- return value;
+ for (var i = (0);
+ i < node.items.get$length(); i += (2)) {
+ var key = this.visitTypedValue(node.items.$index(i), keyType);
+ if (node.isConst && !key.get$isConst()) {
+ $globals.world.error("const map can only contain const keys", key.get$span());
+ }
+ values.add$1(key);
+ var value = this.visitTypedValue(node.items.$index(i + (1)), valueType);
+ if (node.isConst && !value.get$isConst()) {
+ $globals.world.error("const map can only contain const values", value.get$span());
+ }
+ values.add$1(value);
}
+ var ret = new MapValue(values, node.isConst, mapType, node.span);
+ if (ret.get$isConst()) return ret.getGlobalValue$0();
+ return ret;
}
MethodGenerator.prototype.visitConditionalExpression = function(node) {
var test = this.visitBool(node.test);
@@ -4314,9 +4281,7 @@ MethodGenerator.prototype.visitIsExpression = function(node) {
}
MethodGenerator.prototype.visitParenExpression = function(node) {
var body = this.visitValue(node.body);
- if (body.get$isConst()) {
- return EvaluatedValue.EvaluatedValue$factory(body.get$type(), body.get$actualValue(), ("(" + body.get$canonicalCode() + ")"), node.span);
- }
+ if (body.get$isConst()) return body;
return new Value(body.get$type(), ("(" + body.get$code() + ")"), node.span, true);
}
MethodGenerator.prototype.visitDotExpression = function(node) {
@@ -4347,7 +4312,7 @@ MethodGenerator.prototype.visitLiteralExpression = function(node) {
MethodGenerator.prototype._isUnaryIncrement = function(item) {
if ((item instanceof UnaryExpression)) {
var u = item;
- return u.op.kind == 16/*TokenKind.INCR*/ || u.op.kind == 17/*TokenKind.DECR*/;
+ return u.op.kind == (16) || u.op.kind == (17);
}
else {
return false;
@@ -4364,7 +4329,7 @@ MethodGenerator.prototype.visitStringInterpExpression = function(node) {
if (this._expressionNeedsParens(item)) {
code = ("(" + code + ")");
}
- if ($eq(items.get$length(), 0) || ($ne(code, "''") && $ne(code, "\"\""))) {
+ if ($eq(items.get$length(), (0)) || ($ne(code, "''") && $ne(code, "\"\""))) {
items.add$1(code);
}
}
@@ -4386,7 +4351,7 @@ function Arguments(nodes, values) {
}
Arguments.Arguments$bare$factory = function(arity) {
var values = [];
- for (var i = 0;
+ for (var i = (0);
i < arity; i++) {
values.add$1(new Value($globals.world.varType, ("$" + i), null, false));
}
@@ -4398,8 +4363,6 @@ Arguments.get$EMPTY = function() {
}
return $globals.Arguments__empty;
}
-Arguments.prototype.get$values = function() { return this.values; };
-Arguments.prototype.set$values = function(value) { return this.values = value; };
Arguments.prototype.get$nameCount = function() {
return this.get$length() - this.get$bareCount();
}
@@ -4419,17 +4382,17 @@ Arguments.prototype.getIndexOfName = function(name) {
return i;
}
}
- return -1;
+ return (-1);
}
Arguments.prototype.getValue = function(name) {
var i = this.getIndexOfName(name);
- return i >= 0 ? this.values.$index(i) : null;
+ return i >= (0) ? this.values.$index(i) : null;
}
Arguments.prototype.get$bareCount = function() {
if (this._bareCount == null) {
this._bareCount = this.get$length();
if (this.nodes != null) {
- for (var i = 0;
+ for (var i = (0);
i < this.nodes.get$length(); i++) {
if (this.nodes.$index(i).get$label() != null) {
this._bareCount = i;
@@ -4442,7 +4405,7 @@ Arguments.prototype.get$bareCount = function() {
}
Arguments.prototype.getCode = function() {
var argsCode = [];
- for (var i = 0;
+ for (var i = (0);
i < this.get$length(); i++) {
argsCode.add$1(this.values.$index(i).get$code());
}
@@ -4450,7 +4413,7 @@ Arguments.prototype.getCode = function() {
return Strings.join(argsCode, ", ");
}
Arguments.removeTrailingNulls = function(argsCode) {
- while (argsCode.get$length() > 0 && $eq(argsCode.last(), "null")) {
+ while (argsCode.get$length() > (0) && $eq(argsCode.last(), "null")) {
argsCode.removeLast();
}
}
@@ -4464,7 +4427,7 @@ Arguments.prototype.getNames = function() {
}
Arguments.prototype.toCallStubArgs = function() {
var result = [];
- for (var i = 0;
+ for (var i = (0);
i < this.get$bareCount(); i++) {
result.add$1(new Value($globals.world.varType, ("$" + i), null, false));
}
@@ -4529,7 +4492,7 @@ Library.prototype.get$isDom = function() {
return $eq(this, $globals.world.dom);
}
Library.prototype.get$span = function() {
- return new SourceSpan(this.baseSource, 0, 0);
+ return new SourceSpan(this.baseSource, (0), (0));
}
Library.prototype.makeFullPath = function(filename) {
if (filename.startsWith("dart:")) return filename;
@@ -4612,13 +4575,13 @@ Library.prototype.findType = function(type) {
var result = this.findTypeByName(type.name.name);
if (result == null) return null;
if (type.names != null) {
- if (type.names.get$length() > 1) {
+ if (type.names.get$length() > (1)) {
return null;
}
if (!result.get$isTop()) {
return null;
}
- return result.get$library().findTypeByName(type.names.$index(0).get$name());
+ return result.get$library().findTypeByName(type.names.$index((0)).get$name());
}
return result;
}
@@ -4710,12 +4673,12 @@ Library.prototype.resolve = function() {
if (this.name == null) {
this.name = this.baseSource.filename;
var index = this.name.lastIndexOf("/", this.name.length);
- if (index >= 0) {
- this.name = this.name.substring(index + 1);
+ if (index >= (0)) {
+ this.name = this.name.substring(index + (1));
}
index = this.name.indexOf(".");
- if (index > 0) {
- this.name = this.name.substring(0, index);
+ if (index > (0)) {
+ this.name = this.name.substring((0), index);
}
}
this._jsname = this.name.replaceAll(".", "_").replaceAll(":", "_").replaceAll(" ", "_");
@@ -4783,7 +4746,7 @@ _LibraryVisitor.prototype.addSource = function(source) {
return;
}
this.library.sources.add(source);
- var parser = new Parser(source, $globals.options.dietParse, false, false, 0);
+ var parser = new Parser(source, $globals.options.dietParse, false, false, (0));
var unit = parser.compilationUnit();
unit.forEach((function (def) {
return def.visit$1($this);
@@ -4826,10 +4789,10 @@ _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) {
this.seenImport = true;
name = this.getFirstStringArg(node);
var prefix = this.tryGetNamedStringArg(node, "prefix");
- if (node.arguments.get$length() > 2 || node.arguments.get$length() == 2 && prefix == null) {
+ if (node.arguments.get$length() > (2) || node.arguments.get$length() == (2) && prefix == null) {
$globals.world.error("expected at most one \"name\" argument and one optional \"prefix\"" + (" but found " + node.arguments.get$length()), node.span);
}
- else if (prefix != null && prefix.indexOf$1(".") >= 0) {
+ else if (prefix != null && prefix.indexOf$1(".") >= (0)) {
$globals.world.error("library prefix canot contain \".\"", node.span);
}
else if (this.seenSource || this.seenResource) {
@@ -4876,16 +4839,16 @@ _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) {
}
}
_LibraryVisitor.prototype.getSingleStringArg = function(node) {
- if (node.arguments.get$length() != 1) {
+ if (node.arguments.get$length() != (1)) {
$globals.world.error(("expected exactly one argument but found " + node.arguments.get$length()), node.span);
}
return this.getFirstStringArg(node);
}
_LibraryVisitor.prototype.getFirstStringArg = function(node) {
- if (node.arguments.get$length() < 1) {
+ if (node.arguments.get$length() < (1)) {
$globals.world.error(("expected at least one argument but found " + node.arguments.get$length()), node.span);
}
- var arg = node.arguments.$index(0);
+ var arg = node.arguments.$index((0));
if (arg.get$label() != null) {
$globals.world.error("label not allowed for directive", node.span);
}
@@ -4896,10 +4859,10 @@ _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) {
return a.get$label() != null && $eq(a.get$label().get$name(), argName);
})
);
- if ($eq(args.get$length(), 0)) {
+ if ($eq(args.get$length(), (0))) {
return null;
}
- if (args.get$length() > 1) {
+ if (args.get$length() > (1)) {
$globals.world.error(("expected at most one \"" + argName + "\" argument but found ") + node.arguments.get$length(), node.span);
}
for (var $$i = args.iterator$0(); $$i.hasNext$0(); ) {
@@ -4957,7 +4920,7 @@ Parameter.prototype.set$value = function(value) { return this.value = value; };
Parameter.prototype.resolve = function() {
this.name = this.definition.name.name;
if (this.name.startsWith("this.")) {
- this.name = this.name.substring(5);
+ this.name = this.name.substring((5));
this.isInitializer = true;
}
this.type = this.method.resolveType(this.definition.type, false);
@@ -5121,9 +5084,9 @@ Member.prototype.get$generatedFactoryName = function() {
}
}
Member.prototype.hashCode = function() {
- var typeCode = this.declaringType == null ? 1 : this.declaringType.hashCode();
+ var typeCode = this.declaringType == null ? (1) : this.declaringType.hashCode();
var nameCode = this.get$isConstructor() ? this.get$constructorName().hashCode() : this.name.hashCode();
- return (typeCode << 4) ^ nameCode;
+ return (typeCode << (4)) ^ nameCode;
}
Member.prototype.$eq = function(other) {
return (other instanceof Member) && $eq(this.get$isConstructor(), other.get$isConstructor()) && $eq(this.declaringType, other.get$declaringType()) && (this.get$isConstructor() ? this.get$constructorName() == other.get$constructorName() : this.name == other.get$name());
@@ -5256,13 +5219,13 @@ FieldMember.prototype.resolve = function() {
var $$list = this.definition.modifiers;
for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
var mod = $$list.$index($$i);
- if ($eq(mod.get$kind(), 84/*TokenKind.STATIC*/)) {
+ if ($eq(mod.get$kind(), (84))) {
if (this.isStatic) {
$globals.world.error("duplicate static modifier", mod.get$span());
}
this.isStatic = true;
}
- else if ($eq(mod.get$kind(), 98/*TokenKind.FINAL*/)) {
+ else if ($eq(mod.get$kind(), (98))) {
if (this.isFinal) {
$globals.world.error("duplicate final modifier", mod.get$span());
}
@@ -5344,21 +5307,12 @@ FieldMember.prototype._get = function(context, node, target, isDynamic) {
return new Value(this.type, ("$globals." + this.declaringType.get$jsname() + "_" + this.get$jsname()), node.span, true);
}
}
- else if (target.get$isConst() && this.isFinal) {
- var constTarget = (target instanceof GlobalValue) ? target.get$dynamic().get$exp() : target;
- if ((constTarget instanceof ConstObjectValue)) {
- return constTarget.get$fields().$index(this.name);
- }
- else if ($eq(constTarget.get$type(), $globals.world.stringType) && this.name == "length") {
- return new Value(this.type, ("" + constTarget.get$actualValue().get$length()), node.span, true);
- }
- }
- return new Value(this.type, ("" + target.code + "." + this.get$jsname()), node.span, true);
+ return new Value(this.type, ("" + target.get$code() + "." + this.get$jsname()), node.span, true);
}
FieldMember.prototype._set = function(context, node, target, value, isDynamic) {
var lhs = this._get(context, node, target, isDynamic);
value = value.convertTo(context, this.type, isDynamic);
- return new Value(this.type, ("" + lhs.get$code() + " = " + value.code), node.span, true);
+ return new Value(this.type, ("" + lhs.get$code() + " = " + value.get$code()), node.span, true);
}
FieldMember.prototype._get$3 = function($0, $1, $2) {
return this._get($0, $1, $2, false);
@@ -5458,7 +5412,7 @@ PropertyMember.prototype.addFromParent = function(parentMember) {
PropertyMember.prototype.resolve = function() {
if (this.getter != null) {
this.getter.resolve();
- if (this.getter.parameters.get$length() != 0) {
+ if (this.getter.parameters.get$length() != (0)) {
$globals.world.error("getter methods should take no arguments", this.getter.definition.span);
}
if (this.getter.returnType.get$isVoid()) {
@@ -5467,7 +5421,7 @@ PropertyMember.prototype.resolve = function() {
}
if (this.setter != null) {
this.setter.resolve();
- if (this.setter.parameters.get$length() != 1) {
+ if (this.setter.parameters.get$length() != (1)) {
$globals.world.error("setter methods should take a single argument", this.setter.definition.span);
}
if (!this.setter.returnType.get$isVoid() && this.setter.definition.returnType != null) {
@@ -5594,15 +5548,15 @@ ConcreteMember.prototype.override = function(other) {
}
ConcreteMember.prototype._get = function(context, node, target, isDynamic) {
var ret = this.baseMember._get(context, node, target, isDynamic);
- return new Value(this.get$inferredResult(), ret.code, node.span, true);
+ return new Value(this.get$inferredResult(), ret.get$code(), node.span, true);
}
ConcreteMember.prototype._set = function(context, node, target, value, isDynamic) {
var ret = this.baseMember._set(context, node, target, value, isDynamic);
- return new Value(this.returnType, ret.code, node.span, true);
+ return new Value(this.returnType, ret.get$code(), node.span, true);
}
ConcreteMember.prototype.invoke = function(context, node, target, args, isDynamic) {
var ret = this.baseMember.invoke(context, node, target, args, isDynamic);
- var code = ret.code;
+ var code = ret.get$code();
if (this.get$isConstructor()) {
code = code.replaceFirst$2(this.declaringType.get$genericType().get$jsname(), this.declaringType.get$jsname());
}
@@ -5689,7 +5643,7 @@ MethodMember.prototype.get$constructorName = function() {
return "";
}
if (returnType.get$names() != null) {
- return returnType.get$names().$index(0).get$name();
+ return returnType.get$names().$index((0)).get$name();
}
else if (returnType.get$name() != null) {
return returnType.get$name().get$name();
@@ -5725,7 +5679,7 @@ MethodMember.prototype.canInvoke = function(context, args) {
if (!this.parameters.$index(bareCount).get$isOptional()) return false;
for (var i = bareCount;
i < args.get$length(); i++) {
- if (this.indexOfParameter(args.getName(i)) < 0) {
+ if (this.indexOfParameter(args.getName(i)) < (0)) {
return false;
}
}
@@ -5733,14 +5687,14 @@ MethodMember.prototype.canInvoke = function(context, args) {
return true;
}
MethodMember.prototype.indexOfParameter = function(name) {
- for (var i = 0;
+ for (var i = (0);
i < this.parameters.get$length(); i++) {
var p = this.parameters.$index(i);
if (p.get$isOptional() && $eq(p.get$name(), name)) {
return i;
}
}
- return -1;
+ return (-1);
}
MethodMember.prototype.provideFieldSyntax = function() {
this._provideFieldSyntax = true;
@@ -5760,7 +5714,7 @@ MethodMember.prototype._get = function(context, node, target, isDynamic) {
return new Value(this.get$functionType(), ("" + type + this.get$jsname()), node.span, true);
}
this._providePropertySyntax = true;
- return new Value(this.get$functionType(), ("" + target.code + ".get$" + this.get$jsname() + "()"), node.span, true);
+ return new Value(this.get$functionType(), ("" + target.get$code() + ".get$" + this.get$jsname() + "()"), node.span, true);
}
MethodMember.prototype.namesInHomePositions = function(args) {
if (!args.get$hasNames()) return true;
@@ -5781,7 +5735,7 @@ MethodMember.prototype.namesInOrder = function(args) {
for (var i = args.get$bareCount();
i < this.parameters.get$length(); i++) {
var p = args.getIndexOfName(this.parameters.$index(i).get$name());
- if (p >= 0 && args.values.$index(p).get$needsTemp()) {
+ if (p >= (0) && args.values.$index(p).get$needsTemp()) {
if (lastParameter != null && lastParameter > p) {
return false;
}
@@ -5792,7 +5746,7 @@ MethodMember.prototype.namesInOrder = function(args) {
}
MethodMember.prototype.needsArgumentConversion = function(args) {
var bareCount = args.get$bareCount();
- for (var i = 0;
+ for (var i = (0);
i < bareCount; i++) {
var arg = args.values.$index(i);
if (arg.needsConversion$1(this.parameters.$index(i).get$type())) {
@@ -5855,7 +5809,7 @@ MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
argsCode.add$1("this");
}
var bareCount = args.get$bareCount();
- for (var i = 0;
+ for (var i = (0);
i < bareCount; i++) {
var arg = args.values.$index(i);
if (i >= this.parameters.get$length()) {
@@ -5863,14 +5817,9 @@ MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
return this._argError(context, node, target, args, msg, i);
}
arg = arg.convertTo$3(context, this.parameters.$index(i).get$type(), isDynamic);
- if (this.isConst && arg.get$isConst()) {
- argsCode.add$1(arg.get$canonicalCode());
- }
- else {
- argsCode.add$1(arg.get$code());
- }
+ argsCode.add$1(arg.get$code());
}
- var namedArgsUsed = 0;
+ var namedArgsUsed = (0);
if (bareCount < this.parameters.get$length()) {
this.genParameterValues();
for (var i = bareCount;
@@ -5884,11 +5833,11 @@ MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
namedArgsUsed++;
}
if (arg == null || !this.parameters.$index(i).get$isOptional()) {
- var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i + 1, true);
+ var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i + (1), true);
return this._argError(context, node, target, args, msg, i);
}
else {
- argsCode.add$1(this.isConst && arg.get$isConst() ? arg.get$canonicalCode() : arg.get$code());
+ argsCode.add$1(arg.get$code());
}
}
Arguments.removeTrailingNulls(argsCode);
@@ -5903,7 +5852,7 @@ MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
}
seen.add$1(name);
var p = this.indexOfParameter(name);
- if (p < 0) {
+ if (p < (0)) {
return this._argError(context, node, target, args, ("method does not have optional parameter \"" + name + "\""), i);
}
else if (p < bareCount) {
@@ -5923,30 +5872,15 @@ MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
return this._invokeBuiltin(context, node, target, args, argsCode, isDynamic);
}
if (this.isFactory) {
- return new Value(target.get$type(), ("" + this.get$generatedFactoryName() + "(" + argsString + ")"), node.span, true);
+ return new Value(target.get$type(), ("" + this.get$generatedFactoryName() + "(" + argsString + ")"), node != null ? node.span : null, true);
}
if (this.isStatic) {
if (this.declaringType.get$isTop()) {
- return new Value(this.get$inferredResult(), ("" + this.get$jsname() + "(" + argsString + ")"), node != null ? node.span : node, true);
+ return new Value(this.get$inferredResult(), ("" + this.get$jsname() + "(" + argsString + ")"), node != null ? node.span : null, true);
}
return new Value(this.get$inferredResult(), ("" + this.declaringType.get$jsname() + "." + this.get$jsname() + "(" + argsString + ")"), node.span, true);
}
- var code = ("" + target.code + "." + this.get$jsname() + "(" + argsString + ")");
- if (target.get$isConst()) {
- if ((target instanceof GlobalValue)) {
- target = target.get$dynamic().get$exp();
- }
- if (this.name == "get:length") {
- if ((target instanceof ConstListValue) || (target instanceof ConstMapValue)) {
- code = ("" + target.get$dynamic().get$values().get$length());
- }
- }
- else if (this.name == "isEmpty") {
- if ((target instanceof ConstListValue) || (target instanceof ConstMapValue)) {
- code = ("" + target.get$dynamic().get$values().isEmpty$0());
- }
- }
- }
+ var code = ("" + target.get$code() + "." + this.get$jsname() + "(" + argsString + ")");
if (this.name == "get:typeName" && this.declaringType.get$library().get$isDom()) {
$globals.world.gen.corejs.ensureTypeNameOf();
}
@@ -5973,7 +5907,7 @@ MethodMember.prototype._invokeConstructor = function(context, node, target, args
}
MethodMember.prototype._invokeConstConstructor = function(node, code, target, args) {
var fields = new HashMapImplementation();
- for (var i = 0;
+ for (var i = (0);
i < this.parameters.get$length(); i++) {
var param = this.parameters.$index(i);
if (param.get$isInitializer()) {
@@ -5992,7 +5926,7 @@ MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar
}
if (this.definition.initializers != null) {
this.generator._pushBlock(false);
- for (var j = 0;
+ for (var j = (0);
j < this.definition.formals.get$length(); j++) {
var name = this.definition.formals.$index(j).get$name().get$name();
var value = null;
@@ -6050,7 +5984,7 @@ MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar
}
}
}
- return $globals.world.gen.globalForConst(ConstObjectValue.ConstObjectValue$factory(target.get$type(), fields, code, node.span), args.values);
+ return $globals.world.gen.globalForConst(new ObjectValue(fields, true, target.get$type(), code, node.span), args.values);
}
MethodMember.prototype._invokeBuiltin = function(context, node, target, args, argsCode, isDynamic) {
var allConst = target.get$isConst() && args.values.every((function (arg) {
@@ -6061,18 +5995,18 @@ MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
if (!allConst) {
var code;
if (this.name == ":negate") {
- code = ("-" + target.code);
+ code = ("-" + target.get$code());
}
else if (this.name == ":bit_not") {
- code = ("~" + target.code);
+ code = ("~" + target.get$code());
}
else if (this.name == ":truncdiv" || this.name == ":mod") {
$globals.world.gen.corejs.useOperator(this.name);
- code = ("" + this.get$jsname() + "(" + target.code + ", " + argsCode.$index(0) + ")");
+ code = ("" + this.get$jsname() + "(" + target.get$code() + ", " + argsCode.$index((0)) + ")");
}
else {
var op = TokenKind.rawOperatorFromMethod(this.name);
- code = ("" + target.code + " " + op + " " + argsCode.$index(0));
+ code = ("" + target.get$code() + " " + op + " " + argsCode.$index((0)));
}
return new Value(this.get$inferredResult(), code, node.span, true);
}
@@ -6081,8 +6015,8 @@ MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
var val0, val1, ival0, ival1;
val0 = target.get$dynamic().get$actualValue();
ival0 = val0.toInt();
- if (args.values.get$length() > 0) {
- val1 = args.values.$index(0).get$dynamic().get$actualValue();
+ if (args.values.get$length() > (0)) {
+ val1 = args.values.$index((0)).get$dynamic().get$actualValue();
ival1 = val1.toInt();
}
switch (this.name) {
@@ -6187,27 +6121,41 @@ MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
break;
}
- return EvaluatedValue.EvaluatedValue$factory(this.get$inferredResult(), value, ("" + value), node.span);
+ if (this.get$inferredResult().get$isInt()) {
+ return Value.fromInt(value.toInt$0(), node.span);
+ }
+ else if (this.get$inferredResult().get$isDouble()) {
+ return Value.fromDouble(value.toDouble$0(), node.span);
+ }
+ else if (this.get$inferredResult().get$isNum()) {
+ return Value.fromDouble(value.toDouble$0(), node.span);
+ }
+ else if (this.get$inferredResult().get$isBool()) {
+ return Value.fromBool(value, node.span);
+ }
+ else {
+ $globals.world.internalError(("unsupported const result type \"" + this.get$inferredResult().name + "\""), node.span);
+ }
}
}
else if (this.declaringType.get$isString()) {
if (this.name == ":index") {
- return new Value(this.declaringType, ("" + target.code + "[" + argsCode.$index(0) + "]"), node.span, true);
+ return new Value(this.declaringType, ("" + target.get$code() + "[" + argsCode.$index((0)) + "]"), node.span, true);
}
else if (this.name == ":add") {
if (allConst) {
- var value = target.get$dynamic().get$actualValue() + args.values.$index(0).get$dynamic().get$actualValue();
+ var value = target.get$dynamic().get$actualValue() + args.values.$index((0)).get$dynamic().get$actualValue();
return Value.fromString(value, node.span);
}
- return new Value(this.declaringType, ("" + target.code + " + " + argsCode.$index(0)), node.span, true);
+ return new Value(this.declaringType, ("" + target.get$code() + " + " + argsCode.$index((0))), node.span, true);
}
}
else if (this.declaringType.get$isNative()) {
if (this.name == ":index") {
- return new Value(this.returnType, ("" + target.code + "[" + argsCode.$index(0) + "]"), node.span, true);
+ return new Value(this.returnType, ("" + target.get$code() + "[" + argsCode.$index((0)) + "]"), node.span, true);
}
else if (this.name == ":setindex") {
- return new Value(this.returnType, ("" + target.code + "[" + argsCode.$index(0) + "] = " + argsCode.$index(1)), node.span, true);
+ return new Value(this.returnType, ("" + target.get$code() + "[" + argsCode.$index((0)) + "] = " + argsCode.$index((1))), node.span, true);
}
}
if (this.name == ":eq" || this.name == ":ne") {
@@ -6217,22 +6165,22 @@ MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
}
if (allConst) {
var val0 = target.get$dynamic().get$actualValue();
- var val1 = args.values.$index(0).get$dynamic().get$actualValue();
+ var val1 = args.values.$index((0)).get$dynamic().get$actualValue();
var newVal = this.name == ":eq" ? $eq(val0, val1) : $ne(val0, val1);
- return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, newVal, ("" + newVal), node.span);
+ return Value.fromBool(newVal, node.span);
}
- if ($eq(argsCode.$index(0), "null")) {
- return new Value(this.get$inferredResult(), ("" + target.code + " " + op + " null"), node.span, true);
+ if ($eq(argsCode.$index((0)), "null")) {
+ return new Value(this.get$inferredResult(), ("" + target.get$code() + " " + op + " null"), node.span, true);
}
else if (target.get$type().get$isNum() || target.get$type().get$isString()) {
- return new Value(this.get$inferredResult(), ("" + target.code + " " + op + " " + argsCode.$index(0)), node.span, true);
+ return new Value(this.get$inferredResult(), ("" + target.get$code() + " " + op + " " + argsCode.$index((0))), node.span, true);
}
$globals.world.gen.corejs.useOperator(this.name);
- return new Value(this.get$inferredResult(), ("" + this.get$jsname() + "(" + target.code + ", " + argsCode.$index(0) + ")"), node.span, true);
+ return new Value(this.get$inferredResult(), ("" + this.get$jsname() + "(" + target.get$code() + ", " + argsCode.$index((0)) + ")"), node.span, true);
}
if (this.get$isCallMethod()) {
this.declaringType.markUsed();
- return new Value(this.get$inferredResult(), ("" + target.code + "(" + Strings.join(argsCode, ", ") + ")"), node.span, true);
+ return new Value(this.get$inferredResult(), ("" + target.get$code() + "(" + Strings.join(argsCode, ", ") + ")"), node.span, true);
}
if (this.name == ":index") {
$globals.world.gen.corejs.useIndex = true;
@@ -6241,7 +6189,7 @@ MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
$globals.world.gen.corejs.useSetIndex = true;
}
var argsString = Strings.join(argsCode, ", ");
- return new Value(this.get$inferredResult(), ("" + target.code + "." + this.get$jsname() + "(" + argsString + ")"), node.span, true);
+ return new Value(this.get$inferredResult(), ("" + target.get$code() + "." + this.get$jsname() + "(" + argsString + ")"), node.span, true);
}
MethodMember.prototype.resolve = function() {
this.isStatic = this.declaringType.get$isTop();
@@ -6252,25 +6200,25 @@ MethodMember.prototype.resolve = function() {
var $$list = this.definition.modifiers;
for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
var mod = $$list.$index($$i);
- if ($eq(mod.get$kind(), 84/*TokenKind.STATIC*/)) {
+ if ($eq(mod.get$kind(), (84))) {
if (this.isStatic) {
$globals.world.error("duplicate static modifier", mod.get$span());
}
this.isStatic = true;
}
- else if (this.get$isConstructor() && $eq(mod.get$kind(), 91/*TokenKind.CONST*/)) {
+ else if (this.get$isConstructor() && $eq(mod.get$kind(), (91))) {
if (this.isConst) {
$globals.world.error("duplicate const modifier", mod.get$span());
}
this.isConst = true;
}
- else if ($eq(mod.get$kind(), 73/*TokenKind.FACTORY*/)) {
+ else if ($eq(mod.get$kind(), (73))) {
if (this.isFactory) {
$globals.world.error("duplicate factory modifier", mod.get$span());
}
this.isFactory = true;
}
- else if ($eq(mod.get$kind(), 71/*TokenKind.ABSTRACT*/)) {
+ else if ($eq(mod.get$kind(), (71))) {
if (this.isAbstract) {
if (this.declaringType.get$isClass()) {
$globals.world.error("duplicate abstract modifier", mod.get$span());
@@ -6375,10 +6323,10 @@ MemberSet.prototype.add = function(member) {
return this.members.add(member);
}
MemberSet.prototype.get$isStatic = function() {
- return this.members.get$length() == 1 && this.members.$index(0).get$isStatic();
+ return this.members.get$length() == (1) && this.members.$index((0)).get$isStatic();
}
MemberSet.prototype.get$isOperator = function() {
- return this.members.$index(0).get$isOperator();
+ return this.members.$index((0)).get$isOperator();
}
MemberSet.prototype.canInvoke = function(context, args) {
return this.members.some((function (m) {
@@ -6390,7 +6338,7 @@ MemberSet.prototype._makeError = function(node, target, action) {
if (!target.get$type().get$isVar()) {
$globals.world.warning(("could not find applicable " + action + " for \"" + this.name + "\""), node.span);
}
- return new Value($globals.world.varType, ("" + target.code + "." + this.jsname + "() /*no applicable " + action + "*/"), node.span, true);
+ return new Value($globals.world.varType, ("" + target.get$code() + "." + this.jsname + "() /*no applicable " + action + "*/"), node.span, true);
}
MemberSet.prototype.get$treatAsField = function() {
if (this._treatAsField == null) {
@@ -6428,11 +6376,11 @@ MemberSet.prototype._get = function(context, node, target, isDynamic) {
returnValue = new Value(this._foldTypes(targets), null, node.span, true);
}
else {
- if (this.members.get$length() == 1) {
- return this.members.$index(0)._get$4(context, node, target, isDynamic);
+ if (this.members.get$length() == (1)) {
+ return this.members.$index((0))._get$4(context, node, target, isDynamic);
}
- else if ($eq(targets.get$length(), 1)) {
- return targets.$index(0)._get$4(context, node, target, isDynamic);
+ else if ($eq(targets.get$length(), (1))) {
+ return targets.$index((0))._get$4(context, node, target, isDynamic);
}
for (var $$i = targets.iterator$0(); $$i.hasNext$0(); ) {
var member = $$i.next$0();
@@ -6443,12 +6391,12 @@ MemberSet.prototype._get = function(context, node, target, isDynamic) {
return this._makeError(node, target, "getter");
}
}
- if (returnValue.code == null) {
+ if (returnValue.get$code() == null) {
if (this.get$treatAsField()) {
- return new Value(returnValue.get$type(), ("" + target.code + "." + this.jsname), node.span, true);
+ return new Value(returnValue.get$type(), ("" + target.get$code() + "." + this.jsname), node.span, true);
}
else {
- return new Value(returnValue.get$type(), ("" + target.code + ".get$" + this.jsname + "()"), node.span, true);
+ return new Value(returnValue.get$type(), ("" + target.get$code() + ".get$" + this.jsname + "()"), node.span, true);
}
}
return returnValue;
@@ -6467,11 +6415,11 @@ MemberSet.prototype._set = function(context, node, target, value, isDynamic) {
returnValue = new Value(this._foldTypes(targets), null, node.span, true);
}
else {
- if (this.members.get$length() == 1) {
- return this.members.$index(0)._set$5(context, node, target, value, isDynamic);
+ if (this.members.get$length() == (1)) {
+ return this.members.$index((0))._set$5(context, node, target, value, isDynamic);
}
- else if ($eq(targets.get$length(), 1)) {
- return targets.$index(0)._set$5(context, node, target, value, isDynamic);
+ else if ($eq(targets.get$length(), (1))) {
+ return targets.$index((0))._set$5(context, node, target, value, isDynamic);
}
for (var $$i = targets.iterator$0(); $$i.hasNext$0(); ) {
var member = $$i.next$0();
@@ -6482,12 +6430,12 @@ MemberSet.prototype._set = function(context, node, target, value, isDynamic) {
return this._makeError(node, target, "setter");
}
}
- if (returnValue.code == null) {
+ if (returnValue.get$code() == null) {
if (this.get$treatAsField()) {
- return new Value(returnValue.get$type(), ("" + target.code + "." + this.jsname + " = " + value.code), node.span, true);
+ return new Value(returnValue.get$type(), ("" + target.get$code() + "." + this.jsname + " = " + value.get$code()), node.span, true);
}
else {
- return new Value(returnValue.get$type(), ("" + target.code + ".set$" + this.jsname + "(" + value.code + ")"), node.span, true);
+ return new Value(returnValue.get$type(), ("" + target.get$code() + ".set$" + this.jsname + "(" + value.get$code() + ")"), node.span, true);
}
}
return returnValue;
@@ -6496,15 +6444,15 @@ MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) {
if (this.isVar && !this.get$isOperator()) {
return this.invokeOnVar(context, node, target, args);
}
- if (this.members.get$length() == 1) {
- return this.members.$index(0).invoke$5(context, node, target, args, isDynamic);
+ if (this.members.get$length() == (1)) {
+ return this.members.$index((0)).invoke$5(context, node, target, args, isDynamic);
}
var targets = this.members.filter((function (m) {
return m.canInvoke$2(context, args);
})
);
- if ($eq(targets.get$length(), 1)) {
- return targets.$index(0).invoke$5(context, node, target, args, isDynamic);
+ if ($eq(targets.get$length(), (1))) {
+ return targets.$index((0)).invoke$5(context, node, target, args, isDynamic);
}
var returnValue = null;
for (var $$i = targets.iterator$0(); $$i.hasNext$0(); ) {
@@ -6515,7 +6463,7 @@ MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) {
if (returnValue == null) {
return this._makeError(node, target, "method");
}
- if (returnValue.code == null) {
+ if (returnValue.get$code() == null) {
if (this.name == ":call") {
return target._varCall(context, node, args);
}
@@ -6531,12 +6479,12 @@ MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) {
MemberSet.prototype.invokeSpecial = function(target, args, returnType) {
var argsString = args.getCode();
if (this.name == ":index" || this.name == ":setindex") {
- return new Value(returnType, ("" + target.code + "." + this.jsname + "(" + argsString + ")"), target.span, true);
+ return new Value(returnType, ("" + target.get$code() + "." + this.jsname + "(" + argsString + ")"), target.span, true);
}
else {
- if (argsString.get$length() > 0) argsString = (", " + argsString);
+ if (argsString.get$length() > (0)) argsString = (", " + argsString);
$globals.world.gen.corejs.useOperator(this.name);
- return new Value(returnType, ("" + this.jsname + "(" + target.code + argsString + ")"), target.span, true);
+ return new Value(returnType, ("" + this.jsname + "(" + target.get$code() + argsString + ")"), target.span, true);
}
}
MemberSet.prototype.invokeOnVar = function(context, node, target, args) {
@@ -6546,7 +6494,7 @@ MemberSet.prototype.invokeOnVar = function(context, node, target, args) {
MemberSet.prototype._tryUnion = function(x, y, node) {
if (x == null) return y;
var type = Type.union(x.get$type(), y.get$type());
- if (x.code == y.code) {
+ if (x.get$code() == y.get$code()) {
if ($eq(type, x.get$type())) {
return x;
}
@@ -6554,7 +6502,7 @@ MemberSet.prototype._tryUnion = function(x, y, node) {
$globals.world.internalError("unexpected: union of const values ");
}
else {
- var ret = new Value(type, x.code, node.span, true);
+ var ret = new Value(type, x.get$code(), node.span, true);
ret.set$isSuper(x.isSuper && y.isSuper);
ret.set$needsTemp(x.needsTemp || y.needsTemp);
ret.set$isType(x.isType && y.isType);
@@ -6656,8 +6604,8 @@ Token.prototype.toString = function() {
var kindText = TokenKind.kindToString(this.kind);
var actualText = this.get$text();
if ($ne(kindText, actualText)) {
- if (actualText.get$length() > 10) {
- actualText = actualText.substring$2(0, 8) + "...";
+ if (actualText.get$length() > (10)) {
+ actualText = actualText.substring$2((0), (8)) + "...";
}
return ("" + kindText + "(" + actualText + ")");
}
@@ -6707,23 +6655,23 @@ SourceFile.prototype.get$text = function() {
}
SourceFile.prototype.get$lineStarts = function() {
if (this._lineStarts == null) {
- var starts = [0];
- var index = 0;
+ var starts = [(0)];
+ var index = (0);
while (index < this.get$text().length) {
- index = this.get$text().indexOf("\n", index) + 1;
- if (index <= 0) break;
+ index = this.get$text().indexOf("\n", index) + (1);
+ if (index <= (0)) break;
starts.add$1(index);
}
- starts.add$1(this.get$text().length + 1);
+ starts.add$1(this.get$text().length + (1));
this._lineStarts = starts;
}
return this._lineStarts;
}
SourceFile.prototype.getLine = function(position) {
var starts = this.get$lineStarts();
- for (var i = 0;
+ for (var i = (0);
i < starts.get$length(); i++) {
- if (starts.$index(i) > position) return i - 1;
+ if (starts.$index(i) > position) return i - (1);
}
$globals.world.internalError("bad position");
}
@@ -6733,19 +6681,19 @@ SourceFile.prototype.getColumn = function(line, position) {
SourceFile.prototype.getLocationMessage = function(message, start, end, includeText) {
var line = this.getLine(start);
var column = this.getColumn(line, start);
- var buf = new StringBufferImpl(("" + this.filename + ":" + (line + 1) + ":" + (column + 1) + ": " + message));
+ var buf = new StringBufferImpl(("" + this.filename + ":" + (line + (1)) + ":" + (column + (1)) + ": " + message));
if (includeText) {
buf.add$1("\n");
var textLine;
- if ((line + 2) < this._lineStarts.get$length()) {
- textLine = this.get$text().substring(this._lineStarts.$index(line), this._lineStarts.$index(line + 1));
+ if ((line + (2)) < this._lineStarts.get$length()) {
+ textLine = this.get$text().substring(this._lineStarts.$index(line), this._lineStarts.$index(line + (1)));
}
else {
textLine = this.get$text().substring(this._lineStarts.$index(line)) + "\n";
}
var toColumn = Math.min(column + (end - start), textLine.get$length());
if ($globals.options.useColors) {
- buf.add$1(textLine.substring$2(0, column));
+ buf.add$1(textLine.substring$2((0), column));
buf.add$1($globals._RED_COLOR);
buf.add$1(textLine.substring$2(column, toColumn));
buf.add$1($globals._NO_COLOR);
@@ -6754,7 +6702,7 @@ SourceFile.prototype.getLocationMessage = function(message, start, end, includeT
else {
buf.add$1(textLine);
}
- var i = 0;
+ var i = (0);
for (; i < column; i++) {
buf.add$1(" ");
}
@@ -6796,12 +6744,12 @@ SourceSpan.prototype.toMessageString = function(message) {
SourceSpan.prototype.get$locationText = function() {
var line = this.file.getLine(this.start);
var column = this.file.getColumn(line, this.start);
- return ("" + this.file.filename + ":" + (line + 1) + ":" + (column + 1));
+ return ("" + this.file.filename + ":" + (line + (1)) + ":" + (column + (1)));
}
SourceSpan.prototype.compareTo = function(other) {
if ($eq(this.file, other.file)) {
var d = this.start - other.start;
- return d == 0 ? (this.end - other.end) : d;
+ return d == (0) ? (this.end - other.end) : d;
}
return this.file.compareTo(other.file);
}
@@ -6817,7 +6765,7 @@ function InterpStack(previous, quote, isMultiline) {
this.previous = previous;
this.quote = quote;
this.isMultiline = isMultiline;
- this.depth = -1;
+ this.depth = (-1);
// Initializers done
}
InterpStack.prototype.get$previous = function() { return this.previous; };
@@ -6842,13 +6790,13 @@ function TokenizerHelpers() {
// Initializers done
}
TokenizerHelpers.isIdentifierStart = function(c) {
- return ((c >= 97 && c <= 122) || (c >= 65 && c <= 90) || c == 95);
+ return ((c >= (97) && c <= (122)) || (c >= (65) && c <= (90)) || c == (95));
}
TokenizerHelpers.isDigit = function(c) {
- return (c >= 48 && c <= 57);
+ return (c >= (48) && c <= (57));
}
TokenizerHelpers.isIdentifierPart = function(c) {
- return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c) || c == 36);
+ return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c) || c == (36));
}
TokenizerHelpers.isInterpIdentifierPart = function(c) {
return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c));
@@ -6868,7 +6816,7 @@ TokenizerBase.prototype._nextChar = function() {
return this._text.charCodeAt(this._lang_index++);
}
else {
- return 0;
+ return (0);
}
}
TokenizerBase.prototype._peekChar = function() {
@@ -6876,7 +6824,7 @@ TokenizerBase.prototype._peekChar = function() {
return this._text.charCodeAt(this._lang_index);
}
else {
- return 0;
+ return (0);
}
}
TokenizerBase.prototype._maybeEatChar = function(ch) {
@@ -6897,17 +6845,17 @@ TokenizerBase.prototype._finishToken = function(kind) {
return new Token(kind, this._source, this._startIndex, this._lang_index);
}
TokenizerBase.prototype._errorToken = function(message) {
- return new ErrorToken(65/*TokenKind.ERROR*/, this._source, this._startIndex, this._lang_index, message);
+ return new ErrorToken((65), this._source, this._startIndex, this._lang_index, message);
}
TokenizerBase.prototype.finishWhitespace = function() {
this._lang_index--;
while (this._lang_index < this._text.length) {
var ch = this._text.charCodeAt(this._lang_index++);
- if (ch == 32 || ch == 9 || ch == 13) {
+ if (ch == (32) || ch == (9) || ch == (13)) {
}
- else if (ch == 10) {
+ else if (ch == (10)) {
if (!this._skipWhitespace) {
- return this._finishToken(63/*TokenKind.WHITESPACE*/);
+ return this._finishToken((63));
}
}
else {
@@ -6916,57 +6864,57 @@ TokenizerBase.prototype.finishWhitespace = function() {
return this.next();
}
else {
- return this._finishToken(63/*TokenKind.WHITESPACE*/);
+ return this._finishToken((63));
}
}
}
- return this._finishToken(1/*TokenKind.END_OF_FILE*/);
+ return this._finishToken((1));
}
TokenizerBase.prototype.finishHashBang = function() {
while (true) {
var ch = this._nextChar();
- if (ch == 0 || ch == 10 || ch == 13) {
- return this._finishToken(13/*TokenKind.HASHBANG*/);
+ if (ch == (0) || ch == (10) || ch == (13)) {
+ return this._finishToken((13));
}
}
}
TokenizerBase.prototype.finishSingleLineComment = function() {
while (true) {
var ch = this._nextChar();
- if (ch == 0 || ch == 10 || ch == 13) {
+ if (ch == (0) || ch == (10) || ch == (13)) {
if (this._skipWhitespace) {
return this.next();
}
else {
- return this._finishToken(64/*TokenKind.COMMENT*/);
+ return this._finishToken((64));
}
}
}
}
TokenizerBase.prototype.finishMultiLineComment = function() {
- var nesting = 1;
+ var nesting = (1);
do {
var ch = this._nextChar();
- if (ch == 0) {
+ if (ch == (0)) {
return this._errorToken();
}
- else if (ch == 42) {
- if (this._maybeEatChar(47)) {
+ else if (ch == (42)) {
+ if (this._maybeEatChar((47))) {
nesting--;
}
}
- else if (ch == 47) {
- if (this._maybeEatChar(42)) {
+ else if (ch == (47)) {
+ if (this._maybeEatChar((42))) {
nesting++;
}
}
}
- while (nesting > 0)
+ while (nesting > (0))
if (this._skipWhitespace) {
return this.next();
}
else {
- return this._finishToken(64/*TokenKind.COMMENT*/);
+ return this._finishToken((64));
}
}
TokenizerBase.prototype.eatDigits = function() {
@@ -6980,71 +6928,71 @@ TokenizerBase.prototype.eatDigits = function() {
}
}
TokenizerBase._hexDigit = function(c) {
- if (c >= 48 && c <= 57) {
- return c - 48;
+ if (c >= (48) && c <= (57)) {
+ return c - (48);
}
- else if (c >= 97 && c <= 102) {
- return c - 87;
+ else if (c >= (97) && c <= (102)) {
+ return c - (87);
}
- else if (c >= 65 && c <= 70) {
- return c - 55;
+ else if (c >= (65) && c <= (70)) {
+ return c - (55);
}
else {
- return -1;
+ return (-1);
}
}
TokenizerBase.prototype.readHex = function(hexLength) {
var maxIndex;
if (hexLength == null) {
- maxIndex = this._text.length - 1;
+ maxIndex = this._text.length - (1);
}
else {
maxIndex = this._lang_index + hexLength;
- if (maxIndex >= this._text.length) return -1;
+ if (maxIndex >= this._text.length) return (-1);
}
- var result = 0;
+ var result = (0);
while (this._lang_index < maxIndex) {
var digit = TokenizerBase._hexDigit(this._text.charCodeAt(this._lang_index));
- if (digit == -1) {
+ if (digit == (-1)) {
if (hexLength == null) {
return result;
}
else {
- return -1;
+ return (-1);
}
}
TokenizerBase._hexDigit(this._text.charCodeAt(this._lang_index));
- result = (result * 16) + digit;
+ result = (result * (16)) + digit;
this._lang_index++;
}
return result;
}
TokenizerBase.prototype.finishHex = function() {
var value = this.readHex();
- return new LiteralToken(61/*TokenKind.HEX_INTEGER*/, this._source, this._startIndex, this._lang_index, value);
+ return new LiteralToken((61), this._source, this._startIndex, this._lang_index, value);
}
TokenizerBase.prototype.finishNumber = function() {
this.eatDigits();
- if (this._peekChar() == 46) {
+ if (this._peekChar() == (46)) {
this._nextChar();
if (TokenizerHelpers.isDigit(this._peekChar())) {
this.eatDigits();
- return this.finishNumberExtra(62/*TokenKind.DOUBLE*/);
+ return this.finishNumberExtra((62));
}
else {
this._lang_index--;
}
}
- return this.finishNumberExtra(60/*TokenKind.INTEGER*/);
+ return this.finishNumberExtra((60));
}
TokenizerBase.prototype.finishNumberExtra = function(kind) {
- if (this._maybeEatChar(101) || this._maybeEatChar(69)) {
- kind = 62/*TokenKind.DOUBLE*/;
- this._maybeEatChar(45);
- this._maybeEatChar(43);
+ if (this._maybeEatChar((101)) || this._maybeEatChar((69))) {
+ kind = (62);
+ this._maybeEatChar((45));
+ this._maybeEatChar((43));
this.eatDigits();
}
- if (this._peekChar() != 0 && TokenizerHelpers.isIdentifierStart(this._peekChar())) {
+ if (this._peekChar() != (0) && TokenizerHelpers.isIdentifierStart(this._peekChar())) {
this._nextChar();
return this._errorToken("illegal character in number");
}
@@ -7052,29 +7000,29 @@ TokenizerBase.prototype.finishNumberExtra = function(kind) {
}
TokenizerBase.prototype._makeStringToken = function(buf, isPart) {
var s = Strings.String$fromCharCodes$factory(buf);
- var kind = isPart ? 59/*TokenKind.STRING_PART*/ : 58/*TokenKind.STRING*/;
+ var kind = isPart ? (59) : (58);
return new LiteralToken(kind, this._source, this._startIndex, this._lang_index, s);
}
TokenizerBase.prototype._makeRawStringToken = function(isMultiline) {
var s;
if (isMultiline) {
- if (this._source.get$text()[this._startIndex + 4] == "\n") {
- s = this._source.get$text().substring(this._startIndex + 5, this._lang_index - 3);
+ if (this._source.get$text()[this._startIndex + (4)] == "\n") {
+ s = this._source.get$text().substring(this._startIndex + (5), this._lang_index - (3));
}
else {
- s = this._source.get$text().substring(this._startIndex + 4, this._lang_index - 3);
+ s = this._source.get$text().substring(this._startIndex + (4), this._lang_index - (3));
}
}
else {
- s = this._source.get$text().substring(this._startIndex + 2, this._lang_index - 1);
+ s = this._source.get$text().substring(this._startIndex + (2), this._lang_index - (1));
}
- return new LiteralToken(58/*TokenKind.STRING*/, this._source, this._startIndex, this._lang_index, s);
+ return new LiteralToken((58), this._source, this._startIndex, this._lang_index, s);
}
TokenizerBase.prototype.finishMultilineString = function(quote) {
var buf = new Array();
while (true) {
var ch = this._nextChar();
- if (ch == 0) {
+ if (ch == (0)) {
return this._errorToken();
}
else if (ch == quote) {
@@ -7086,13 +7034,13 @@ TokenizerBase.prototype.finishMultilineString = function(quote) {
}
buf.add$1(quote);
}
- else if (ch == 36) {
+ else if (ch == (36)) {
this._interpStack = InterpStack.push(this._interpStack, quote, true);
return this._makeStringToken(buf, true);
}
- else if (ch == 92) {
+ else if (ch == (92)) {
var escapeVal = this.readEscapeSequence();
- if ($eq(escapeVal, -1)) {
+ if ($eq(escapeVal, (-1))) {
return this._errorToken("invalid hex escape sequence");
}
else {
@@ -7107,26 +7055,26 @@ TokenizerBase.prototype.finishMultilineString = function(quote) {
TokenizerBase.prototype._finishOpenBrace = function() {
var $0;
if (this._interpStack != null) {
- if (this._interpStack.depth == -1) {
- this._interpStack.depth = 1;
+ if (this._interpStack.depth == (-1)) {
+ this._interpStack.depth = (1);
}
else {
- ($0 = this._interpStack).depth = $0.depth + 1;
+ ($0 = this._interpStack).depth = $0.depth + (1);
}
}
- return this._finishToken(6/*TokenKind.LBRACE*/);
+ return this._finishToken((6));
}
TokenizerBase.prototype._finishCloseBrace = function() {
var $0;
if (this._interpStack != null) {
- ($0 = this._interpStack).depth = $0.depth - 1;
+ ($0 = this._interpStack).depth = $0.depth - (1);
}
- return this._finishToken(7/*TokenKind.RBRACE*/);
+ return this._finishToken((7));
}
TokenizerBase.prototype.finishString = function(quote) {
if (this._maybeEatChar(quote)) {
if (this._maybeEatChar(quote)) {
- this._maybeEatChar(10);
+ this._maybeEatChar((10));
return this.finishMultilineString(quote);
}
else {
@@ -7149,7 +7097,7 @@ TokenizerBase.prototype.finishRawString = function(quote) {
if (ch == quote) {
return this._makeRawStringToken(false);
}
- else if (ch == 0) {
+ else if (ch == (0)) {
return this._errorToken();
}
}
@@ -7157,7 +7105,7 @@ TokenizerBase.prototype.finishRawString = function(quote) {
TokenizerBase.prototype.finishMultilineRawString = function(quote) {
while (true) {
var ch = this._nextChar();
- if (ch == 0) {
+ if (ch == (0)) {
return this._errorToken();
}
else if (ch == quote && this._maybeEatChar(quote) && this._maybeEatChar(quote)) {
@@ -7172,16 +7120,16 @@ TokenizerBase.prototype.finishStringBody = function(quote) {
if (ch == quote) {
return this._makeStringToken(buf, false);
}
- else if (ch == 36) {
+ else if (ch == (36)) {
this._interpStack = InterpStack.push(this._interpStack, quote, false);
return this._makeStringToken(buf, true);
}
- else if (ch == 0) {
+ else if (ch == (0)) {
return this._errorToken();
}
- else if (ch == 92) {
+ else if (ch == (92)) {
var escapeVal = this.readEscapeSequence();
- if ($eq(escapeVal, -1)) {
+ if ($eq(escapeVal, (-1))) {
return this._errorToken("invalid hex escape sequence");
}
else {
@@ -7197,48 +7145,48 @@ TokenizerBase.prototype.readEscapeSequence = function() {
var ch = this._nextChar();
var hexValue;
switch (ch) {
- case 110:
+ case (110):
- return 10;
+ return (10);
- case 114:
+ case (114):
- return 13;
+ return (13);
- case 102:
+ case (102):
- return 12;
+ return (12);
- case 98:
+ case (98):
- return 8;
+ return (8);
- case 116:
+ case (116):
- return 9;
+ return (9);
- case 118:
+ case (118):
- return 11;
+ return (11);
- case 120:
+ case (120):
- hexValue = this.readHex(2);
+ hexValue = this.readHex((2));
break;
- case 117:
+ case (117):
- if (this._maybeEatChar(123)) {
+ if (this._maybeEatChar((123))) {
hexValue = this.readHex();
- if (!this._maybeEatChar(125)) {
- return -1;
+ if (!this._maybeEatChar((125))) {
+ return (-1);
}
else {
break;
}
}
else {
- hexValue = this.readHex(4);
+ hexValue = this.readHex((4));
break;
}
@@ -7247,31 +7195,31 @@ TokenizerBase.prototype.readEscapeSequence = function() {
return ch;
}
- if (hexValue == -1) return -1;
- if (hexValue < 55296 || hexValue > 57343 && hexValue <= 65535) {
+ if (hexValue == (-1)) return (-1);
+ if (hexValue < (55296) || hexValue > (57343) && hexValue <= (65535)) {
return hexValue;
}
- else if (hexValue <= 1114111) {
+ else if (hexValue <= (1114111)) {
$globals.world.fatal("unicode values greater than 2 bytes not implemented yet");
- return -1;
+ return (-1);
}
else {
- return -1;
+ return (-1);
}
}
TokenizerBase.prototype.finishDot = function() {
if (TokenizerHelpers.isDigit(this._peekChar())) {
this.eatDigits();
- return this.finishNumberExtra(62/*TokenKind.DOUBLE*/);
+ return this.finishNumberExtra((62));
}
else {
- return this._finishToken(14/*TokenKind.DOT*/);
+ return this._finishToken((14));
}
}
TokenizerBase.prototype.finishIdentifier = function(ch) {
- if (this._interpStack != null && this._interpStack.depth == -1) {
- this._interpStack.depth = 0;
- if (ch == 36) {
+ if (this._interpStack != null && this._interpStack.depth == (-1)) {
+ this._interpStack.depth = (0);
+ if (ch == (36)) {
return this._errorToken("illegal character after $ in string interpolation");
}
while (this._lang_index < this._text.length) {
@@ -7290,8 +7238,8 @@ TokenizerBase.prototype.finishIdentifier = function(ch) {
}
}
var kind = this.getIdentifierKind();
- if (kind == 70/*TokenKind.IDENTIFIER*/) {
- return this._finishToken(70/*TokenKind.IDENTIFIER*/);
+ if (kind == (70)) {
+ return this._finishToken((70));
}
else {
return this._finishToken(kind);
@@ -7306,7 +7254,7 @@ function Tokenizer(source, skipWhitespace, index) {
}
Tokenizer.prototype.next = function() {
this._startIndex = this._lang_index;
- if (this._interpStack != null && this._interpStack.depth == 0) {
+ if (this._interpStack != null && this._interpStack.depth == (0)) {
var istack = this._interpStack;
this._interpStack = this._interpStack.pop();
if (istack.get$isMultiline()) {
@@ -7319,131 +7267,131 @@ Tokenizer.prototype.next = function() {
var ch;
ch = this._nextChar();
switch (ch) {
- case 0:
+ case (0):
- return this._finishToken(1/*TokenKind.END_OF_FILE*/);
+ return this._finishToken((1));
- case 32:
- case 9:
- case 10:
- case 13:
+ case (32):
+ case (9):
+ case (10):
+ case (13):
return this.finishWhitespace();
- case 33:
+ case (33):
- if (this._maybeEatChar(61)) {
- if (this._maybeEatChar(61)) {
- return this._finishToken(51/*TokenKind.NE_STRICT*/);
+ if (this._maybeEatChar((61))) {
+ if (this._maybeEatChar((61))) {
+ return this._finishToken((51));
}
else {
- return this._finishToken(49/*TokenKind.NE*/);
+ return this._finishToken((49));
}
}
else {
- return this._finishToken(19/*TokenKind.NOT*/);
+ return this._finishToken((19));
}
- case 34:
+ case (34):
- return this.finishString(34);
+ return this.finishString((34));
- case 35:
+ case (35):
- if (this._maybeEatChar(33)) {
+ if (this._maybeEatChar((33))) {
return this.finishHashBang();
}
else {
- return this._finishToken(12/*TokenKind.HASH*/);
+ return this._finishToken((12));
}
- case 36:
+ case (36):
- if (this._maybeEatChar(34)) {
- return this.finishString(34);
+ if (this._maybeEatChar((34))) {
+ return this.finishString((34));
}
- else if (this._maybeEatChar(39)) {
- return this.finishString(39);
+ else if (this._maybeEatChar((39))) {
+ return this.finishString((39));
}
else {
- return this.finishIdentifier(36);
+ return this.finishIdentifier((36));
}
- case 37:
+ case (37):
- if (this._maybeEatChar(61)) {
- return this._finishToken(32/*TokenKind.ASSIGN_MOD*/);
+ if (this._maybeEatChar((61))) {
+ return this._finishToken((32));
}
else {
- return this._finishToken(47/*TokenKind.MOD*/);
+ return this._finishToken((47));
}
- case 38:
+ case (38):
- if (this._maybeEatChar(38)) {
- return this._finishToken(35/*TokenKind.AND*/);
+ if (this._maybeEatChar((38))) {
+ return this._finishToken((35));
}
- else if (this._maybeEatChar(61)) {
- return this._finishToken(23/*TokenKind.ASSIGN_AND*/);
+ else if (this._maybeEatChar((61))) {
+ return this._finishToken((23));
}
else {
- return this._finishToken(38/*TokenKind.BIT_AND*/);
+ return this._finishToken((38));
}
- case 39:
+ case (39):
- return this.finishString(39);
+ return this.finishString((39));
- case 40:
+ case (40):
- return this._finishToken(2/*TokenKind.LPAREN*/);
+ return this._finishToken((2));
- case 41:
+ case (41):
- return this._finishToken(3/*TokenKind.RPAREN*/);
+ return this._finishToken((3));
- case 42:
+ case (42):
- if (this._maybeEatChar(61)) {
- return this._finishToken(29/*TokenKind.ASSIGN_MUL*/);
+ if (this._maybeEatChar((61))) {
+ return this._finishToken((29));
}
else {
- return this._finishToken(44/*TokenKind.MUL*/);
+ return this._finishToken((44));
}
- case 43:
+ case (43):
- if (this._maybeEatChar(43)) {
- return this._finishToken(16/*TokenKind.INCR*/);
+ if (this._maybeEatChar((43))) {
+ return this._finishToken((16));
}
- else if (this._maybeEatChar(61)) {
- return this._finishToken(27/*TokenKind.ASSIGN_ADD*/);
+ else if (this._maybeEatChar((61))) {
+ return this._finishToken((27));
}
else {
- return this._finishToken(42/*TokenKind.ADD*/);
+ return this._finishToken((42));
}
- case 44:
+ case (44):
- return this._finishToken(11/*TokenKind.COMMA*/);
+ return this._finishToken((11));
- case 45:
+ case (45):
- if (this._maybeEatChar(45)) {
- return this._finishToken(17/*TokenKind.DECR*/);
+ if (this._maybeEatChar((45))) {
+ return this._finishToken((17));
}
- else if (this._maybeEatChar(61)) {
- return this._finishToken(28/*TokenKind.ASSIGN_SUB*/);
+ else if (this._maybeEatChar((61))) {
+ return this._finishToken((28));
}
else {
- return this._finishToken(43/*TokenKind.SUB*/);
+ return this._finishToken((43));
}
- case 46:
+ case (46):
- if (this._maybeEatChar(46)) {
- if (this._maybeEatChar(46)) {
- return this._finishToken(15/*TokenKind.ELLIPSIS*/);
+ if (this._maybeEatChar((46))) {
+ if (this._maybeEatChar((46))) {
+ return this._finishToken((15));
}
else {
return this._errorToken();
@@ -7453,175 +7401,175 @@ Tokenizer.prototype.next = function() {
return this.finishDot();
}
- case 47:
+ case (47):
- if (this._maybeEatChar(42)) {
+ if (this._maybeEatChar((42))) {
return this.finishMultiLineComment();
}
- else if (this._maybeEatChar(47)) {
+ else if (this._maybeEatChar((47))) {
return this.finishSingleLineComment();
}
- else if (this._maybeEatChar(61)) {
- return this._finishToken(30/*TokenKind.ASSIGN_DIV*/);
+ else if (this._maybeEatChar((61))) {
+ return this._finishToken((30));
}
else {
- return this._finishToken(45/*TokenKind.DIV*/);
+ return this._finishToken((45));
}
- case 48:
+ case (48):
- if (this._maybeEatChar(88)) {
+ if (this._maybeEatChar((88))) {
return this.finishHex();
}
- else if (this._maybeEatChar(120)) {
+ else if (this._maybeEatChar((120))) {
return this.finishHex();
}
else {
return this.finishNumber();
}
- case 58:
+ case (58):
- return this._finishToken(8/*TokenKind.COLON*/);
+ return this._finishToken((8));
- case 59:
+ case (59):
- return this._finishToken(10/*TokenKind.SEMICOLON*/);
+ return this._finishToken((10));
- case 60:
+ case (60):
- if (this._maybeEatChar(60)) {
- if (this._maybeEatChar(61)) {
- return this._finishToken(24/*TokenKind.ASSIGN_SHL*/);
+ if (this._maybeEatChar((60))) {
+ if (this._maybeEatChar((61))) {
+ return this._finishToken((24));
}
else {
- return this._finishToken(39/*TokenKind.SHL*/);
+ return this._finishToken((39));
}
}
- else if (this._maybeEatChar(61)) {
- return this._finishToken(54/*TokenKind.LTE*/);
+ else if (this._maybeEatChar((61))) {
+ return this._finishToken((54));
}
else {
- return this._finishToken(52/*TokenKind.LT*/);
+ return this._finishToken((52));
}
- case 61:
+ case (61):
- if (this._maybeEatChar(61)) {
- if (this._maybeEatChar(61)) {
- return this._finishToken(50/*TokenKind.EQ_STRICT*/);
+ if (this._maybeEatChar((61))) {
+ if (this._maybeEatChar((61))) {
+ return this._finishToken((50));
}
else {
- return this._finishToken(48/*TokenKind.EQ*/);
+ return this._finishToken((48));
}
}
- else if (this._maybeEatChar(62)) {
- return this._finishToken(9/*TokenKind.ARROW*/);
+ else if (this._maybeEatChar((62))) {
+ return this._finishToken((9));
}
else {
- return this._finishToken(20/*TokenKind.ASSIGN*/);
+ return this._finishToken((20));
}
- case 62:
+ case (62):
- if (this._maybeEatChar(61)) {
- return this._finishToken(55/*TokenKind.GTE*/);
+ if (this._maybeEatChar((61))) {
+ return this._finishToken((55));
}
- else if (this._maybeEatChar(62)) {
- if (this._maybeEatChar(61)) {
- return this._finishToken(25/*TokenKind.ASSIGN_SAR*/);
+ else if (this._maybeEatChar((62))) {
+ if (this._maybeEatChar((61))) {
+ return this._finishToken((25));
}
- else if (this._maybeEatChar(62)) {
- if (this._maybeEatChar(61)) {
- return this._finishToken(26/*TokenKind.ASSIGN_SHR*/);
+ else if (this._maybeEatChar((62))) {
+ if (this._maybeEatChar((61))) {
+ return this._finishToken((26));
}
else {
- return this._finishToken(41/*TokenKind.SHR*/);
+ return this._finishToken((41));
}
}
else {
- return this._finishToken(40/*TokenKind.SAR*/);
+ return this._finishToken((40));
}
}
else {
- return this._finishToken(53/*TokenKind.GT*/);
+ return this._finishToken((53));
}
- case 63:
+ case (63):
- return this._finishToken(33/*TokenKind.CONDITIONAL*/);
+ return this._finishToken((33));
- case 64:
+ case (64):
- if (this._maybeEatChar(34)) {
- return this.finishRawString(34);
+ if (this._maybeEatChar((34))) {
+ return this.finishRawString((34));
}
- else if (this._maybeEatChar(39)) {
- return this.finishRawString(39);
+ else if (this._maybeEatChar((39))) {
+ return this.finishRawString((39));
}
else {
return this._errorToken();
}
- case 91:
+ case (91):
- if (this._maybeEatChar(93)) {
- if (this._maybeEatChar(61)) {
- return this._finishToken(57/*TokenKind.SETINDEX*/);
+ if (this._maybeEatChar((93))) {
+ if (this._maybeEatChar((61))) {
+ return this._finishToken((57));
}
else {
- return this._finishToken(56/*TokenKind.INDEX*/);
+ return this._finishToken((56));
}
}
else {
- return this._finishToken(4/*TokenKind.LBRACK*/);
+ return this._finishToken((4));
}
- case 93:
+ case (93):
- return this._finishToken(5/*TokenKind.RBRACK*/);
+ return this._finishToken((5));
- case 94:
+ case (94):
- if (this._maybeEatChar(61)) {
- return this._finishToken(22/*TokenKind.ASSIGN_XOR*/);
+ if (this._maybeEatChar((61))) {
+ return this._finishToken((22));
}
else {
- return this._finishToken(37/*TokenKind.BIT_XOR*/);
+ return this._finishToken((37));
}
- case 123:
+ case (123):
return this._finishOpenBrace();
- case 124:
+ case (124):
- if (this._maybeEatChar(61)) {
- return this._finishToken(21/*TokenKind.ASSIGN_OR*/);
+ if (this._maybeEatChar((61))) {
+ return this._finishToken((21));
}
- else if (this._maybeEatChar(124)) {
- return this._finishToken(34/*TokenKind.OR*/);
+ else if (this._maybeEatChar((124))) {
+ return this._finishToken((34));
}
else {
- return this._finishToken(36/*TokenKind.BIT_OR*/);
+ return this._finishToken((36));
}
- case 125:
+ case (125):
return this._finishCloseBrace();
- case 126:
+ case (126):
- if (this._maybeEatChar(47)) {
- if (this._maybeEatChar(61)) {
- return this._finishToken(31/*TokenKind.ASSIGN_TRUNCDIV*/);
+ if (this._maybeEatChar((47))) {
+ if (this._maybeEatChar((61))) {
+ return this._finishToken((31));
}
else {
- return this._finishToken(46/*TokenKind.TRUNCDIV*/);
+ return this._finishToken((46));
}
}
else {
- return this._finishToken(18/*TokenKind.BIT_NOT*/);
+ return this._finishToken((18));
}
default:
@@ -7642,204 +7590,204 @@ Tokenizer.prototype.getIdentifierKind = function() {
var i0 = this._startIndex;
var ch;
switch (this._lang_index - i0) {
- case 2:
+ case (2):
ch = this._text.charCodeAt(i0);
- if (ch == 100) {
- if (this._text.charCodeAt(i0 + 1) == 111) return 94/*TokenKind.DO*/;
+ if (ch == (100)) {
+ if (this._text.charCodeAt(i0 + (1)) == (111)) return (94);
}
- else if (ch == 105) {
- ch = this._text.charCodeAt(i0 + 1);
- if (ch == 102) {
- return 101/*TokenKind.IF*/;
+ else if (ch == (105)) {
+ ch = this._text.charCodeAt(i0 + (1));
+ if (ch == (102)) {
+ return (101);
}
- else if (ch == 110) {
- return 102/*TokenKind.IN*/;
+ else if (ch == (110)) {
+ return (102);
}
- else if (ch == 115) {
- return 103/*TokenKind.IS*/;
+ else if (ch == (115)) {
+ return (103);
}
}
- return 70/*TokenKind.IDENTIFIER*/;
+ return (70);
- case 3:
+ case (3):
ch = this._text.charCodeAt(i0);
- if (ch == 102) {
- if (this._text.charCodeAt(i0 + 1) == 111 && this._text.charCodeAt(i0 + 2) == 114) return 100/*TokenKind.FOR*/;
+ if (ch == (102)) {
+ if (this._text.charCodeAt(i0 + (1)) == (111) && this._text.charCodeAt(i0 + (2)) == (114)) return (100);
}
- else if (ch == 103) {
- if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2) == 116) return 74/*TokenKind.GET*/;
+ else if (ch == (103)) {
+ if (this._text.charCodeAt(i0 + (1)) == (101) && this._text.charCodeAt(i0 + (2)) == (116)) return (74);
}
- else if (ch == 110) {
- if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2) == 119) return 104/*TokenKind.NEW*/;
+ else if (ch == (110)) {
+ if (this._text.charCodeAt(i0 + (1)) == (101) && this._text.charCodeAt(i0 + (2)) == (119)) return (104);
}
- else if (ch == 115) {
- if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2) == 116) return 82/*TokenKind.SET*/;
+ else if (ch == (115)) {
+ if (this._text.charCodeAt(i0 + (1)) == (101) && this._text.charCodeAt(i0 + (2)) == (116)) return (82);
}
- else if (ch == 116) {
- if (this._text.charCodeAt(i0 + 1) == 114 && this._text.charCodeAt(i0 + 2) == 121) return 112/*TokenKind.TRY*/;
+ else if (ch == (116)) {
+ if (this._text.charCodeAt(i0 + (1)) == (114) && this._text.charCodeAt(i0 + (2)) == (121)) return (112);
}
- else if (ch == 118) {
- if (this._text.charCodeAt(i0 + 1) == 97 && this._text.charCodeAt(i0 + 2) == 114) return 113/*TokenKind.VAR*/;
+ else if (ch == (118)) {
+ if (this._text.charCodeAt(i0 + (1)) == (97) && this._text.charCodeAt(i0 + (2)) == (114)) return (113);
}
- return 70/*TokenKind.IDENTIFIER*/;
+ return (70);
- case 4:
+ case (4):
ch = this._text.charCodeAt(i0);
- if (ch == 99) {
- if (this._text.charCodeAt(i0 + 1) == 97 && this._text.charCodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 101) return 88/*TokenKind.CASE*/;
+ if (ch == (99)) {
+ if (this._text.charCodeAt(i0 + (1)) == (97) && this._text.charCodeAt(i0 + (2)) == (115) && this._text.charCodeAt(i0 + (3)) == (101)) return (88);
}
- else if (ch == 101) {
- if (this._text.charCodeAt(i0 + 1) == 108 && this._text.charCodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 101) return 95/*TokenKind.ELSE*/;
+ else if (ch == (101)) {
+ if (this._text.charCodeAt(i0 + (1)) == (108) && this._text.charCodeAt(i0 + (2)) == (115) && this._text.charCodeAt(i0 + (3)) == (101)) return (95);
}
- else if (ch == 110) {
- if (this._text.charCodeAt(i0 + 1) == 117 && this._text.charCodeAt(i0 + 2) == 108 && this._text.charCodeAt(i0 + 3) == 108) return 105/*TokenKind.NULL*/;
+ else if (ch == (110)) {
+ if (this._text.charCodeAt(i0 + (1)) == (117) && this._text.charCodeAt(i0 + (2)) == (108) && this._text.charCodeAt(i0 + (3)) == (108)) return (105);
}
- else if (ch == 116) {
- ch = this._text.charCodeAt(i0 + 1);
- if (ch == 104) {
- if (this._text.charCodeAt(i0 + 2) == 105 && this._text.charCodeAt(i0 + 3) == 115) return 109/*TokenKind.THIS*/;
+ else if (ch == (116)) {
+ ch = this._text.charCodeAt(i0 + (1));
+ if (ch == (104)) {
+ if (this._text.charCodeAt(i0 + (2)) == (105) && this._text.charCodeAt(i0 + (3)) == (115)) return (109);
}
- else if (ch == 114) {
- if (this._text.charCodeAt(i0 + 2) == 117 && this._text.charCodeAt(i0 + 3) == 101) return 111/*TokenKind.TRUE*/;
+ else if (ch == (114)) {
+ if (this._text.charCodeAt(i0 + (2)) == (117) && this._text.charCodeAt(i0 + (3)) == (101)) return (111);
}
}
- else if (ch == 118) {
- if (this._text.charCodeAt(i0 + 1) == 111 && this._text.charCodeAt(i0 + 2) == 105 && this._text.charCodeAt(i0 + 3) == 100) return 114/*TokenKind.VOID*/;
+ else if (ch == (118)) {
+ if (this._text.charCodeAt(i0 + (1)) == (111) && this._text.charCodeAt(i0 + (2)) == (105) && this._text.charCodeAt(i0 + (3)) == (100)) return (114);
}
- return 70/*TokenKind.IDENTIFIER*/;
+ return (70);
- case 5:
+ case (5):
ch = this._text.charCodeAt(i0);
- if (ch == 97) {
- if (this._text.charCodeAt(i0 + 1) == 119 && this._text.charCodeAt(i0 + 2) == 97 && this._text.charCodeAt(i0 + 3) == 105 && this._text.charCodeAt(i0 + 4) == 116) return 86/*TokenKind.AWAIT*/;
+ if (ch == (97)) {
+ if (this._text.charCodeAt(i0 + (1)) == (119) && this._text.charCodeAt(i0 + (2)) == (97) && this._text.charCodeAt(i0 + (3)) == (105) && this._text.charCodeAt(i0 + (4)) == (116)) return (86);
}
- else if (ch == 98) {
- if (this._text.charCodeAt(i0 + 1) == 114 && this._text.charCodeAt(i0 + 2) == 101 && this._text.charCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 107) return 87/*TokenKind.BREAK*/;
+ else if (ch == (98)) {
+ if (this._text.charCodeAt(i0 + (1)) == (114) && this._text.charCodeAt(i0 + (2)) == (101) && this._text.charCodeAt(i0 + (3)) == (97) && this._text.charCodeAt(i0 + (4)) == (107)) return (87);
}
- else if (ch == 99) {
- ch = this._text.charCodeAt(i0 + 1);
- if (ch == 97) {
- if (this._text.charCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 + 3) == 99 && this._text.charCodeAt(i0 + 4) == 104) return 89/*TokenKind.CATCH*/;
+ else if (ch == (99)) {
+ ch = this._text.charCodeAt(i0 + (1));
+ if (ch == (97)) {
+ if (this._text.charCodeAt(i0 + (2)) == (116) && this._text.charCodeAt(i0 + (3)) == (99) && this._text.charCodeAt(i0 + (4)) == (104)) return (89);
}
- else if (ch == 108) {
- if (this._text.charCodeAt(i0 + 2) == 97 && this._text.charCodeAt(i0 + 3) == 115 && this._text.charCodeAt(i0 + 4) == 115) return 90/*TokenKind.CLASS*/;
+ else if (ch == (108)) {
+ if (this._text.charCodeAt(i0 + (2)) == (97) && this._text.charCodeAt(i0 + (3)) == (115) && this._text.charCodeAt(i0 + (4)) == (115)) return (90);
}
- else if (ch == 111) {
- if (this._text.charCodeAt(i0 + 2) == 110 && this._text.charCodeAt(i0 + 3) == 115 && this._text.charCodeAt(i0 + 4) == 116) return 91/*TokenKind.CONST*/;
+ else if (ch == (111)) {
+ if (this._text.charCodeAt(i0 + (2)) == (110) && this._text.charCodeAt(i0 + (3)) == (115) && this._text.charCodeAt(i0 + (4)) == (116)) return (91);
}
}
- else if (ch == 102) {
- ch = this._text.charCodeAt(i0 + 1);
- if (ch == 97) {
- if (this._text.charCodeAt(i0 + 2) == 108 && this._text.charCodeAt(i0 + 3) == 115 && this._text.charCodeAt(i0 + 4) == 101) return 97/*TokenKind.FALSE*/;
+ else if (ch == (102)) {
+ ch = this._text.charCodeAt(i0 + (1));
+ if (ch == (97)) {
+ if (this._text.charCodeAt(i0 + (2)) == (108) && this._text.charCodeAt(i0 + (3)) == (115) && this._text.charCodeAt(i0 + (4)) == (101)) return (97);
}
- else if (ch == 105) {
- if (this._text.charCodeAt(i0 + 2) == 110 && this._text.charCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 108) return 98/*TokenKind.FINAL*/;
+ else if (ch == (105)) {
+ if (this._text.charCodeAt(i0 + (2)) == (110) && this._text.charCodeAt(i0 + (3)) == (97) && this._text.charCodeAt(i0 + (4)) == (108)) return (98);
}
}
- else if (ch == 115) {
- if (this._text.charCodeAt(i0 + 1) == 117 && this._text.charCodeAt(i0 + 2) == 112 && this._text.charCodeAt(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4) == 114) return 107/*TokenKind.SUPER*/;
+ else if (ch == (115)) {
+ if (this._text.charCodeAt(i0 + (1)) == (117) && this._text.charCodeAt(i0 + (2)) == (112) && this._text.charCodeAt(i0 + (3)) == (101) && this._text.charCodeAt(i0 + (4)) == (114)) return (107);
}
- else if (ch == 116) {
- if (this._text.charCodeAt(i0 + 1) == 104 && this._text.charCodeAt(i0 + 2) == 114 && this._text.charCodeAt(i0 + 3) == 111 && this._text.charCodeAt(i0 + 4) == 119) return 110/*TokenKind.THROW*/;
+ else if (ch == (116)) {
+ if (this._text.charCodeAt(i0 + (1)) == (104) && this._text.charCodeAt(i0 + (2)) == (114) && this._text.charCodeAt(i0 + (3)) == (111) && this._text.charCodeAt(i0 + (4)) == (119)) return (110);
}
- else if (ch == 119) {
- if (this._text.charCodeAt(i0 + 1) == 104 && this._text.charCodeAt(i0 + 2) == 105 && this._text.charCodeAt(i0 + 3) == 108 && this._text.charCodeAt(i0 + 4) == 101) return 115/*TokenKind.WHILE*/;
+ else if (ch == (119)) {
+ if (this._text.charCodeAt(i0 + (1)) == (104) && this._text.charCodeAt(i0 + (2)) == (105) && this._text.charCodeAt(i0 + (3)) == (108) && this._text.charCodeAt(i0 + (4)) == (101)) return (115);
}
- return 70/*TokenKind.IDENTIFIER*/;
+ return (70);
- case 6:
+ case (6):
ch = this._text.charCodeAt(i0);
- if (ch == 97) {
- if (this._text.charCodeAt(i0 + 1) == 115 && this._text.charCodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 116) return 72/*TokenKind.ASSERT*/;
+ if (ch == (97)) {
+ if (this._text.charCodeAt(i0 + (1)) == (115) && this._text.charCodeAt(i0 + (2)) == (115) && this._text.charCodeAt(i0 + (3)) == (101) && this._text.charCodeAt(i0 + (4)) == (114) && this._text.charCodeAt(i0 + (5)) == (116)) return (72);
}
- else if (ch == 105) {
- if (this._text.charCodeAt(i0 + 1) == 109 && this._text.charCodeAt(i0 + 2) == 112 && this._text.charCodeAt(i0 + 3) == 111 && this._text.charCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 116) return 76/*TokenKind.IMPORT*/;
+ else if (ch == (105)) {
+ if (this._text.charCodeAt(i0 + (1)) == (109) && this._text.charCodeAt(i0 + (2)) == (112) && this._text.charCodeAt(i0 + (3)) == (111) && this._text.charCodeAt(i0 + (4)) == (114) && this._text.charCodeAt(i0 + (5)) == (116)) return (76);
}
- else if (ch == 110) {
- ch = this._text.charCodeAt(i0 + 1);
- if (ch == 97) {
- if (this._text.charCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 + 3) == 105 && this._text.charCodeAt(i0 + 4) == 118 && this._text.charCodeAt(i0 + 5) == 101) return 79/*TokenKind.NATIVE*/;
+ else if (ch == (110)) {
+ ch = this._text.charCodeAt(i0 + (1));
+ if (ch == (97)) {
+ if (this._text.charCodeAt(i0 + (2)) == (116) && this._text.charCodeAt(i0 + (3)) == (105) && this._text.charCodeAt(i0 + (4)) == (118) && this._text.charCodeAt(i0 + (5)) == (101)) return (79);
}
- else if (ch == 101) {
- if (this._text.charCodeAt(i0 + 2) == 103 && this._text.charCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 116 && this._text.charCodeAt(i0 + 5) == 101) return 80/*TokenKind.NEGATE*/;
+ else if (ch == (101)) {
+ if (this._text.charCodeAt(i0 + (2)) == (103) && this._text.charCodeAt(i0 + (3)) == (97) && this._text.charCodeAt(i0 + (4)) == (116) && this._text.charCodeAt(i0 + (5)) == (101)) return (80);
}
}
- else if (ch == 114) {
- if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 + 3) == 117 && this._text.charCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 110) return 106/*TokenKind.RETURN*/;
+ else if (ch == (114)) {
+ if (this._text.charCodeAt(i0 + (1)) == (101) && this._text.charCodeAt(i0 + (2)) == (116) && this._text.charCodeAt(i0 + (3)) == (117) && this._text.charCodeAt(i0 + (4)) == (114) && this._text.charCodeAt(i0 + (5)) == (110)) return (106);
}
- else if (ch == 115) {
- ch = this._text.charCodeAt(i0 + 1);
- if (ch == 111) {
- if (this._text.charCodeAt(i0 + 2) == 117 && this._text.charCodeAt(i0 + 3) == 114 && this._text.charCodeAt(i0 + 4) == 99 && this._text.charCodeAt(i0 + 5) == 101) return 83/*TokenKind.SOURCE*/;
+ else if (ch == (115)) {
+ ch = this._text.charCodeAt(i0 + (1));
+ if (ch == (111)) {
+ if (this._text.charCodeAt(i0 + (2)) == (117) && this._text.charCodeAt(i0 + (3)) == (114) && this._text.charCodeAt(i0 + (4)) == (99) && this._text.charCodeAt(i0 + (5)) == (101)) return (83);
}
- else if (ch == 116) {
- if (this._text.charCodeAt(i0 + 2) == 97 && this._text.charCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 105 && this._text.charCodeAt(i0 + 5) == 99) return 84/*TokenKind.STATIC*/;
+ else if (ch == (116)) {
+ if (this._text.charCodeAt(i0 + (2)) == (97) && this._text.charCodeAt(i0 + (3)) == (116) && this._text.charCodeAt(i0 + (4)) == (105) && this._text.charCodeAt(i0 + (5)) == (99)) return (84);
}
- else if (ch == 119) {
- if (this._text.charCodeAt(i0 + 2) == 105 && this._text.charCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 99 && this._text.charCodeAt(i0 + 5) == 104) return 108/*TokenKind.SWITCH*/;
+ else if (ch == (119)) {
+ if (this._text.charCodeAt(i0 + (2)) == (105) && this._text.charCodeAt(i0 + (3)) == (116) && this._text.charCodeAt(i0 + (4)) == (99) && this._text.charCodeAt(i0 + (5)) == (104)) return (108);
}
}
- return 70/*TokenKind.IDENTIFIER*/;
+ return (70);
- case 7:
+ case (7):
ch = this._text.charCodeAt(i0);
- if (ch == 100) {
- if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2) == 102 && this._text.charCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 117 && this._text.charCodeAt(i0 + 5) == 108 && this._text.charCodeAt(i0 + 6) == 116) return 93/*TokenKind.DEFAULT*/;
+ if (ch == (100)) {
+ if (this._text.charCodeAt(i0 + (1)) == (101) && this._text.charCodeAt(i0 + (2)) == (102) && this._text.charCodeAt(i0 + (3)) == (97) && this._text.charCodeAt(i0 + (4)) == (117) && this._text.charCodeAt(i0 + (5)) == (108) && this._text.charCodeAt(i0 + (6)) == (116)) return (93);
}
- else if (ch == 101) {
- if (this._text.charCodeAt(i0 + 1) == 120 && this._text.charCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4) == 110 && this._text.charCodeAt(i0 + 5) == 100 && this._text.charCodeAt(i0 + 6) == 115) return 96/*TokenKind.EXTENDS*/;
+ else if (ch == (101)) {
+ if (this._text.charCodeAt(i0 + (1)) == (120) && this._text.charCodeAt(i0 + (2)) == (116) && this._text.charCodeAt(i0 + (3)) == (101) && this._text.charCodeAt(i0 + (4)) == (110) && this._text.charCodeAt(i0 + (5)) == (100) && this._text.charCodeAt(i0 + (6)) == (115)) return (96);
}
- else if (ch == 102) {
- ch = this._text.charCodeAt(i0 + 1);
- if (ch == 97) {
- if (this._text.charCodeAt(i0 + 2) == 99 && this._text.charCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 111 && this._text.charCodeAt(i0 + 5) == 114 && this._text.charCodeAt(i0 + 6) == 121) return 73/*TokenKind.FACTORY*/;
+ else if (ch == (102)) {
+ ch = this._text.charCodeAt(i0 + (1));
+ if (ch == (97)) {
+ if (this._text.charCodeAt(i0 + (2)) == (99) && this._text.charCodeAt(i0 + (3)) == (116) && this._text.charCodeAt(i0 + (4)) == (111) && this._text.charCodeAt(i0 + (5)) == (114) && this._text.charCodeAt(i0 + (6)) == (121)) return (73);
}
- else if (ch == 105) {
- if (this._text.charCodeAt(i0 + 2) == 110 && this._text.charCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 108 && this._text.charCodeAt(i0 + 5) == 108 && this._text.charCodeAt(i0 + 6) == 121) return 99/*TokenKind.FINALLY*/;
+ else if (ch == (105)) {
+ if (this._text.charCodeAt(i0 + (2)) == (110) && this._text.charCodeAt(i0 + (3)) == (97) && this._text.charCodeAt(i0 + (4)) == (108) && this._text.charCodeAt(i0 + (5)) == (108) && this._text.charCodeAt(i0 + (6)) == (121)) return (99);
}
}
- else if (ch == 108) {
- if (this._text.charCodeAt(i0 + 1) == 105 && this._text.charCodeAt(i0 + 2) == 98 && this._text.charCodeAt(i0 + 3) == 114 && this._text.charCodeAt(i0 + 4) == 97 && this._text.charCodeAt(i0 + 5) == 114 && this._text.charCodeAt(i0 + 6) == 121) return 78/*TokenKind.LIBRARY*/;
+ else if (ch == (108)) {
+ if (this._text.charCodeAt(i0 + (1)) == (105) && this._text.charCodeAt(i0 + (2)) == (98) && this._text.charCodeAt(i0 + (3)) == (114) && this._text.charCodeAt(i0 + (4)) == (97) && this._text.charCodeAt(i0 + (5)) == (114) && this._text.charCodeAt(i0 + (6)) == (121)) return (78);
}
- else if (ch == 116) {
- if (this._text.charCodeAt(i0 + 1) == 121 && this._text.charCodeAt(i0 + 2) == 112 && this._text.charCodeAt(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4) == 100 && this._text.charCodeAt(i0 + 5) == 101 && this._text.charCodeAt(i0 + 6) == 102) return 85/*TokenKind.TYPEDEF*/;
+ else if (ch == (116)) {
+ if (this._text.charCodeAt(i0 + (1)) == (121) && this._text.charCodeAt(i0 + (2)) == (112) && this._text.charCodeAt(i0 + (3)) == (101) && this._text.charCodeAt(i0 + (4)) == (100) && this._text.charCodeAt(i0 + (5)) == (101) && this._text.charCodeAt(i0 + (6)) == (102)) return (85);
}
- return 70/*TokenKind.IDENTIFIER*/;
+ return (70);
- case 8:
+ case (8):
ch = this._text.charCodeAt(i0);
- if (ch == 97) {
- if (this._text.charCodeAt(i0 + 1) == 98 && this._text.charCodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 97 && this._text.charCodeAt(i0 + 6) == 99 && this._text.charCodeAt(i0 + 7) == 116) return 71/*TokenKind.ABSTRACT*/;
+ if (ch == (97)) {
+ if (this._text.charCodeAt(i0 + (1)) == (98) && this._text.charCodeAt(i0 + (2)) == (115) && this._text.charCodeAt(i0 + (3)) == (116) && this._text.charCodeAt(i0 + (4)) == (114) && this._text.charCodeAt(i0 + (5)) == (97) && this._text.charCodeAt(i0 + (6)) == (99) && this._text.charCodeAt(i0 + (7)) == (116)) return (71);
}
- else if (ch == 99) {
- if (this._text.charCodeAt(i0 + 1) == 111 && this._text.charCodeAt(i0 + 2) == 110 && this._text.charCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 105 && this._text.charCodeAt(i0 + 5) == 110 && this._text.charCodeAt(i0 + 6) == 117 && this._text.charCodeAt(i0 + 7) == 101) return 92/*TokenKind.CONTINUE*/;
+ else if (ch == (99)) {
+ if (this._text.charCodeAt(i0 + (1)) == (111) && this._text.charCodeAt(i0 + (2)) == (110) && this._text.charCodeAt(i0 + (3)) == (116) && this._text.charCodeAt(i0 + (4)) == (105) && this._text.charCodeAt(i0 + (5)) == (110) && this._text.charCodeAt(i0 + (6)) == (117) && this._text.charCodeAt(i0 + (7)) == (101)) return (92);
}
- else if (ch == 111) {
- if (this._text.charCodeAt(i0 + 1) == 112 && this._text.charCodeAt(i0 + 2) == 101 && this._text.charCodeAt(i0 + 3) == 114 && this._text.charCodeAt(i0 + 4) == 97 && this._text.charCodeAt(i0 + 5) == 116 && this._text.charCodeAt(i0 + 6) == 111 && this._text.charCodeAt(i0 + 7) == 114) return 81/*TokenKind.OPERATOR*/;
+ else if (ch == (111)) {
+ if (this._text.charCodeAt(i0 + (1)) == (112) && this._text.charCodeAt(i0 + (2)) == (101) && this._text.charCodeAt(i0 + (3)) == (114) && this._text.charCodeAt(i0 + (4)) == (97) && this._text.charCodeAt(i0 + (5)) == (116) && this._text.charCodeAt(i0 + (6)) == (111) && this._text.charCodeAt(i0 + (7)) == (114)) return (81);
}
- return 70/*TokenKind.IDENTIFIER*/;
+ return (70);
- case 9:
+ case (9):
- if (this._text.charCodeAt(i0) == 105 && this._text.charCodeAt(i0 + 1) == 110 && this._text.charCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 102 && this._text.charCodeAt(i0 + 6) == 97 && this._text.charCodeAt(i0 + 7) == 99 && this._text.charCodeAt(i0 + 8) == 101) return 77/*TokenKind.INTERFACE*/;
- return 70/*TokenKind.IDENTIFIER*/;
+ if (this._text.charCodeAt(i0) == (105) && this._text.charCodeAt(i0 + (1)) == (110) && this._text.charCodeAt(i0 + (2)) == (116) && this._text.charCodeAt(i0 + (3)) == (101) && this._text.charCodeAt(i0 + (4)) == (114) && this._text.charCodeAt(i0 + (5)) == (102) && this._text.charCodeAt(i0 + (6)) == (97) && this._text.charCodeAt(i0 + (7)) == (99) && this._text.charCodeAt(i0 + (8)) == (101)) return (77);
+ return (70);
- case 10:
+ case (10):
- if (this._text.charCodeAt(i0) == 105 && this._text.charCodeAt(i0 + 1) == 109 && this._text.charCodeAt(i0 + 2) == 112 && this._text.charCodeAt(i0 + 3) == 108 && this._text.charCodeAt(i0 + 4) == 101 && this._text.charCodeAt(i0 + 5) == 109 && this._text.charCodeAt(i0 + 6) == 101 && this._text.charCodeAt(i0 + 7) == 110 && this._text.charCodeAt(i0 + 8) == 116 && this._text.charCodeAt(i0 + 9) == 115) return 75/*TokenKind.IMPLEMENTS*/;
- return 70/*TokenKind.IDENTIFIER*/;
+ if (this._text.charCodeAt(i0) == (105) && this._text.charCodeAt(i0 + (1)) == (109) && this._text.charCodeAt(i0 + (2)) == (112) && this._text.charCodeAt(i0 + (3)) == (108) && this._text.charCodeAt(i0 + (4)) == (101) && this._text.charCodeAt(i0 + (5)) == (109) && this._text.charCodeAt(i0 + (6)) == (101) && this._text.charCodeAt(i0 + (7)) == (110) && this._text.charCodeAt(i0 + (8)) == (116) && this._text.charCodeAt(i0 + (9)) == (115)) return (75);
+ return (70);
default:
- return 70/*TokenKind.IDENTIFIER*/;
+ return (70);
}
}
@@ -7848,463 +7796,463 @@ Tokenizer.prototype.next$0 = Tokenizer.prototype.next;
function TokenKind() {}
TokenKind.kindToString = function(kind) {
switch (kind) {
- case 1/*TokenKind.END_OF_FILE*/:
+ case (1):
return "end of file";
- case 2/*TokenKind.LPAREN*/:
+ case (2):
return "(";
- case 3/*TokenKind.RPAREN*/:
+ case (3):
return ")";
- case 4/*TokenKind.LBRACK*/:
+ case (4):
return "[";
- case 5/*TokenKind.RBRACK*/:
+ case (5):
return "]";
- case 6/*TokenKind.LBRACE*/:
+ case (6):
return "{";
- case 7/*TokenKind.RBRACE*/:
+ case (7):
return "}";
- case 8/*TokenKind.COLON*/:
+ case (8):
return ":";
- case 9/*TokenKind.ARROW*/:
+ case (9):
return "=>";
- case 10/*TokenKind.SEMICOLON*/:
+ case (10):
return ";";
- case 11/*TokenKind.COMMA*/:
+ case (11):
return ",";
- case 12/*TokenKind.HASH*/:
+ case (12):
return "#";
- case 13/*TokenKind.HASHBANG*/:
+ case (13):
return "#!";
- case 14/*TokenKind.DOT*/:
+ case (14):
return ".";
- case 15/*TokenKind.ELLIPSIS*/:
+ case (15):
return "...";
- case 16/*TokenKind.INCR*/:
+ case (16):
return "++";
- case 17/*TokenKind.DECR*/:
+ case (17):
return "--";
- case 18/*TokenKind.BIT_NOT*/:
+ case (18):
return "~";
- case 19/*TokenKind.NOT*/:
+ case (19):
return "!";
- case 20/*TokenKind.ASSIGN*/:
+ case (20):
return "=";
- case 21/*TokenKind.ASSIGN_OR*/:
+ case (21):
return "|=";
- case 22/*TokenKind.ASSIGN_XOR*/:
+ case (22):
return "^=";
- case 23/*TokenKind.ASSIGN_AND*/:
+ case (23):
return "&=";
- case 24/*TokenKind.ASSIGN_SHL*/:
+ case (24):
return "<<=";
- case 25/*TokenKind.ASSIGN_SAR*/:
+ case (25):
return ">>=";
- case 26/*TokenKind.ASSIGN_SHR*/:
+ case (26):
return ">>>=";
- case 27/*TokenKind.ASSIGN_ADD*/:
+ case (27):
return "+=";
- case 28/*TokenKind.ASSIGN_SUB*/:
+ case (28):
return "-=";
- case 29/*TokenKind.ASSIGN_MUL*/:
+ case (29):
return "*=";
- case 30/*TokenKind.ASSIGN_DIV*/:
+ case (30):
return "/=";
- case 31/*TokenKind.ASSIGN_TRUNCDIV*/:
+ case (31):
return "~/=";
- case 32/*TokenKind.ASSIGN_MOD*/:
+ case (32):
return "%=";
- case 33/*TokenKind.CONDITIONAL*/:
+ case (33):
return "?";
- case 34/*TokenKind.OR*/:
+ case (34):
return "||";
- case 35/*TokenKind.AND*/:
+ case (35):
return "&&";
- case 36/*TokenKind.BIT_OR*/:
+ case (36):
return "|";
- case 37/*TokenKind.BIT_XOR*/:
+ case (37):
return "^";
- case 38/*TokenKind.BIT_AND*/:
+ case (38):
return "&";
- case 39/*TokenKind.SHL*/:
+ case (39):
return "<<";
- case 40/*TokenKind.SAR*/:
+ case (40):
return ">>";
- case 41/*TokenKind.SHR*/:
+ case (41):
return ">>>";
- case 42/*TokenKind.ADD*/:
+ case (42):
return "+";
- case 43/*TokenKind.SUB*/:
+ case (43):
return "-";
- case 44/*TokenKind.MUL*/:
+ case (44):
return "*";
- case 45/*TokenKind.DIV*/:
+ case (45):
return "/";
- case 46/*TokenKind.TRUNCDIV*/:
+ case (46):
return "~/";
- case 47/*TokenKind.MOD*/:
+ case (47):
return "%";
- case 48/*TokenKind.EQ*/:
+ case (48):
return "==";
- case 49/*TokenKind.NE*/:
+ case (49):
return "!=";
- case 50/*TokenKind.EQ_STRICT*/:
+ case (50):
return "===";
- case 51/*TokenKind.NE_STRICT*/:
+ case (51):
return "!==";
- case 52/*TokenKind.LT*/:
+ case (52):
return "<";
- case 53/*TokenKind.GT*/:
+ case (53):
return ">";
- case 54/*TokenKind.LTE*/:
+ case (54):
return "<=";
- case 55/*TokenKind.GTE*/:
+ case (55):
return ">=";
- case 56/*TokenKind.INDEX*/:
+ case (56):
return "[]";
- case 57/*TokenKind.SETINDEX*/:
+ case (57):
return "[]=";
- case 58/*TokenKind.STRING*/:
+ case (58):
return "string";
- case 59/*TokenKind.STRING_PART*/:
+ case (59):
return "string part";
- case 60/*TokenKind.INTEGER*/:
+ case (60):
return "integer";
- case 61/*TokenKind.HEX_INTEGER*/:
+ case (61):
return "hex integer";
- case 62/*TokenKind.DOUBLE*/:
+ case (62):
return "double";
- case 63/*TokenKind.WHITESPACE*/:
+ case (63):
return "whitespace";
- case 64/*TokenKind.COMMENT*/:
+ case (64):
return "comment";
- case 65/*TokenKind.ERROR*/:
+ case (65):
return "error";
- case 66/*TokenKind.INCOMPLETE_STRING*/:
+ case (66):
return "incomplete string";
- case 67/*TokenKind.INCOMPLETE_COMMENT*/:
+ case (67):
return "incomplete comment";
- case 68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/:
+ case (68):
return "incomplete multiline string dq";
- case 69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/:
+ case (69):
return "incomplete multiline string sq";
- case 70/*TokenKind.IDENTIFIER*/:
+ case (70):
return "identifier";
- case 71/*TokenKind.ABSTRACT*/:
+ case (71):
return "pseudo-keyword 'abstract'";
- case 72/*TokenKind.ASSERT*/:
+ case (72):
return "pseudo-keyword 'assert'";
- case 90/*TokenKind.CLASS*/:
+ case (90):
return "pseudo-keyword 'class'";
- case 96/*TokenKind.EXTENDS*/:
+ case (96):
return "pseudo-keyword 'extends'";
- case 73/*TokenKind.FACTORY*/:
+ case (73):
return "pseudo-keyword 'factory'";
- case 74/*TokenKind.GET*/:
+ case (74):
return "pseudo-keyword 'get'";
- case 75/*TokenKind.IMPLEMENTS*/:
+ case (75):
return "pseudo-keyword 'implements'";
- case 76/*TokenKind.IMPORT*/:
+ case (76):
return "pseudo-keyword 'import'";
- case 77/*TokenKind.INTERFACE*/:
+ case (77):
return "pseudo-keyword 'interface'";
- case 78/*TokenKind.LIBRARY*/:
+ case (78):
return "pseudo-keyword 'library'";
- case 79/*TokenKind.NATIVE*/:
+ case (79):
return "pseudo-keyword 'native'";
- case 80/*TokenKind.NEGATE*/:
+ case (80):
return "pseudo-keyword 'negate'";
- case 81/*TokenKind.OPERATOR*/:
+ case (81):
return "pseudo-keyword 'operator'";
- case 82/*TokenKind.SET*/:
+ case (82):
return "pseudo-keyword 'set'";
- case 83/*TokenKind.SOURCE*/:
+ case (83):
return "pseudo-keyword 'source'";
- case 84/*TokenKind.STATIC*/:
+ case (84):
return "pseudo-keyword 'static'";
- case 85/*TokenKind.TYPEDEF*/:
+ case (85):
return "pseudo-keyword 'typedef'";
- case 86/*TokenKind.AWAIT*/:
+ case (86):
return "keyword 'await'";
- case 87/*TokenKind.BREAK*/:
+ case (87):
return "keyword 'break'";
- case 88/*TokenKind.CASE*/:
+ case (88):
return "keyword 'case'";
- case 89/*TokenKind.CATCH*/:
+ case (89):
return "keyword 'catch'";
- case 91/*TokenKind.CONST*/:
+ case (91):
return "keyword 'const'";
- case 92/*TokenKind.CONTINUE*/:
+ case (92):
return "keyword 'continue'";
- case 93/*TokenKind.DEFAULT*/:
+ case (93):
return "keyword 'default'";
- case 94/*TokenKind.DO*/:
+ case (94):
return "keyword 'do'";
- case 95/*TokenKind.ELSE*/:
+ case (95):
return "keyword 'else'";
- case 97/*TokenKind.FALSE*/:
+ case (97):
return "keyword 'false'";
- case 98/*TokenKind.FINAL*/:
+ case (98):
return "keyword 'final'";
- case 99/*TokenKind.FINALLY*/:
+ case (99):
return "keyword 'finally'";
- case 100/*TokenKind.FOR*/:
+ case (100):
return "keyword 'for'";
- case 101/*TokenKind.IF*/:
+ case (101):
return "keyword 'if'";
- case 102/*TokenKind.IN*/:
+ case (102):
return "keyword 'in'";
- case 103/*TokenKind.IS*/:
+ case (103):
return "keyword 'is'";
- case 104/*TokenKind.NEW*/:
+ case (104):
return "keyword 'new'";
- case 105/*TokenKind.NULL*/:
+ case (105):
return "keyword 'null'";
- case 106/*TokenKind.RETURN*/:
+ case (106):
return "keyword 'return'";
- case 107/*TokenKind.SUPER*/:
+ case (107):
return "keyword 'super'";
- case 108/*TokenKind.SWITCH*/:
+ case (108):
return "keyword 'switch'";
- case 109/*TokenKind.THIS*/:
+ case (109):
return "keyword 'this'";
- case 110/*TokenKind.THROW*/:
+ case (110):
return "keyword 'throw'";
- case 111/*TokenKind.TRUE*/:
+ case (111):
return "keyword 'true'";
- case 112/*TokenKind.TRY*/:
+ case (112):
return "keyword 'try'";
- case 113/*TokenKind.VAR*/:
+ case (113):
return "keyword 'var'";
- case 114/*TokenKind.VOID*/:
+ case (114):
return "keyword 'void'";
- case 115/*TokenKind.WHILE*/:
+ case (115):
return "keyword 'while'";
@@ -8315,161 +8263,161 @@ TokenKind.kindToString = function(kind) {
}
}
TokenKind.isIdentifier = function(kind) {
- return kind >= 70/*TokenKind.IDENTIFIER*/ && kind < 86/*TokenKind.AWAIT*/;
+ return kind >= (70) && kind < (86);
}
TokenKind.infixPrecedence = function(kind) {
switch (kind) {
- case 20/*TokenKind.ASSIGN*/:
+ case (20):
- return 2;
+ return (2);
- case 21/*TokenKind.ASSIGN_OR*/:
+ case (21):
- return 2;
+ return (2);
- case 22/*TokenKind.ASSIGN_XOR*/:
+ case (22):
- return 2;
+ return (2);
- case 23/*TokenKind.ASSIGN_AND*/:
+ case (23):
- return 2;
+ return (2);
- case 24/*TokenKind.ASSIGN_SHL*/:
+ case (24):
- return 2;
+ return (2);
- case 25/*TokenKind.ASSIGN_SAR*/:
+ case (25):
- return 2;
+ return (2);
- case 26/*TokenKind.ASSIGN_SHR*/:
+ case (26):
- return 2;
+ return (2);
- case 27/*TokenKind.ASSIGN_ADD*/:
+ case (27):
- return 2;
+ return (2);
- case 28/*TokenKind.ASSIGN_SUB*/:
+ case (28):
- return 2;
+ return (2);
- case 29/*TokenKind.ASSIGN_MUL*/:
+ case (29):
- return 2;
+ return (2);
- case 30/*TokenKind.ASSIGN_DIV*/:
+ case (30):
- return 2;
+ return (2);
- case 31/*TokenKind.ASSIGN_TRUNCDIV*/:
+ case (31):
- return 2;
+ return (2);
- case 32/*TokenKind.ASSIGN_MOD*/:
+ case (32):
- return 2;
+ return (2);
- case 33/*TokenKind.CONDITIONAL*/:
+ case (33):
- return 3;
+ return (3);
- case 34/*TokenKind.OR*/:
+ case (34):
- return 4;
+ return (4);
- case 35/*TokenKind.AND*/:
+ case (35):
- return 5;
+ return (5);
- case 36/*TokenKind.BIT_OR*/:
+ case (36):
- return 6;
+ return (6);
- case 37/*TokenKind.BIT_XOR*/:
+ case (37):
- return 7;
+ return (7);
- case 38/*TokenKind.BIT_AND*/:
+ case (38):
- return 8;
+ return (8);
- case 39/*TokenKind.SHL*/:
+ case (39):
- return 11;
+ return (11);
- case 40/*TokenKind.SAR*/:
+ case (40):
- return 11;
+ return (11);
- case 41/*TokenKind.SHR*/:
+ case (41):
- return 11;
+ return (11);
- case 42/*TokenKind.ADD*/:
+ case (42):
- return 12;
+ return (12);
- case 43/*TokenKind.SUB*/:
+ case (43):
- return 12;
+ return (12);
- case 44/*TokenKind.MUL*/:
+ case (44):
- return 13;
+ return (13);
- case 45/*TokenKind.DIV*/:
+ case (45):
- return 13;
+ return (13);
- case 46/*TokenKind.TRUNCDIV*/:
+ case (46):
- return 13;
+ return (13);
- case 47/*TokenKind.MOD*/:
+ case (47):
- return 13;
+ return (13);
- case 48/*TokenKind.EQ*/:
+ case (48):
- return 9;
+ return (9);
- case 49/*TokenKind.NE*/:
+ case (49):
- return 9;
+ return (9);
- case 50/*TokenKind.EQ_STRICT*/:
+ case (50):
- return 9;
+ return (9);
- case 51/*TokenKind.NE_STRICT*/:
+ case (51):
- return 9;
+ return (9);
- case 52/*TokenKind.LT*/:
+ case (52):
- return 10;
+ return (10);
- case 53/*TokenKind.GT*/:
+ case (53):
- return 10;
+ return (10);
- case 54/*TokenKind.LTE*/:
+ case (54):
- return 10;
+ return (10);
- case 55/*TokenKind.GTE*/:
+ case (55):
- return 10;
+ return (10);
- case 103/*TokenKind.IS*/:
+ case (103):
- return 10;
+ return (10);
default:
- return -1;
+ return (-1);
}
}
@@ -8563,99 +8511,99 @@ TokenKind.rawOperatorFromMethod = function(name) {
}
TokenKind.binaryMethodName = function(kind) {
switch (kind) {
- case 18/*TokenKind.BIT_NOT*/:
+ case (18):
return ":bit_not";
- case 36/*TokenKind.BIT_OR*/:
+ case (36):
return ":bit_or";
- case 37/*TokenKind.BIT_XOR*/:
+ case (37):
return ":bit_xor";
- case 38/*TokenKind.BIT_AND*/:
+ case (38):
return ":bit_and";
- case 39/*TokenKind.SHL*/:
+ case (39):
return ":shl";
- case 40/*TokenKind.SAR*/:
+ case (40):
return ":sar";
- case 41/*TokenKind.SHR*/:
+ case (41):
return ":shr";
- case 42/*TokenKind.ADD*/:
+ case (42):
return ":add";
- case 43/*TokenKind.SUB*/:
+ case (43):
return ":sub";
- case 44/*TokenKind.MUL*/:
+ case (44):
return ":mul";
- case 45/*TokenKind.DIV*/:
+ case (45):
return ":div";
- case 46/*TokenKind.TRUNCDIV*/:
+ case (46):
return ":truncdiv";
- case 47/*TokenKind.MOD*/:
+ case (47):
return ":mod";
- case 48/*TokenKind.EQ*/:
+ case (48):
return ":eq";
- case 52/*TokenKind.LT*/:
+ case (52):
return ":lt";
- case 53/*TokenKind.GT*/:
+ case (53):
return ":gt";
- case 54/*TokenKind.LTE*/:
+ case (54):
return ":lte";
- case 55/*TokenKind.GTE*/:
+ case (55):
return ":gte";
- case 56/*TokenKind.INDEX*/:
+ case (56):
return ":index";
- case 57/*TokenKind.SETINDEX*/:
+ case (57):
return ":setindex";
}
}
TokenKind.kindFromAssign = function(kind) {
- if (kind == 20/*TokenKind.ASSIGN*/) return 0;
- if (kind > 20/*TokenKind.ASSIGN*/ && kind <= 32/*TokenKind.ASSIGN_MOD*/) {
+ if (kind == (20)) return (0);
+ if (kind > (20) && kind <= (32)) {
return kind + (15);
}
- return -1;
+ return (-1);
}
// ********** Code for Parser **************
function Parser(source, diet, throwOnIncomplete, optionalSemicolons, startOffset) {
this._inhibitLambda = false
- this._afterParensIndex = 0
+ this._afterParensIndex = (0)
this._recover = false
this.source = source;
this.diet = diet;
@@ -8670,10 +8618,10 @@ Parser.prototype.get$enableAwait = function() {
return $globals.experimentalAwaitPhase != null;
}
Parser.prototype.isPrematureEndOfFile = function() {
- if (this.throwOnIncomplete && this._maybeEat(1/*TokenKind.END_OF_FILE*/)) {
+ if (this.throwOnIncomplete && this._maybeEat((1))) {
$throw(new IncompleteSourceException(this._previousToken));
}
- else if (this._maybeEat(1/*TokenKind.END_OF_FILE*/)) {
+ else if (this._maybeEat((1))) {
this._lang_error("unexpected end of file", this._peekToken.get$span());
return true;
}
@@ -8707,7 +8655,7 @@ Parser.prototype._peekIdentifier = function() {
return this._isIdentifier(this._peekToken.kind);
}
Parser.prototype._isIdentifier = function(kind) {
- return TokenKind.isIdentifier(kind) || (!this.get$enableAwait() && $eq(kind, 86/*TokenKind.AWAIT*/));
+ return TokenKind.isIdentifier(kind) || (!this.get$enableAwait() && $eq(kind, (86)));
}
Parser.prototype._maybeEat = function(kind) {
if (this._peekToken.kind == kind) {
@@ -8725,8 +8673,8 @@ Parser.prototype._eat = function(kind) {
}
}
Parser.prototype._eatSemicolon = function() {
- if (this.optionalSemicolons && this._peekKind(1/*TokenKind.END_OF_FILE*/)) return;
- this._eat(10/*TokenKind.SEMICOLON*/);
+ if (this.optionalSemicolons && this._peekKind((1))) return;
+ this._eat((10));
}
Parser.prototype._errorExpected = function(expected) {
if (this.throwOnIncomplete) this.isPrematureEndOfFile();
@@ -8747,18 +8695,18 @@ Parser.prototype._lang_error = function(message, location) {
this._recover = true;
}
Parser.prototype._skipBlock = function() {
- var depth = 1;
- this._eat(6/*TokenKind.LBRACE*/);
+ var depth = (1);
+ this._eat((6));
while (true) {
var tok = this._lang_next();
- if ($eq(tok.get$kind(), 6/*TokenKind.LBRACE*/)) {
- depth += 1;
+ if ($eq(tok.get$kind(), (6))) {
+ depth += (1);
}
- else if ($eq(tok.get$kind(), 7/*TokenKind.RBRACE*/)) {
- depth -= 1;
- if (depth == 0) return;
+ else if ($eq(tok.get$kind(), (7))) {
+ depth -= (1);
+ if (depth == (0)) return;
}
- else if ($eq(tok.get$kind(), 1/*TokenKind.END_OF_FILE*/)) {
+ else if ($eq(tok.get$kind(), (1))) {
this._lang_error("unexpected end of file during diet parse", tok.get$span());
return;
}
@@ -8769,12 +8717,12 @@ Parser.prototype._makeSpan = function(start) {
}
Parser.prototype.compilationUnit = function() {
var ret = [];
- this._maybeEat(13/*TokenKind.HASHBANG*/);
- while (this._peekKind(12/*TokenKind.HASH*/)) {
+ this._maybeEat((13));
+ while (this._peekKind((12))) {
ret.add$1(this.directive());
}
this._recover = false;
- while (!this._maybeEat(1/*TokenKind.END_OF_FILE*/)) {
+ while (!this._maybeEat((1))) {
ret.add$1(this.topLevelDefinition());
}
this._recover = false;
@@ -8782,7 +8730,7 @@ Parser.prototype.compilationUnit = function() {
}
Parser.prototype.directive = function() {
var start = this._peekToken.start;
- this._eat(12/*TokenKind.HASH*/);
+ this._eat((12));
var name = this.identifier();
var args = this.arguments();
this._eatSemicolon();
@@ -8790,15 +8738,15 @@ Parser.prototype.directive = function() {
}
Parser.prototype.topLevelDefinition = function() {
switch (this._peek()) {
- case 90/*TokenKind.CLASS*/:
+ case (90):
- return this.classDefinition(90/*TokenKind.CLASS*/);
+ return this.classDefinition((90));
- case 77/*TokenKind.INTERFACE*/:
+ case (77):
- return this.classDefinition(77/*TokenKind.INTERFACE*/);
+ return this.classDefinition((77));
- case 85/*TokenKind.TYPEDEF*/:
+ case (85):
return this.functionTypeAlias();
@@ -8813,56 +8761,56 @@ Parser.prototype.classDefinition = function(kind) {
this._eat(kind);
var name = this.identifier();
var typeParams = null;
- if (this._peekKind(52/*TokenKind.LT*/)) {
+ if (this._peekKind((52))) {
typeParams = this.typeParameters();
}
var _extends = null;
- if (this._maybeEat(96/*TokenKind.EXTENDS*/)) {
+ if (this._maybeEat((96))) {
_extends = this.typeList();
}
var _implements = null;
- if (this._maybeEat(75/*TokenKind.IMPLEMENTS*/)) {
+ if (this._maybeEat((75))) {
_implements = this.typeList();
}
var _native = null;
- if (this._maybeEat(79/*TokenKind.NATIVE*/)) {
+ if (this._maybeEat((79))) {
_native = this.maybeStringLiteral();
if (_native != null) _native = new NativeType(_native);
}
- var oldFactory = this._maybeEat(73/*TokenKind.FACTORY*/);
+ var oldFactory = this._maybeEat((73));
var defaultType = null;
- if (oldFactory || this._maybeEat(93/*TokenKind.DEFAULT*/)) {
+ if (oldFactory || this._maybeEat((93))) {
if (oldFactory) {
$globals.world.warning("factory no longer supported, use \"default\" instead", this._previousToken.get$span());
}
var baseType = this.nameTypeReference();
var typeParams0 = null;
- if (this._peekKind(52/*TokenKind.LT*/)) {
+ if (this._peekKind((52))) {
typeParams0 = this.typeParameters();
}
defaultType = new DefaultTypeReference(oldFactory, baseType, typeParams0, this._makeSpan(baseType.get$span().get$start()));
}
var body = [];
- if (this._maybeEat(6/*TokenKind.LBRACE*/)) {
- while (!this._maybeEat(7/*TokenKind.RBRACE*/)) {
+ if (this._maybeEat((6))) {
+ while (!this._maybeEat((7))) {
body.add$1(this.declaration(true));
if (this._recover) {
- if (!this._recoverTo(7/*TokenKind.RBRACE*/, 10/*TokenKind.SEMICOLON*/)) break;
- this._maybeEat(10/*TokenKind.SEMICOLON*/);
+ if (!this._recoverTo((7), (10))) break;
+ this._maybeEat((10));
}
}
}
else {
this._errorExpected("block starting with \"{\" or \";\"");
}
- return new TypeDefinition(kind == 90/*TokenKind.CLASS*/, name, typeParams, _extends, _implements, _native, defaultType, body, this._makeSpan(start));
+ return new TypeDefinition(kind == (90), name, typeParams, _extends, _implements, _native, defaultType, body, this._makeSpan(start));
}
Parser.prototype.functionTypeAlias = function() {
var start = this._peekToken.start;
- this._eat(85/*TokenKind.TYPEDEF*/);
+ this._eat((85));
var di = this.declaredIdentifier(false);
var typeParams = null;
- if (this._peekKind(52/*TokenKind.LT*/)) {
+ if (this._peekKind((52))) {
typeParams = this.typeParameters();
}
var formals = this.formalParameterList();
@@ -8876,7 +8824,7 @@ Parser.prototype.initializers = function() {
do {
ret.add$1(this.expression());
}
- while (this._maybeEat(11/*TokenKind.COMMA*/))
+ while (this._maybeEat((11)))
this._inhibitLambda = false;
return ret;
}
@@ -8885,14 +8833,14 @@ Parser.prototype.get$initializers = function() {
}
Parser.prototype.functionBody = function(inExpression) {
var start = this._peekToken.start;
- if (this._maybeEat(9/*TokenKind.ARROW*/)) {
+ if (this._maybeEat((9))) {
var expr = this.expression();
if (!inExpression) {
this._eatSemicolon();
}
return new ReturnStatement(expr, this._makeSpan(start));
}
- else if (this._peekKind(6/*TokenKind.LBRACE*/)) {
+ else if (this._peekKind((6))) {
if (this.diet) {
this._skipBlock();
return new DietStatement(this._makeSpan(start));
@@ -8902,7 +8850,7 @@ Parser.prototype.functionBody = function(inExpression) {
}
}
else if (!inExpression) {
- if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) {
+ if (this._maybeEat((10))) {
return null;
}
}
@@ -8911,9 +8859,9 @@ Parser.prototype.functionBody = function(inExpression) {
Parser.prototype.finishField = function(start, modifiers, type, name, value) {
var names = [name];
var values = [value];
- while (this._maybeEat(11/*TokenKind.COMMA*/)) {
+ while (this._maybeEat((11))) {
names.add$1(this.identifier());
- if (this._maybeEat(20/*TokenKind.ASSIGN*/)) {
+ if (this._maybeEat((20))) {
values.add$1(this.expression());
}
else {
@@ -8925,14 +8873,14 @@ Parser.prototype.finishField = function(start, modifiers, type, name, value) {
}
Parser.prototype.finishDefinition = function(start, modifiers, di) {
switch (this._peek()) {
- case 2/*TokenKind.LPAREN*/:
+ case (2):
var formals = this.formalParameterList();
var inits = null, native_ = null;
- if (this._maybeEat(8/*TokenKind.COLON*/)) {
+ if (this._maybeEat((8))) {
inits = this.initializers();
}
- if (this._maybeEat(79/*TokenKind.NATIVE*/)) {
+ if (this._maybeEat((79))) {
native_ = this.maybeStringLiteral();
if (native_ == null) native_ = "";
}
@@ -8942,14 +8890,14 @@ Parser.prototype.finishDefinition = function(start, modifiers, di) {
}
return new FunctionDefinition(modifiers, di.get$type(), di.get$name(), formals, inits, native_, body, this._makeSpan(start));
- case 20/*TokenKind.ASSIGN*/:
+ case (20):
- this._eat(20/*TokenKind.ASSIGN*/);
+ this._eat((20));
var value = this.expression();
return this.finishField(start, modifiers, di.get$type(), di.get$name(), value);
- case 11/*TokenKind.COMMA*/:
- case 10/*TokenKind.SEMICOLON*/:
+ case (11):
+ case (10):
return this.finishField(start, modifiers, di.get$type(), di.get$name(), null);
@@ -8962,7 +8910,7 @@ Parser.prototype.finishDefinition = function(start, modifiers, di) {
}
Parser.prototype.declaration = function(includeOperators) {
var start = this._peekToken.start;
- if (this._peekKind(73/*TokenKind.FACTORY*/)) {
+ if (this._peekKind((73))) {
return this.factoryConstructorDeclaration();
}
var modifiers = this._readModifiers();
@@ -8972,92 +8920,92 @@ Parser.prototype.factoryConstructorDeclaration = function() {
var start = this._peekToken.start;
var factoryToken = this._lang_next();
var names = [this.identifier()];
- while (this._maybeEat(14/*TokenKind.DOT*/)) {
+ while (this._maybeEat((14))) {
names.add$1(this.identifier());
}
- if (this._peekKind(52/*TokenKind.LT*/)) {
+ if (this._peekKind((52))) {
var tp = this.typeParameters();
- $globals.world.warning("type parameters on factories are no longer supported, place them on the class instead", this._makeSpan(tp.$index(0).get$span().get$start()));
+ $globals.world.warning("type parameters on factories are no longer supported, place them on the class instead", this._makeSpan(tp.$index((0)).get$span().get$start()));
}
var name = null;
var type = null;
- if (this._maybeEat(14/*TokenKind.DOT*/)) {
+ if (this._maybeEat((14))) {
name = this.identifier();
}
else {
- if (names.get$length() > 1) {
+ if (names.get$length() > (1)) {
name = names.removeLast$0();
}
else {
- name = new Identifier("", names.$index(0).get$span());
+ name = new Identifier("", names.$index((0)).get$span());
}
}
- if (names.get$length() > 1) {
- this._lang_error("unsupported qualified name for factory", names.$index(0).get$span());
+ if (names.get$length() > (1)) {
+ this._lang_error("unsupported qualified name for factory", names.$index((0)).get$span());
}
- type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get$span());
+ type = new NameTypeReference(false, names.$index((0)), null, names.$index((0)).get$span());
var di = new DeclaredIdentifier(type, name, this._makeSpan(start));
return this.finishDefinition(start, [factoryToken], di);
}
Parser.prototype.statement = function() {
switch (this._peek()) {
- case 87/*TokenKind.BREAK*/:
+ case (87):
return this.breakStatement();
- case 92/*TokenKind.CONTINUE*/:
+ case (92):
return this.continueStatement();
- case 106/*TokenKind.RETURN*/:
+ case (106):
return this.returnStatement();
- case 110/*TokenKind.THROW*/:
+ case (110):
return this.throwStatement();
- case 72/*TokenKind.ASSERT*/:
+ case (72):
return this.assertStatement();
- case 115/*TokenKind.WHILE*/:
+ case (115):
return this.whileStatement();
- case 94/*TokenKind.DO*/:
+ case (94):
return this.doStatement();
- case 100/*TokenKind.FOR*/:
+ case (100):
return this.forStatement();
- case 101/*TokenKind.IF*/:
+ case (101):
return this.ifStatement();
- case 108/*TokenKind.SWITCH*/:
+ case (108):
return this.switchStatement();
- case 112/*TokenKind.TRY*/:
+ case (112):
return this.tryStatement();
- case 6/*TokenKind.LBRACE*/:
+ case (6):
return this.block();
- case 10/*TokenKind.SEMICOLON*/:
+ case (10):
return this.emptyStatement();
- case 98/*TokenKind.FINAL*/:
+ case (98):
return this.declaration(false);
- case 113/*TokenKind.VAR*/:
+ case (113):
return this.declaration(false);
@@ -9069,7 +9017,7 @@ Parser.prototype.statement = function() {
}
Parser.prototype.finishExpressionAsStatement = function(expr) {
var start = expr.get$span().get$start();
- if (this._maybeEat(8/*TokenKind.COLON*/)) {
+ if (this._maybeEat((8))) {
var label = this._makeLabel(expr);
return new LabeledStatement(label, this.statement(), this._makeSpan(start));
}
@@ -9082,22 +9030,22 @@ Parser.prototype.finishExpressionAsStatement = function(expr) {
}
else if ((expr instanceof DeclaredIdentifier)) {
var value = null;
- if (this._maybeEat(20/*TokenKind.ASSIGN*/)) {
+ if (this._maybeEat((20))) {
value = this.expression();
}
return this.finishField(start, null, expr.get$type(), expr.get$name(), value);
}
- else if (this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.get$x() instanceof DeclaredIdentifier))) {
+ else if (this._isBin(expr, (20)) && ((expr.get$x() instanceof DeclaredIdentifier))) {
var di = expr.get$x();
return this.finishField(start, null, di.type, di.name, expr.get$y());
}
- else if (this._isBin(expr, 52/*TokenKind.LT*/) && this._maybeEat(11/*TokenKind.COMMA*/)) {
+ else if (this._isBin(expr, (52)) && this._maybeEat((11))) {
var baseType = this._makeType(expr.get$x());
var typeArgs = [this._makeType(expr.get$y())];
- var gt = this._finishTypeArguments(baseType, 0, typeArgs);
+ var gt = this._finishTypeArguments(baseType, (0), typeArgs);
var name = this.identifier();
var value = null;
- if (this._maybeEat(20/*TokenKind.ASSIGN*/)) {
+ if (this._maybeEat((20))) {
value = this.expression();
}
return this.finishField(expr.get$span().get$start(), null, gt, name, value);
@@ -9110,91 +9058,91 @@ Parser.prototype.finishExpressionAsStatement = function(expr) {
Parser.prototype.testCondition = function() {
this._eatLeftParen();
var ret = this.expression();
- this._eat(3/*TokenKind.RPAREN*/);
+ this._eat((3));
return ret;
}
Parser.prototype.block = function() {
var start = this._peekToken.start;
- this._eat(6/*TokenKind.LBRACE*/);
+ this._eat((6));
var stmts = [];
- while (!this._maybeEat(7/*TokenKind.RBRACE*/)) {
+ while (!this._maybeEat((7))) {
stmts.add$1(this.statement());
- if (this._recover && !this._recoverTo(7/*TokenKind.RBRACE*/, 10/*TokenKind.SEMICOLON*/)) break;
+ if (this._recover && !this._recoverTo((7), (10))) break;
}
this._recover = false;
return new BlockStatement(stmts, this._makeSpan(start));
}
Parser.prototype.emptyStatement = function() {
var start = this._peekToken.start;
- this._eat(10/*TokenKind.SEMICOLON*/);
+ this._eat((10));
return new EmptyStatement(this._makeSpan(start));
}
Parser.prototype.ifStatement = function() {
var start = this._peekToken.start;
- this._eat(101/*TokenKind.IF*/);
+ this._eat((101));
var test = this.testCondition();
var trueBranch = this.statement();
var falseBranch = null;
- if (this._maybeEat(95/*TokenKind.ELSE*/)) {
+ if (this._maybeEat((95))) {
falseBranch = this.statement();
}
return new IfStatement(test, trueBranch, falseBranch, this._makeSpan(start));
}
Parser.prototype.whileStatement = function() {
var start = this._peekToken.start;
- this._eat(115/*TokenKind.WHILE*/);
+ this._eat((115));
var test = this.testCondition();
var body = this.statement();
return new WhileStatement(test, body, this._makeSpan(start));
}
Parser.prototype.doStatement = function() {
var start = this._peekToken.start;
- this._eat(94/*TokenKind.DO*/);
+ this._eat((94));
var body = this.statement();
- this._eat(115/*TokenKind.WHILE*/);
+ this._eat((115));
var test = this.testCondition();
this._eatSemicolon();
return new DoStatement(body, test, this._makeSpan(start));
}
Parser.prototype.forStatement = function() {
var start = this._peekToken.start;
- this._eat(100/*TokenKind.FOR*/);
+ this._eat((100));
this._eatLeftParen();
var init = this.forInitializerStatement(start);
if ((init instanceof ForInStatement)) {
return init;
}
var test = null;
- if (!this._maybeEat(10/*TokenKind.SEMICOLON*/)) {
+ if (!this._maybeEat((10))) {
test = this.expression();
this._eatSemicolon();
}
var step = [];
- if (!this._maybeEat(3/*TokenKind.RPAREN*/)) {
+ if (!this._maybeEat((3))) {
step.add$1(this.expression());
- while (this._maybeEat(11/*TokenKind.COMMA*/)) {
+ while (this._maybeEat((11))) {
step.add$1(this.expression());
}
- this._eat(3/*TokenKind.RPAREN*/);
+ this._eat((3));
}
var body = this.statement();
return new ForStatement(init, test, step, body, this._makeSpan(start));
}
Parser.prototype.forInitializerStatement = function(start) {
- if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) {
+ if (this._maybeEat((10))) {
return null;
}
else {
var init = this.expression();
- if (this._peekKind(11/*TokenKind.COMMA*/) && this._isBin(init, 52/*TokenKind.LT*/)) {
- this._eat(11/*TokenKind.COMMA*/);
+ if (this._peekKind((11)) && this._isBin(init, (52))) {
+ this._eat((11));
var baseType = this._makeType(init.get$x());
var typeArgs = [this._makeType(init.get$y())];
- var gt = this._finishTypeArguments(baseType, 0, typeArgs);
+ var gt = this._finishTypeArguments(baseType, (0), typeArgs);
var name = this.identifier();
init = new DeclaredIdentifier(gt, name, this._makeSpan(init.get$span().get$start()));
}
- if (this._maybeEat(102/*TokenKind.IN*/)) {
+ if (this._maybeEat((102))) {
return this._finishForIn(start, this._makeDeclaredIdentifier(init));
}
else {
@@ -9204,80 +9152,80 @@ Parser.prototype.forInitializerStatement = function(start) {
}
Parser.prototype._finishForIn = function(start, di) {
var expr = this.expression();
- this._eat(3/*TokenKind.RPAREN*/);
+ this._eat((3));
var body = this.statement();
return new ForInStatement(di, expr, body, this._makeSpan(start));
}
Parser.prototype.tryStatement = function() {
var start = this._peekToken.start;
- this._eat(112/*TokenKind.TRY*/);
+ this._eat((112));
var body = this.block();
var catches = [];
- while (this._peekKind(89/*TokenKind.CATCH*/)) {
+ while (this._peekKind((89))) {
catches.add$1(this.catchNode());
}
var finallyBlock = null;
- if (this._maybeEat(99/*TokenKind.FINALLY*/)) {
+ if (this._maybeEat((99))) {
finallyBlock = this.block();
}
return new TryStatement(body, catches, finallyBlock, this._makeSpan(start));
}
Parser.prototype.catchNode = function() {
var start = this._peekToken.start;
- this._eat(89/*TokenKind.CATCH*/);
+ this._eat((89));
this._eatLeftParen();
var exc = this.declaredIdentifier(false);
var trace = null;
- if (this._maybeEat(11/*TokenKind.COMMA*/)) {
+ if (this._maybeEat((11))) {
trace = this.declaredIdentifier(false);
}
- this._eat(3/*TokenKind.RPAREN*/);
+ this._eat((3));
var body = this.block();
return new CatchNode(exc, trace, body, this._makeSpan(start));
}
Parser.prototype.switchStatement = function() {
var start = this._peekToken.start;
- this._eat(108/*TokenKind.SWITCH*/);
+ this._eat((108));
var test = this.testCondition();
var cases = [];
- this._eat(6/*TokenKind.LBRACE*/);
- while (!this._maybeEat(7/*TokenKind.RBRACE*/)) {
+ this._eat((6));
+ while (!this._maybeEat((7))) {
cases.add$1(this.caseNode());
}
return new SwitchStatement(test, cases, this._makeSpan(start));
}
Parser.prototype._peekCaseEnd = function() {
var kind = this._peek();
- return $eq(kind, 7/*TokenKind.RBRACE*/) || $eq(kind, 88/*TokenKind.CASE*/) || $eq(kind, 93/*TokenKind.DEFAULT*/);
+ return $eq(kind, (7)) || $eq(kind, (88)) || $eq(kind, (93));
}
Parser.prototype.caseNode = function() {
var start = this._peekToken.start;
var label = null;
if (this._peekIdentifier()) {
label = this.identifier();
- this._eat(8/*TokenKind.COLON*/);
+ this._eat((8));
}
var cases = [];
while (true) {
- if (this._maybeEat(88/*TokenKind.CASE*/)) {
+ if (this._maybeEat((88))) {
cases.add$1(this.expression());
- this._eat(8/*TokenKind.COLON*/);
+ this._eat((8));
}
- else if (this._maybeEat(93/*TokenKind.DEFAULT*/)) {
+ else if (this._maybeEat((93))) {
cases.add$1();
- this._eat(8/*TokenKind.COLON*/);
+ this._eat((8));
}
else {
break;
}
}
- if ($eq(cases.get$length(), 0)) {
+ if ($eq(cases.get$length(), (0))) {
this._lang_error("case or default");
}
var stmts = [];
while (!this._peekCaseEnd()) {
stmts.add$1(this.statement());
- if (this._recover && !this._recoverTo(7/*TokenKind.RBRACE*/, 88/*TokenKind.CASE*/, 93/*TokenKind.DEFAULT*/)) {
+ if (this._recover && !this._recoverTo((7), (88), (93))) {
break;
}
}
@@ -9285,9 +9233,9 @@ Parser.prototype.caseNode = function() {
}
Parser.prototype.returnStatement = function() {
var start = this._peekToken.start;
- this._eat(106/*TokenKind.RETURN*/);
+ this._eat((106));
var expr;
- if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) {
+ if (this._maybeEat((10))) {
expr = null;
}
else {
@@ -9298,9 +9246,9 @@ Parser.prototype.returnStatement = function() {
}
Parser.prototype.throwStatement = function() {
var start = this._peekToken.start;
- this._eat(110/*TokenKind.THROW*/);
+ this._eat((110));
var expr;
- if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) {
+ if (this._maybeEat((10))) {
expr = null;
}
else {
@@ -9311,16 +9259,16 @@ Parser.prototype.throwStatement = function() {
}
Parser.prototype.assertStatement = function() {
var start = this._peekToken.start;
- this._eat(72/*TokenKind.ASSERT*/);
+ this._eat((72));
this._eatLeftParen();
var expr = this.expression();
- this._eat(3/*TokenKind.RPAREN*/);
+ this._eat((3));
this._eatSemicolon();
return new AssertStatement(expr, this._makeSpan(start));
}
Parser.prototype.breakStatement = function() {
var start = this._peekToken.start;
- this._eat(87/*TokenKind.BREAK*/);
+ this._eat((87));
var name = null;
if (this._peekIdentifier()) {
name = this.identifier();
@@ -9330,7 +9278,7 @@ Parser.prototype.breakStatement = function() {
}
Parser.prototype.continueStatement = function() {
var start = this._peekToken.start;
- this._eat(92/*TokenKind.CONTINUE*/);
+ this._eat((92));
var name = null;
if (this._peekIdentifier()) {
name = this.identifier();
@@ -9339,7 +9287,7 @@ Parser.prototype.continueStatement = function() {
return new ContinueStatement(name, this._makeSpan(start));
}
Parser.prototype.expression = function() {
- return this.infixExpression(0);
+ return this.infixExpression((0));
}
Parser.prototype._makeType = function(expr) {
if ((expr instanceof VarExpression)) {
@@ -9369,26 +9317,26 @@ Parser.prototype._finishDeclaredId = function(type) {
return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._makeSpan(type.get$span().get$start())));
}
Parser.prototype._fixAsType = function(x) {
- if (this._maybeEat(53/*TokenKind.GT*/)) {
+ if (this._maybeEat((53))) {
var base = this._makeType(x.x);
var typeParam = this._makeType(x.y);
- var type = new GenericTypeReference(base, [typeParam], 0, this._makeSpan(x.span.start));
+ var type = new GenericTypeReference(base, [typeParam], (0), this._makeSpan(x.span.start));
return this._finishDeclaredId(type);
}
else {
var base = this._makeType(x.x);
var paramBase = this._makeType(x.y);
- var firstParam = this.addTypeArguments(paramBase, 1);
+ var firstParam = this.addTypeArguments(paramBase, (1));
var type;
- if (firstParam.get$depth() <= 0) {
- type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.span.start));
+ if (firstParam.get$depth() <= (0)) {
+ type = new GenericTypeReference(base, [firstParam], (0), this._makeSpan(x.span.start));
}
- else if (this._maybeEat(11/*TokenKind.COMMA*/)) {
- type = this._finishTypeArguments(base, 0, [firstParam]);
+ else if (this._maybeEat((11))) {
+ type = this._finishTypeArguments(base, (0), [firstParam]);
}
else {
- this._eat(53/*TokenKind.GT*/);
- type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.span.start));
+ this._eat((53));
+ type = new GenericTypeReference(base, [firstParam], (0), this._makeSpan(x.span.start));
}
return this._finishDeclaredId(type);
}
@@ -9398,21 +9346,21 @@ Parser.prototype.finishInfixExpression = function(x, precedence) {
var kind = this._peek();
var prec = TokenKind.infixPrecedence(this._peek());
if (prec >= precedence) {
- if (kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/) {
- if (this._isBin(x, 52/*TokenKind.LT*/)) {
+ if (kind == (52) || kind == (53)) {
+ if (this._isBin(x, (52))) {
return this._fixAsType(x);
}
}
var op = this._lang_next();
- if ($eq(op.get$kind(), 103/*TokenKind.IS*/)) {
- var isTrue = !this._maybeEat(19/*TokenKind.NOT*/);
- var typeRef = this.type(0);
+ if ($eq(op.get$kind(), (103))) {
+ var isTrue = !this._maybeEat((19));
+ var typeRef = this.type((0));
x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start));
continue;
}
- var y = this.infixExpression($eq(prec, 2) ? prec : prec + 1);
- if ($eq(op.get$kind(), 33/*TokenKind.CONDITIONAL*/)) {
- this._eat(8/*TokenKind.COLON*/);
+ var y = this.infixExpression($eq(prec, (2)) ? prec : prec + (1));
+ if ($eq(op.get$kind(), (33))) {
+ this._eat((8));
var z = this.infixExpression(prec);
x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start));
}
@@ -9428,12 +9376,12 @@ Parser.prototype.finishInfixExpression = function(x, precedence) {
}
Parser.prototype._isPrefixUnaryOperator = function(kind) {
switch (kind) {
- case 42/*TokenKind.ADD*/:
- case 43/*TokenKind.SUB*/:
- case 19/*TokenKind.NOT*/:
- case 18/*TokenKind.BIT_NOT*/:
- case 16/*TokenKind.INCR*/:
- case 17/*TokenKind.DECR*/:
+ case (42):
+ case (43):
+ case (19):
+ case (18):
+ case (16):
+ case (17):
return true;
@@ -9450,7 +9398,7 @@ Parser.prototype.unaryExpression = function() {
var expr = this.unaryExpression();
return new UnaryExpression(tok, expr, this._makeSpan(start));
}
- else if (this.get$enableAwait() && this._maybeEat(86/*TokenKind.AWAIT*/)) {
+ else if (this.get$enableAwait() && this._maybeEat((86))) {
var expr = this.unaryExpression();
return new AwaitExpression(expr, this._makeSpan(start));
}
@@ -9460,11 +9408,11 @@ Parser.prototype.argument = function() {
var start = this._peekToken.start;
var expr;
var label = null;
- if (this._maybeEat(15/*TokenKind.ELLIPSIS*/)) {
+ if (this._maybeEat((15))) {
label = new Identifier("...", this._makeSpan(start));
}
expr = this.expression();
- if (label == null && this._maybeEat(8/*TokenKind.COLON*/)) {
+ if (label == null && this._maybeEat((8))) {
label = this._makeLabel(expr);
expr = this.expression();
}
@@ -9475,12 +9423,12 @@ Parser.prototype.arguments = function() {
this._eatLeftParen();
var saved = this._inhibitLambda;
this._inhibitLambda = false;
- if (!this._maybeEat(3/*TokenKind.RPAREN*/)) {
+ if (!this._maybeEat((3))) {
do {
args.add$1(this.argument());
}
- while (this._maybeEat(11/*TokenKind.COMMA*/))
- this._eat(3/*TokenKind.RPAREN*/);
+ while (this._maybeEat((11)))
+ this._eat((3));
}
this._inhibitLambda = saved;
return args;
@@ -9490,32 +9438,32 @@ Parser.prototype.get$arguments = function() {
}
Parser.prototype.finishPostfixExpression = function(expr) {
switch (this._peek()) {
- case 2/*TokenKind.LPAREN*/:
+ case (2):
return this.finishCallOrLambdaExpression(expr);
- case 4/*TokenKind.LBRACK*/:
+ case (4):
- this._eat(4/*TokenKind.LBRACK*/);
+ this._eat((4));
var index = this.expression();
- this._eat(5/*TokenKind.RBRACK*/);
+ this._eat((5));
return this.finishPostfixExpression(new IndexExpression(expr, index, this._makeSpan(expr.get$span().get$start())));
- case 14/*TokenKind.DOT*/:
+ case (14):
- this._eat(14/*TokenKind.DOT*/);
+ this._eat((14));
var name = this.identifier();
var ret = new DotExpression(expr, name, this._makeSpan(expr.get$span().get$start()));
return this.finishPostfixExpression(ret);
- case 16/*TokenKind.INCR*/:
- case 17/*TokenKind.DECR*/:
+ case (16):
+ case (17):
var tok = this._lang_next();
return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().get$start()));
- case 9/*TokenKind.ARROW*/:
- case 6/*TokenKind.LBRACE*/:
+ case (9):
+ case (6):
return expr;
@@ -9553,96 +9501,96 @@ Parser.prototype._makeLiteral = function(value) {
Parser.prototype.primary = function() {
var start = this._peekToken.start;
switch (this._peek()) {
- case 109/*TokenKind.THIS*/:
+ case (109):
- this._eat(109/*TokenKind.THIS*/);
+ this._eat((109));
return new ThisExpression(this._makeSpan(start));
- case 107/*TokenKind.SUPER*/:
+ case (107):
- this._eat(107/*TokenKind.SUPER*/);
+ this._eat((107));
return new SuperExpression(this._makeSpan(start));
- case 91/*TokenKind.CONST*/:
+ case (91):
- this._eat(91/*TokenKind.CONST*/);
- if (this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(56/*TokenKind.INDEX*/)) {
+ this._eat((91));
+ if (this._peekKind((4)) || this._peekKind((56))) {
return this.finishListLiteral(start, true, null);
}
- else if (this._peekKind(6/*TokenKind.LBRACE*/)) {
- return this.finishMapLiteral(start, true, null);
+ else if (this._peekKind((6))) {
+ return this.finishMapLiteral(start, true, null, null);
}
- else if (this._peekKind(52/*TokenKind.LT*/)) {
+ else if (this._peekKind((52))) {
return this.finishTypedLiteral(start, true);
}
else {
return this.finishNewExpression(start, true);
}
- case 104/*TokenKind.NEW*/:
+ case (104):
- this._eat(104/*TokenKind.NEW*/);
+ this._eat((104));
return this.finishNewExpression(start, false);
- case 2/*TokenKind.LPAREN*/:
+ case (2):
return this._parenOrLambda();
- case 4/*TokenKind.LBRACK*/:
- case 56/*TokenKind.INDEX*/:
+ case (4):
+ case (56):
return this.finishListLiteral(start, false, null);
- case 6/*TokenKind.LBRACE*/:
+ case (6):
- return this.finishMapLiteral(start, false, null);
+ return this.finishMapLiteral(start, false, null, null);
- case 105/*TokenKind.NULL*/:
+ case (105):
- this._eat(105/*TokenKind.NULL*/);
+ this._eat((105));
return this._makeLiteral(Value.fromNull(this._makeSpan(start)));
- case 111/*TokenKind.TRUE*/:
+ case (111):
- this._eat(111/*TokenKind.TRUE*/);
+ this._eat((111));
return this._makeLiteral(Value.fromBool(true, this._makeSpan(start)));
- case 97/*TokenKind.FALSE*/:
+ case (97):
- this._eat(97/*TokenKind.FALSE*/);
+ this._eat((97));
return this._makeLiteral(Value.fromBool(false, this._makeSpan(start)));
- case 61/*TokenKind.HEX_INTEGER*/:
+ case (61):
var t = this._lang_next();
return this._makeLiteral(Value.fromInt(t.get$value(), t.get$span()));
- case 60/*TokenKind.INTEGER*/:
+ case (60):
var t = this._lang_next();
return this._makeLiteral(Value.fromInt(Math.parseInt(t.get$text()), t.get$span()));
- case 62/*TokenKind.DOUBLE*/:
+ case (62):
var t = this._lang_next();
return this._makeLiteral(Value.fromDouble(Math.parseDouble(t.get$text()), t.get$span()));
- case 58/*TokenKind.STRING*/:
+ case (58):
var t = this._lang_next();
return this._makeLiteral(Value.fromString(t.get$value(), t.get$span()));
- case 59/*TokenKind.STRING_PART*/:
+ case (59):
return this.stringInterpolation();
- case 52/*TokenKind.LT*/:
+ case (52):
return this.finishTypedLiteral(start, false);
- case 114/*TokenKind.VOID*/:
- case 113/*TokenKind.VAR*/:
- case 98/*TokenKind.FINAL*/:
+ case (114):
+ case (113):
+ case (98):
return this.declaredIdentifier(false);
@@ -9659,14 +9607,14 @@ Parser.prototype.stringInterpolation = function() {
var start = this._peekToken.start;
var pieces = new Array();
var startQuote = null, endQuote = null;
- while (this._peekKind(59/*TokenKind.STRING_PART*/)) {
+ while (this._peekKind((59))) {
var token = this._lang_next();
pieces.add$1(this._makeLiteral(Value.fromString(token.get$value(), token.get$span())));
- if (this._maybeEat(6/*TokenKind.LBRACE*/)) {
+ if (this._maybeEat((6))) {
pieces.add$1(this.expression());
- this._eat(7/*TokenKind.RBRACE*/);
+ this._eat((7));
}
- else if (this._maybeEat(109/*TokenKind.THIS*/)) {
+ else if (this._maybeEat((109))) {
pieces.add$1(new ThisExpression(this._previousToken.get$span()));
}
else {
@@ -9675,7 +9623,7 @@ Parser.prototype.stringInterpolation = function() {
}
}
var tok = this._lang_next();
- if ($ne(tok.get$kind(), 58/*TokenKind.STRING*/)) {
+ if ($ne(tok.get$kind(), (58))) {
this._errorExpected("interpolated string");
}
pieces.add$1(this._makeLiteral(Value.fromString(tok.get$value(), tok.get$span())));
@@ -9684,11 +9632,11 @@ Parser.prototype.stringInterpolation = function() {
}
Parser.prototype.maybeStringLiteral = function() {
var kind = this._peek();
- if ($eq(kind, 58/*TokenKind.STRING*/)) {
+ if ($eq(kind, (58))) {
var t = this._lang_next();
return t.get$value();
}
- else if ($eq(kind, 59/*TokenKind.STRING_PART*/)) {
+ else if ($eq(kind, (59))) {
this._lang_next();
this._errorExpected("string literal, but found interpolated string start");
}
@@ -9707,7 +9655,7 @@ Parser.prototype._parenOrLambda = function() {
var saved = this._inhibitLambda;
this._inhibitLambda = false;
var expr = this.expression();
- this._eat(3/*TokenKind.RPAREN*/);
+ this._eat((3));
this._inhibitLambda = saved;
return new ParenExpression(expr, this._makeSpan(start));
}
@@ -9715,17 +9663,17 @@ Parser.prototype._parenOrLambda = function() {
Parser.prototype._atClosureParameters = function() {
if (this._inhibitLambda) return false;
var after = this._peekAfterCloseParen();
- return after.kind == 9/*TokenKind.ARROW*/ || after.kind == 6/*TokenKind.LBRACE*/;
+ return after.kind == (9) || after.kind == (6);
}
Parser.prototype._eatLeftParen = function() {
- this._eat(2/*TokenKind.LPAREN*/);
+ this._eat((2));
this._afterParensIndex++;
}
Parser.prototype._peekAfterCloseParen = function() {
if (this._afterParensIndex < this._afterParens.get$length()) {
return this._afterParens.$index(this._afterParensIndex);
}
- this._afterParensIndex = 0;
+ this._afterParensIndex = (0);
this._afterParens.clear();
var tokens = [this._lang_next()];
this._lookaheadAfterParens(tokens);
@@ -9742,11 +9690,11 @@ Parser.prototype._lookaheadAfterParens = function(tokens) {
var token = this._lang_next();
tokens.add(token);
var kind = token.kind;
- if (kind == 3/*TokenKind.RPAREN*/ || kind == 1/*TokenKind.END_OF_FILE*/) {
+ if (kind == (3) || kind == (1)) {
this._afterParens.$setindex(saved, this._peekToken);
return;
}
- else if (kind == 2/*TokenKind.LPAREN*/) {
+ else if (kind == (2)) {
this._lookaheadAfterParens(tokens);
}
}
@@ -9758,24 +9706,24 @@ Parser.prototype._specialIdentifier = function(includeOperators) {
var start = this._peekToken.start;
var name;
switch (this._peek()) {
- case 15/*TokenKind.ELLIPSIS*/:
+ case (15):
- this._eat(15/*TokenKind.ELLIPSIS*/);
+ this._eat((15));
this._lang_error("rest no longer supported", this._previousToken.get$span());
name = this.identifier().get$name();
break;
- case 109/*TokenKind.THIS*/:
+ case (109):
- this._eat(109/*TokenKind.THIS*/);
- this._eat(14/*TokenKind.DOT*/);
+ this._eat((109));
+ this._eat((14));
name = ("this." + this.identifier().get$name());
break;
- case 74/*TokenKind.GET*/:
+ case (74):
if (!includeOperators) return null;
- this._eat(74/*TokenKind.GET*/);
+ this._eat((74));
if (this._peekIdentifier()) {
name = ("get:" + this.identifier().get$name());
}
@@ -9784,10 +9732,10 @@ Parser.prototype._specialIdentifier = function(includeOperators) {
}
break;
- case 82/*TokenKind.SET*/:
+ case (82):
if (!includeOperators) return null;
- this._eat(82/*TokenKind.SET*/);
+ this._eat((82));
if (this._peekIdentifier()) {
name = ("set:" + this.identifier().get$name());
}
@@ -9796,12 +9744,12 @@ Parser.prototype._specialIdentifier = function(includeOperators) {
}
break;
- case 81/*TokenKind.OPERATOR*/:
+ case (81):
if (!includeOperators) return null;
- this._eat(81/*TokenKind.OPERATOR*/);
+ this._eat((81));
var kind = this._peek();
- if ($eq(kind, 80/*TokenKind.NEGATE*/)) {
+ if ($eq(kind, (80))) {
name = ":negate";
this._lang_next();
}
@@ -9828,7 +9776,7 @@ Parser.prototype.declaredIdentifier = function(includeOperators) {
var myType = null;
var name = this._specialIdentifier(includeOperators);
if (name == null) {
- myType = this.type(0);
+ myType = this.type((0));
name = this._specialIdentifier(includeOperators);
if (name == null) {
if (this._peekIdentifier()) {
@@ -9845,69 +9793,68 @@ Parser.prototype.declaredIdentifier = function(includeOperators) {
return new DeclaredIdentifier(myType, name, this._makeSpan(start));
}
Parser.prototype.finishNewExpression = function(start, isConst) {
- var type = this.type(0);
+ var type = this.type((0));
var name = null;
- if (this._maybeEat(14/*TokenKind.DOT*/)) {
+ if (this._maybeEat((14))) {
name = this.identifier();
}
var args = this.arguments();
return new NewExpression(isConst, type, name, args, this._makeSpan(start));
}
-Parser.prototype.finishListLiteral = function(start, isConst, type) {
- if (this._maybeEat(56/*TokenKind.INDEX*/)) {
- return new ListExpression(isConst, type, [], this._makeSpan(start));
+Parser.prototype.finishListLiteral = function(start, isConst, itemType) {
+ if (this._maybeEat((56))) {
+ return new ListExpression(isConst, itemType, [], this._makeSpan(start));
}
var values = [];
- this._eat(4/*TokenKind.LBRACK*/);
- while (!this._maybeEat(5/*TokenKind.RBRACK*/)) {
+ this._eat((4));
+ while (!this._maybeEat((5))) {
values.add$1(this.expression());
- if (this._recover && !this._recoverTo(5/*TokenKind.RBRACK*/, 11/*TokenKind.COMMA*/)) break;
- if (!this._maybeEat(11/*TokenKind.COMMA*/)) {
- this._eat(5/*TokenKind.RBRACK*/);
+ if (this._recover && !this._recoverTo((5), (11))) break;
+ if (!this._maybeEat((11))) {
+ this._eat((5));
break;
}
}
- return new ListExpression(isConst, type, values, this._makeSpan(start));
+ return new ListExpression(isConst, itemType, values, this._makeSpan(start));
}
-Parser.prototype.finishMapLiteral = function(start, isConst, type) {
+Parser.prototype.finishMapLiteral = function(start, isConst, keyType, valueType) {
var items = [];
- this._eat(6/*TokenKind.LBRACE*/);
- while (!this._maybeEat(7/*TokenKind.RBRACE*/)) {
+ this._eat((6));
+ while (!this._maybeEat((7))) {
items.add$1(this.expression());
- this._eat(8/*TokenKind.COLON*/);
+ this._eat((8));
items.add$1(this.expression());
- if (this._recover && !this._recoverTo(7/*TokenKind.RBRACE*/, 11/*TokenKind.COMMA*/)) break;
- if (!this._maybeEat(11/*TokenKind.COMMA*/)) {
- this._eat(7/*TokenKind.RBRACE*/);
+ if (this._recover && !this._recoverTo((7), (11))) break;
+ if (!this._maybeEat((11))) {
+ this._eat((7));
break;
}
}
- return new MapExpression(isConst, type, items, this._makeSpan(start));
+ return new MapExpression(isConst, keyType, valueType, items, this._makeSpan(start));
}
Parser.prototype.finishTypedLiteral = function(start, isConst) {
var span = this._makeSpan(start);
var typeToBeNamedLater = new NameTypeReference(false, null, null, span);
- var genericType = this.addTypeArguments(typeToBeNamedLater, 0);
- if (this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(56/*TokenKind.INDEX*/)) {
- genericType.set$baseType(new TypeReference(span, $globals.world.listType));
- return this.finishListLiteral(start, isConst, genericType);
- }
- else if (this._peekKind(6/*TokenKind.LBRACE*/)) {
- genericType.set$baseType(new TypeReference(span, $globals.world.mapType));
- var typeArgs = genericType.get$typeArguments();
- if ($eq(typeArgs.get$length(), 1)) {
- genericType.set$typeArguments([new TypeReference(span, $globals.world.stringType), typeArgs.$index(0)]);
- }
- else if ($eq(typeArgs.get$length(), 2)) {
- var keyType = typeArgs.$index(0);
- if (!(keyType instanceof NameTypeReference) || $ne(keyType.get$name().get$name(), "String")) {
- $globals.world.error("the key type of a map literal is implicitly \"String\"", keyType.get$span());
- }
- else {
- $globals.world.warning("a map literal takes one type argument specifying the value type", keyType.get$span());
- }
+ var genericType = this.addTypeArguments(typeToBeNamedLater, (0));
+ var typeArgs = genericType.get$typeArguments();
+ if (this._peekKind((4)) || this._peekKind((56))) {
+ if ($ne(typeArgs.get$length(), (1))) {
+ $globals.world.error("exactly one type argument expected for list", genericType.get$span());
+ }
+ return this.finishListLiteral(start, isConst, typeArgs.$index((0)));
+ }
+ else if (this._peekKind((6))) {
+ var keyType, valueType;
+ if ($eq(typeArgs.get$length(), (1))) {
+ keyType = null;
+ valueType = typeArgs.$index((0));
+ }
+ else if ($eq(typeArgs.get$length(), (2))) {
+ var keyType0 = typeArgs.$index((0));
+ $globals.world.warning("a map literal takes one type argument specifying the value type", keyType0.get$span());
+ valueType = typeArgs.$index((1));
}
- return this.finishMapLiteral(start, isConst, genericType);
+ return this.finishMapLiteral(start, isConst, keyType, valueType);
}
else {
this._errorExpected("array or map literal");
@@ -9917,11 +9864,11 @@ Parser.prototype._readModifiers = function() {
var modifiers = null;
while (true) {
switch (this._peek()) {
- case 84/*TokenKind.STATIC*/:
- case 98/*TokenKind.FINAL*/:
- case 91/*TokenKind.CONST*/:
- case 71/*TokenKind.ABSTRACT*/:
- case 73/*TokenKind.FACTORY*/:
+ case (84):
+ case (98):
+ case (91):
+ case (71):
+ case (73):
if (modifiers == null) modifiers = [];
modifiers.add$1(this._lang_next());
@@ -9939,8 +9886,8 @@ Parser.prototype.typeParameter = function() {
var start = this._peekToken.start;
var name = this.identifier();
var myType = null;
- if (this._maybeEat(96/*TokenKind.EXTENDS*/)) {
- myType = this.type(1);
+ if (this._maybeEat((96))) {
+ myType = this.type((1));
}
var tp = new TypeParameter(name, myType, this._makeSpan(start));
return new ParameterType(name.get$name(), tp);
@@ -9949,20 +9896,20 @@ Parser.prototype.get$typeParameter = function() {
return this.typeParameter.bind(this);
}
Parser.prototype.typeParameters = function() {
- this._eat(52/*TokenKind.LT*/);
+ this._eat((52));
var closed = false;
var ret = [];
do {
var tp = this.typeParameter();
ret.add$1(tp);
- if ((tp.get$typeParameter().get$extendsType() instanceof GenericTypeReference) && $eq(tp.get$typeParameter().get$extendsType().get$depth(), 0)) {
+ if ((tp.get$typeParameter().get$extendsType() instanceof GenericTypeReference) && $eq(tp.get$typeParameter().get$extendsType().get$depth(), (0))) {
closed = true;
break;
}
}
- while (this._maybeEat(11/*TokenKind.COMMA*/))
+ while (this._maybeEat((11)))
if (!closed) {
- this._eat(53/*TokenKind.GT*/);
+ this._eat((53));
}
return ret;
}
@@ -9970,14 +9917,14 @@ Parser.prototype.get$typeParameters = function() {
return this.typeParameters.bind(this);
}
Parser.prototype._eatClosingAngle = function(depth) {
- if (this._maybeEat(53/*TokenKind.GT*/)) {
+ if (this._maybeEat((53))) {
return depth;
}
- else if (depth > 0 && this._maybeEat(40/*TokenKind.SAR*/)) {
- return depth - 1;
+ else if (depth > (0) && this._maybeEat((40))) {
+ return depth - (1);
}
- else if (depth > 1 && this._maybeEat(41/*TokenKind.SHR*/)) {
- return depth - 2;
+ else if (depth > (1) && this._maybeEat((41))) {
+ return depth - (2);
}
else {
this._errorExpected(">");
@@ -9985,21 +9932,21 @@ Parser.prototype._eatClosingAngle = function(depth) {
}
}
Parser.prototype.addTypeArguments = function(baseType, depth) {
- this._eat(52/*TokenKind.LT*/);
+ this._eat((52));
return this._finishTypeArguments(baseType, depth, []);
}
Parser.prototype._finishTypeArguments = function(baseType, depth, types) {
- var delta = -1;
+ var delta = (-1);
do {
- var myType = this.type(depth + 1);
+ var myType = this.type(depth + (1));
types.add$1(myType);
if ((myType instanceof GenericTypeReference) && myType.get$depth() <= depth) {
delta = depth - myType.get$depth();
break;
}
}
- while (this._maybeEat(11/*TokenKind.COMMA*/))
- if (delta >= 0) {
+ while (this._maybeEat((11)))
+ if (delta >= (0)) {
depth = depth - delta;
}
else {
@@ -10011,9 +9958,9 @@ Parser.prototype._finishTypeArguments = function(baseType, depth, types) {
Parser.prototype.typeList = function() {
var types = [];
do {
- types.add$1(this.type(0));
+ types.add$1(this.type((0)));
}
- while (this._maybeEat(11/*TokenKind.COMMA*/))
+ while (this._maybeEat((11)))
return types;
}
Parser.prototype.nameTypeReference = function() {
@@ -10023,17 +9970,17 @@ Parser.prototype.nameTypeReference = function() {
var typeArgs = null;
var isFinal = false;
switch (this._peek()) {
- case 114/*TokenKind.VOID*/:
+ case (114):
return new TypeReference(this._lang_next().get$span(), $globals.world.voidType);
- case 113/*TokenKind.VAR*/:
+ case (113):
return new TypeReference(this._lang_next().get$span(), $globals.world.varType);
- case 98/*TokenKind.FINAL*/:
+ case (98):
- this._eat(98/*TokenKind.FINAL*/);
+ this._eat((98));
isFinal = true;
name = this.identifier();
break;
@@ -10044,7 +9991,7 @@ Parser.prototype.nameTypeReference = function() {
break;
}
- while (this._maybeEat(14/*TokenKind.DOT*/)) {
+ while (this._maybeEat((14))) {
if (names == null) names = [];
names.add$1(this.identifier());
}
@@ -10052,14 +9999,14 @@ Parser.prototype.nameTypeReference = function() {
}
Parser.prototype.type = function(depth) {
var typeRef = this.nameTypeReference();
- if (this._peekKind(52/*TokenKind.LT*/)) {
+ if (this._peekKind((52))) {
return this.addTypeArguments(typeRef, depth);
}
else {
return typeRef;
}
}
-Parser.prototype.type.$optional = ['depth', '0']
+Parser.prototype.type.$optional = ['depth', '(0)']
Parser.prototype.get$type = function() {
return this.type.bind(this);
}
@@ -10074,13 +10021,13 @@ Parser.prototype.formalParameter = function(inOptionalBlock) {
this._lang_error("Formal parameter invalid", this._makeSpan(start));
}
var value = null;
- if (this._maybeEat(20/*TokenKind.ASSIGN*/)) {
+ if (this._maybeEat((20))) {
if (!inOptionalBlock) {
this._lang_error("default values only allowed inside [optional] section");
}
value = this.expression();
}
- else if (this._peekKind(2/*TokenKind.LPAREN*/)) {
+ else if (this._peekKind((2))) {
var formals = this.formalParameterList();
var func = new FunctionDefinition(null, type, name, formals, null, null, null, this._makeSpan(start));
type = new FunctionTypeReference(false, func, func.get$span());
@@ -10094,13 +10041,13 @@ Parser.prototype.formalParameterList = function() {
this._eatLeftParen();
var formals = [];
var inOptionalBlock = false;
- if (!this._maybeEat(3/*TokenKind.RPAREN*/)) {
- if (this._maybeEat(4/*TokenKind.LBRACK*/)) {
+ if (!this._maybeEat((3))) {
+ if (this._maybeEat((4))) {
inOptionalBlock = true;
}
formals.add$1(this.formalParameter(inOptionalBlock));
- while (this._maybeEat(11/*TokenKind.COMMA*/)) {
- if (this._maybeEat(4/*TokenKind.LBRACK*/)) {
+ while (this._maybeEat((11))) {
+ if (this._maybeEat((4))) {
if (inOptionalBlock) {
this._lang_error("already inside an optional block", this._previousToken.get$span());
}
@@ -10109,9 +10056,9 @@ Parser.prototype.formalParameterList = function() {
formals.add$1(this.formalParameter(inOptionalBlock));
}
if (inOptionalBlock) {
- this._eat(5/*TokenKind.RBRACK*/);
+ this._eat((5));
}
- this._eat(3/*TokenKind.RPAREN*/);
+ this._eat((3));
}
return formals;
}
@@ -10173,7 +10120,7 @@ IncompleteSourceException.prototype.toString = function() {
IncompleteSourceException.prototype.toString$0 = IncompleteSourceException.prototype.toString;
// ********** Code for DivertedTokenSource **************
function DivertedTokenSource(tokens, parser, previousTokenizer) {
- this._lang_pos = 0
+ this._lang_pos = (0)
this.tokens = tokens;
this.parser = parser;
this.previousTokenizer = previousTokenizer;
@@ -10310,8 +10257,6 @@ VariableDefinition.prototype.get$type = function() { return this.type; };
VariableDefinition.prototype.set$type = function(value) { return this.type = value; };
VariableDefinition.prototype.get$names = function() { return this.names; };
VariableDefinition.prototype.set$names = function(value) { return this.names = value; };
-VariableDefinition.prototype.get$values = function() { return this.values; };
-VariableDefinition.prototype.set$values = function(value) { return this.values = value; };
VariableDefinition.prototype.visit = function(visitor) {
return visitor.visitVariableDefinition(this);
}
@@ -10687,36 +10632,31 @@ NewExpression.prototype.visit = function(visitor) {
NewExpression.prototype.visit$1 = NewExpression.prototype.visit;
// ********** Code for ListExpression **************
$inherits(ListExpression, Expression);
-function ListExpression(isConst, type, values, span) {
+function ListExpression(isConst, itemType, values, span) {
this.isConst = isConst;
- this.type = type;
+ this.itemType = itemType;
this.values = values;
// Initializers done
Expression.call(this, span);
}
ListExpression.prototype.get$isConst = function() { return this.isConst; };
ListExpression.prototype.set$isConst = function(value) { return this.isConst = value; };
-ListExpression.prototype.get$type = function() { return this.type; };
-ListExpression.prototype.set$type = function(value) { return this.type = value; };
-ListExpression.prototype.get$values = function() { return this.values; };
-ListExpression.prototype.set$values = function(value) { return this.values = value; };
ListExpression.prototype.visit = function(visitor) {
return visitor.visitListExpression(this);
}
ListExpression.prototype.visit$1 = ListExpression.prototype.visit;
// ********** Code for MapExpression **************
$inherits(MapExpression, Expression);
-function MapExpression(isConst, type, items, span) {
+function MapExpression(isConst, keyType, valueType, items, span) {
this.isConst = isConst;
- this.type = type;
+ this.keyType = keyType;
+ this.valueType = valueType;
this.items = items;
// Initializers done
Expression.call(this, span);
}
MapExpression.prototype.get$isConst = function() { return this.isConst; };
MapExpression.prototype.set$isConst = function(value) { return this.isConst = value; };
-MapExpression.prototype.get$type = function() { return this.type; };
-MapExpression.prototype.set$type = function(value) { return this.type = value; };
MapExpression.prototype.visit = function(visitor) {
return visitor.visitMapExpression(this);
}
@@ -11095,6 +11035,12 @@ Type.prototype.get$isList = function() {
Type.prototype.get$isNum = function() {
return false;
}
+Type.prototype.get$isInt = function() {
+ return false;
+}
+Type.prototype.get$isDouble = function() {
+ return false;
+}
Type.prototype.get$isVoid = function() {
return false;
}
@@ -11228,7 +11174,7 @@ Type.prototype._getMemberInParents = function(memberName) {
}
}
else {
- if (this.get$interfaces() != null && this.get$interfaces().get$length() > 0) {
+ if (this.get$interfaces() != null && this.get$interfaces().get$length() > (0)) {
var $$list = this.get$interfaces();
for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
var i = $$list.$index($$i);
@@ -11259,7 +11205,7 @@ Type.prototype.resolveMember = function(memberName) {
var t = $$i.next$0();
if (!this.get$isClass() && t.get$isClass()) {
var m = t.getMember$1(memberName);
- if (m != null && ret.members.indexOf(m) == -1) {
+ if (m != null && ret.members.indexOf(m) == (-1)) {
ret.add(m);
}
}
@@ -11353,9 +11299,9 @@ Type.prototype.isSubtypeOf = function(other) {
return false;
}
Type.prototype.hashCode = function() {
- var libraryCode = this.get$library() == null ? 1 : this.get$library().hashCode();
- var nameCode = this.name == null ? 1 : this.name.hashCode();
- return (libraryCode << 4) ^ nameCode;
+ var libraryCode = this.get$library() == null ? (1) : this.get$library().hashCode();
+ var nameCode = this.name == null ? (1) : this.name.hashCode();
+ return (libraryCode << (4)) ^ nameCode;
}
Type.prototype.$eq = function(other) {
return (other instanceof Type) && $eq(other.get$name(), this.name) && $eq(this.get$library(), other.get$library());
@@ -11367,7 +11313,7 @@ Type._isFunctionSubtypeOf = function(t, s) {
var tp = t.parameters;
var sp = s.parameters;
if (tp.get$length() < sp.get$length()) return false;
- for (var i = 0;
+ for (var i = (0);
i < sp.get$length(); i++) {
if ($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOptional())) return false;
if (tp.$index(i).get$isOptional() && $ne(tp.$index(i).get$name(), sp.$index(i).get$name())) return false;
@@ -11836,6 +11782,12 @@ DefinedType.prototype.get$typeofName = function() {
DefinedType.prototype.get$isNum = function() {
return this.library != null && this.library.get$isCore() && (this.name == "num" || this.name == "int" || this.name == "double");
}
+DefinedType.prototype.get$isInt = function() {
+ return $eq(this, $globals.world.intType);
+}
+DefinedType.prototype.get$isDouble = function() {
+ return $eq(this, $globals.world.doubleType);
+}
DefinedType.prototype.getCallMethod = function() {
return this.members.$index(":call");
}
@@ -11899,7 +11851,7 @@ DefinedType.prototype._cycleInClassExtends = function() {
seen.add(this);
var ancestor = this.get$parent();
while (ancestor != null) {
- if (ancestor === this) {
+ if (ancestor == this) {
return true;
}
if (seen.contains(ancestor)) {
@@ -11916,7 +11868,7 @@ DefinedType.prototype._cycleInInterfaceExtends = function() {
seen.add(this);
function _helper(ancestor) {
if (ancestor == null) return false;
- if (ancestor === $this) return true;
+ if (ancestor == $this) return true;
if (seen.contains(ancestor)) {
return false;
}
@@ -11930,28 +11882,28 @@ DefinedType.prototype._cycleInInterfaceExtends = function() {
}
return false;
}
- for (var i = 0;
+ for (var i = (0);
i < this.interfaces.get$length(); i++) {
if (_helper(this.interfaces.$index(i))) return i;
}
- return -1;
+ return (-1);
}
DefinedType.prototype.resolve = function() {
if ((this.definition instanceof TypeDefinition)) {
var typeDef = this.definition;
if (this.isClass) {
- if (typeDef.extendsTypes != null && typeDef.extendsTypes.get$length() > 0) {
- if (typeDef.extendsTypes.get$length() > 1) {
- $globals.world.error("more than one base class", typeDef.extendsTypes.$index(1).get$span());
+ if (typeDef.extendsTypes != null && typeDef.extendsTypes.get$length() > (0)) {
+ if (typeDef.extendsTypes.get$length() > (1)) {
+ $globals.world.error("more than one base class", typeDef.extendsTypes.$index((1)).get$span());
}
- var extendsTypeRef = typeDef.extendsTypes.$index(0);
+ var extendsTypeRef = typeDef.extendsTypes.$index((0));
if ((extendsTypeRef instanceof GenericTypeReference)) {
var g = extendsTypeRef;
this.set$parent(this.resolveType(g.baseType, true));
}
this.set$parent(this.resolveType(extendsTypeRef, true));
if (!this.get$parent().get$isClass()) {
- $globals.world.error("class may not extend an interface - use implements", typeDef.extendsTypes.$index(0).get$span());
+ $globals.world.error("class may not extend an interface - use implements", typeDef.extendsTypes.$index((0)).get$span());
}
this.get$parent().addDirectSubtype(this);
if (this._cycleInClassExtends()) {
@@ -11970,12 +11922,12 @@ DefinedType.prototype.resolve = function() {
}
}
else {
- if (typeDef.implementsTypes != null && typeDef.implementsTypes.get$length() > 0) {
- $globals.world.error("implements not allowed on interfaces (use extends)", typeDef.implementsTypes.$index(0).get$span());
+ if (typeDef.implementsTypes != null && typeDef.implementsTypes.get$length() > (0)) {
+ $globals.world.error("implements not allowed on interfaces (use extends)", typeDef.implementsTypes.$index((0)).get$span());
}
this.interfaces = this._resolveInterfaces(typeDef.extendsTypes);
var res = this._cycleInInterfaceExtends();
- if (res >= 0) {
+ if (res >= (0)) {
$globals.world.error(("interface \"" + this.name + "\" has a cycle in its inheritance chain"), typeDef.extendsTypes.$index(res).get$span());
}
if (typeDef.defaultType != null) {
@@ -12036,7 +11988,7 @@ DefinedType.prototype.addMethod = function(methodName, definition) {
this.constructors.$setindex(method.get$constructorName(), method);
return;
}
- if (definition.modifiers != null && definition.modifiers.get$length() == 1 && $eq(definition.modifiers.$index(0).get$kind(), 73/*TokenKind.FACTORY*/)) {
+ if (definition.modifiers != null && definition.modifiers.get$length() == (1) && $eq(definition.modifiers.$index((0)).get$kind(), (73))) {
if (this.factories.getFactory(method.get$constructorName(), method.get$name()) != null) {
$globals.world.error(("duplicate factory definition of \"" + method.get$name() + "\""), definition.span);
return;
@@ -12045,7 +11997,7 @@ DefinedType.prototype.addMethod = function(methodName, definition) {
return;
}
if (methodName.startsWith("get:") || methodName.startsWith("set:")) {
- var propName = methodName.substring(4);
+ var propName = methodName.substring((4));
var prop = this.members.$index(propName);
if (prop == null) {
prop = new PropertyMember(propName, this);
@@ -12055,7 +12007,7 @@ DefinedType.prototype.addMethod = function(methodName, definition) {
$globals.world.error(("property conflicts with field \"" + propName + "\""), definition.span);
return;
}
- if (methodName[0] == "g") {
+ if (methodName[(0)] == "g") {
if (prop.get$getter() != null) {
$globals.world.error(("duplicate getter definition for \"" + propName + "\""), definition.span);
}
@@ -12076,7 +12028,7 @@ DefinedType.prototype.addMethod = function(methodName, definition) {
this.members.$setindex(methodName, method);
}
DefinedType.prototype.addField = function(definition) {
- for (var i = 0;
+ for (var i = (0);
i < definition.names.get$length(); i++) {
var name = definition.names.$index(i).get$name();
if (this.members.containsKey(name)) {
@@ -12118,7 +12070,7 @@ DefinedType.prototype.getConstructor = function(constructorName) {
}
DefinedType.prototype._checkDefaultTypeParams = function() {
function toList(list) {
- return (list != null ? list : const$127/*const []*/);
+ return (list != null ? list : const$127);
}
var typeDef = this.definition;
if (typeDef.defaultType.oldFactory) {
@@ -12131,7 +12083,7 @@ DefinedType.prototype._checkDefaultTypeParams = function() {
$globals.world.error("\"default\" must have the same number of type parameters as the class and interface do", this.get$span(), typeDef.defaultType.span, this.defaultType.get$span());
return;
}
- for (var i = 0;
+ for (var i = (0);
i < interfaceParams.get$length(); i++) {
var ip = interfaceParams.$index(i);
var dp = defaultParams.$index(i);
@@ -12149,7 +12101,7 @@ DefinedType.prototype._checkDefaultTypeParams = function() {
}
}
DefinedType.prototype._tryCreateDefaultConstructor = function(name) {
- if (name == "" && this.definition != null && this.isClass && this.constructors.get$length() == 0) {
+ if (name == "" && this.definition != null && this.isClass && this.constructors.get$length() == (0)) {
var span = this.definition.span;
var inits = null, native_ = null, body = null;
if (this.isNative) {
@@ -12189,7 +12141,7 @@ DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) {
var jsnames = [];
var names = [];
var typeMap = new HashMapImplementation();
- for (var i = 0;
+ for (var i = (0);
i < typeArgs.get$length(); i++) {
var paramName = this.typeParameters.$index(i).get$name();
typeMap.$setindex(paramName, typeArgs.$index(i));
@@ -12235,11 +12187,11 @@ function NativeType(name) {
// Initializers done
while (true) {
if (this.name.startsWith("@")) {
- this.name = this.name.substring(1);
+ this.name = this.name.substring((1));
this.isJsGlobalObject = true;
}
else if (this.name.startsWith("*")) {
- this.name = this.name.substring(1);
+ this.name = this.name.substring((1));
this.isConstructorHidden = true;
}
else {
@@ -12247,7 +12199,7 @@ function NativeType(name) {
}
}
if (this.name.startsWith("=")) {
- this.name = this.name.substring(1);
+ this.name = this.name.substring((1));
this.isSingleton = true;
}
}
@@ -12277,7 +12229,7 @@ FixedCollection.prototype.some = function(f) {
return Collections.some(this, f);
}
FixedCollection.prototype.isEmpty = function() {
- return this.length == 0;
+ return this.length == (0);
}
FixedCollection.prototype.every$1 = function($0) {
return this.every(to$call$1($0));
@@ -12302,7 +12254,7 @@ function FixedCollection_Type(value, length) {
}
// ********** Code for FixedIterator **************
function FixedIterator(value, length) {
- this._index = 0
+ this._index = (0)
this.value = value;
this.length = length;
// Initializers done
@@ -12321,7 +12273,7 @@ FixedIterator.prototype.next$0 = FixedIterator.prototype.next;
// ********** Code for FixedIterator_E **************
$inherits(FixedIterator_E, FixedIterator);
function FixedIterator_E(value, length) {
- this._index = 0
+ this._index = (0)
this.value = value;
this.length = length;
// Initializers done
@@ -12381,9 +12333,6 @@ Value.prototype.get$type = function() {
Value.prototype.get$isConst = function() {
return false;
}
-Value.prototype.get$canonicalCode = function() {
- return null;
-}
Value.prototype.get$constValue = function() {
return null;
}
@@ -12405,6 +12354,26 @@ Value.prototype.set_ = function(context, name, node, value, isDynamic) {
return this.invokeNoSuchMethod(context, ("set:" + name), node, new Arguments(null, [value]));
}
}
+Value.prototype.binop = function(kind, other, context, node) {
+ switch (kind) {
+ case (35):
+ case (34):
+
+ var code = ("" + this.get$code() + " " + node.get$op() + " " + other.get$code());
+ return new Value($globals.world.nonNullBool, code, node.get$span(), true);
+
+ case (50):
+
+ return new Value($globals.world.nonNullBool, ("" + this.get$code() + " == " + other.get$code()), node.get$span(), true);
+
+ case (51):
+
+ return new Value($globals.world.nonNullBool, ("" + this.get$code() + " != " + other.get$code()), node.get$span(), true);
+
+ }
+ var name = kind == (49) ? ":ne" : TokenKind.binaryMethodName(kind);
+ return this.invoke(context, name, node, new Arguments(null, [other]), false);
+}
Value.prototype.invoke = function(context, name, node, args, isDynamic) {
if (name == ":call") {
if (this.isType) {
@@ -12436,7 +12405,7 @@ Value.prototype._hasOverriddenNoSuchMethod = function() {
}
else {
var m = this.get$type().resolveMember("noSuchMethod");
- return m != null && m.get$members().get$length() > 1;
+ return m != null && m.get$members().get$length() > (1);
}
}
Value.prototype._tryResolveMember = function(context, name) {
@@ -12502,7 +12471,7 @@ Value.prototype.convertTo = function(context, toType, isDynamic) {
return this._maybeWrapFunction(toType, callMethod);
}
var fromType = this.get$type();
- if (this.get$type().get$isVar() && (this.code != "null" || !toType.get$isNullable())) {
+ if (this.get$type().get$isVar() && (this.get$code() != "null" || !toType.get$isNullable())) {
fromType = $globals.world.objectType;
}
var bothNum = this.get$type().get$isNum() && toType.get$isNum();
@@ -12528,16 +12497,16 @@ Value.prototype._maybeWrapFunction = function(toType, callMethod) {
var result = this;
if (myCall == null || $ne(myCall.get$parameters().get$length(), arity)) {
var stub = $globals.world.functionType.getCallStub(Arguments.Arguments$bare$factory(arity));
- result = new Value(toType, ("to$" + stub.name + "(" + this.code + ")"), this.span, true);
+ result = new Value(toType, ("to$" + stub.name + "(" + this.get$code() + ")"), this.span, true);
}
if (toType.get$library().get$isDom() && !this.get$type().get$library().get$isDom()) {
- if (arity == 0) {
+ if (arity == (0)) {
$globals.world.gen.corejs.useWrap0 = true;
}
else {
$globals.world.gen.corejs.useWrap1 = true;
}
- result = new Value(toType, ("$wrap_call$" + arity + "(" + result.code + ")"), this.span, true);
+ result = new Value(toType, ("$wrap_call$" + arity + "(" + result.get$code() + ")"), this.span, true);
}
return result;
}
@@ -12562,17 +12531,17 @@ Value.prototype._typeAssert = function(context, toType, isDynamic) {
if (toType.get$isNum()) toType = $globals.world.numType;
var check;
if (toType.get$isVoid()) {
- check = ("$assert_void(" + this.code + ")");
+ check = ("$assert_void(" + this.get$code() + ")");
if (toType.typeCheckCode == null) {
toType.typeCheckCode = ("function $assert_void(x) {\n if (x == null) return null;\n " + throwTypeError("x") + "\n}");
}
}
else if ($eq(toType, $globals.world.nonNullBool)) {
$globals.world.gen.corejs.useNotNullBool = true;
- check = ("$notnull_bool(" + this.code + ")");
+ check = ("$notnull_bool(" + this.get$code() + ")");
}
else if (toType.get$library().get$isCore() && toType.get$typeofName() != null) {
- check = ("$assert_" + toType.name + "(" + this.code + ")");
+ check = ("$assert_" + toType.name + "(" + this.get$code() + ")");
if (toType.typeCheckCode == null) {
toType.typeCheckCode = ("function $assert_" + toType.name + "(x) {\n if (x == null || typeof(x) == \"" + toType.get$typeofName() + "\") return x;\n " + throwTypeError("x") + "\n}");
}
@@ -12581,7 +12550,7 @@ Value.prototype._typeAssert = function(context, toType, isDynamic) {
toType.isChecked = true;
var checkName = "assert$" + toType.get$jsname();
var temp = context.getTemp(this);
- check = ("(" + context.assignTemp(temp, this).code + " == null ? null :");
+ check = ("(" + context.assignTemp(temp, this).get$code() + " == null ? null :");
check = check + (" " + temp.get$code() + "." + checkName + "())");
if ($ne(this, temp)) context.freeTemp(temp);
$globals.world.objectType.varStubs.putIfAbsent(checkName, (function () {
@@ -12598,21 +12567,21 @@ Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck)
var testCode = null;
if (toType.get$isVar() || toType.get$isObject() || (toType instanceof ParameterType)) {
if (this.needsTemp) {
- return new Value($globals.world.nonNullBool, ("(" + this.code + ", true)"), span, true);
+ return new Value($globals.world.nonNullBool, ("(" + this.get$code() + ", true)"), span, true);
}
else {
- return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, true, "true", null);
+ return Value.fromBool(true, span);
}
}
if (toType.get$library().get$isCore()) {
var typeofName = toType.get$typeofName();
if (typeofName != null) {
- testCode = ("(typeof(" + this.code + ") " + (isTrue ? "==" : "!=") + " '" + typeofName + "')");
+ testCode = ("(typeof(" + this.get$code() + ") " + (isTrue ? "==" : "!=") + " '" + typeofName + "')");
}
}
if (toType.get$isClass() && !(toType instanceof ConcreteType) && !toType.get$isHiddenNativeType()) {
toType.markUsed();
- testCode = ("(" + this.code + " instanceof " + toType.get$jsname() + ")");
+ testCode = ("(" + this.get$code() + " instanceof " + toType.get$jsname() + ")");
if (!isTrue) {
testCode = "!" + testCode;
}
@@ -12621,7 +12590,7 @@ Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck)
toType.isTested = true;
var temp = context.getTemp(this);
var checkName = ("is$" + toType.get$jsname());
- testCode = ("(" + context.assignTemp(temp, this).code + " &&");
+ testCode = ("(" + context.assignTemp(temp, this).get$code() + " &&");
testCode = testCode + (" " + temp.get$code() + "." + checkName + "())");
if (isTrue) {
testCode = "!!" + testCode;
@@ -12643,7 +12612,7 @@ Value.prototype.invokeNoSuchMethod = function(context, name, node, args) {
var pos = "";
if (args != null) {
var argsCode = [];
- for (var i = 0;
+ for (var i = (0);
i < args.get$length(); i++) {
argsCode.add$1(args.values.$index(i).get$code());
}
@@ -12653,78 +12622,260 @@ Value.prototype.invokeNoSuchMethod = function(context, name, node, args) {
return this._resolveMember(context, "noSuchMethod", node, false).invoke$4(context, node, this, new Arguments(null, noSuchArgs));
}
Value.fromBool = function(value, span) {
- return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, value, value.toString(), span);
+ return new BoolValue(value, true, span);
}
Value.fromInt = function(value, span) {
- var strValue = value.toString();
- return EvaluatedValue.EvaluatedValue$factory($globals.world.numType, value, strValue, span);
+ return new IntValue(value, true, span);
}
Value.fromDouble = function(value, span) {
- var strValue = value.toString();
- if ($eq(strValue.indexOf$1("."), -1) && $eq(strValue.indexOf$1("e"), -1)) {
- strValue = strValue + ".0";
- }
- return EvaluatedValue.EvaluatedValue$factory($globals.world.numType, value, strValue, span);
+ return new DoubleValue(value, true, span);
}
Value.fromString = function(value, span) {
+ return new StringValue(value, true, span);
+}
+Value.fromNull = function(span) {
+ return new NullValue(true, span);
+}
+Value.prototype.binop$4 = Value.prototype.binop;
+Value.prototype.checkFirstClass$1 = Value.prototype.checkFirstClass;
+Value.prototype.convertTo$2 = function($0, $1) {
+ return this.convertTo($0, $1, false);
+};
+Value.prototype.convertTo$3 = Value.prototype.convertTo;
+Value.prototype.get_$3 = Value.prototype.get_;
+Value.prototype.instanceOf$3$isTrue$forceCheck = Value.prototype.instanceOf;
+Value.prototype.instanceOf$4 = function($0, $1, $2, $3) {
+ return this.instanceOf($0, $1, $2, $3, false);
+};
+Value.prototype.invoke$4 = function($0, $1, $2, $3) {
+ return this.invoke($0, $1, $2, $3, false);
+};
+Value.prototype.invoke$4$isDynamic = Value.prototype.invoke;
+Value.prototype.invoke$5 = Value.prototype.invoke;
+Value.prototype.needsConversion$1 = Value.prototype.needsConversion;
+Value.prototype.set_$4 = function($0, $1, $2, $3) {
+ return this.set_($0, $1, $2, $3, false);
+};
+// ********** Code for EvaluatedValue **************
+$inherits(EvaluatedValue, Value);
+function EvaluatedValue(isConst, type, span) {
+ this.isConst = isConst;
+ // Initializers done
+ Value.call(this, type, "@@@", span, false);
+}
+EvaluatedValue.prototype.get$isConst = function() { return this.isConst; };
+EvaluatedValue.prototype.set$isConst = function(value) { return this.isConst = value; };
+EvaluatedValue.prototype.get$code = function() {
+ return "@@@";
+}
+EvaluatedValue.prototype.get$constValue = function() {
+ return this;
+}
+EvaluatedValue.prototype.hashCode = function() {
+ return this.get$code().hashCode();
+}
+EvaluatedValue.prototype.$eq = function(other) {
+ return (other instanceof EvaluatedValue) && $eq(other.get$type(), this.get$type()) && $eq(other.get$code(), this.get$code());
+}
+EvaluatedValue.prototype.hashCode$0 = EvaluatedValue.prototype.hashCode;
+// ********** Code for NullValue **************
+$inherits(NullValue, EvaluatedValue);
+function NullValue(isConst, span) {
+ // Initializers done
+ EvaluatedValue.call(this, isConst, $globals.world.varType, span);
+}
+NullValue.prototype.get$actualValue = function() {
+ return null;
+}
+NullValue.prototype.get$code = function() {
+ return "null";
+}
+NullValue.prototype.binop = function(kind, other, context, node) {
+ if (!(other instanceof ListValue)) return Value.prototype.binop.call(this, kind, other, context, node);
+ switch (kind) {
+ case (50):
+
+ return new BoolValue($eq(this.get$type(), other.get$type()) && this.get$code() == other.get$code(), this.isConst && other.get$isConst(), node.get$span());
+
+ case (51):
+
+ return new BoolValue($ne(this.get$type(), other.get$type()) || this.get$code() != other.get$code(), this.isConst && other.get$isConst(), node.get$span());
+
+ }
+ return Value.prototype.binop.call(this, kind, other, context, node);
+}
+NullValue.prototype.binop$4 = NullValue.prototype.binop;
+// ********** Code for BoolValue **************
+$inherits(BoolValue, EvaluatedValue);
+function BoolValue(actualValue, isConst, span) {
+ this.actualValue = actualValue;
+ // Initializers done
+ EvaluatedValue.call(this, isConst, $globals.world.nonNullBool, span);
+}
+BoolValue.prototype.get$actualValue = function() { return this.actualValue; };
+BoolValue.prototype.set$actualValue = function(value) { return this.actualValue = value; };
+BoolValue.prototype.get$code = function() {
+ return this.actualValue ? "true" : "false";
+}
+BoolValue.prototype.binop = function(kind, other, context, node) {
+ if (!(other instanceof BoolValue)) return Value.prototype.binop.call(this, kind, other, context, node);
+ switch (kind) {
+ case (35):
+
+ return new BoolValue(this.actualValue && other.get$actualValue(), this.isConst && other.get$isConst(), node.get$span());
+
+ case (34):
+
+ return new BoolValue(this.actualValue || other.get$actualValue(), this.isConst && other.get$isConst(), node.get$span());
+
+ case (50):
+
+ return new BoolValue($eq(this.actualValue, other.get$actualValue()), this.isConst && other.get$isConst(), node.get$span());
+
+ case (51):
+
+ return new BoolValue($ne(this.actualValue, other.get$actualValue()), this.isConst && other.get$isConst(), node.get$span());
+
+ }
+ return Value.prototype.binop.call(this, kind, other, context, node);
+}
+BoolValue.prototype.binop$4 = BoolValue.prototype.binop;
+// ********** Code for IntValue **************
+$inherits(IntValue, EvaluatedValue);
+function IntValue(actualValue, isConst, span) {
+ this.actualValue = actualValue;
+ // Initializers done
+ EvaluatedValue.call(this, isConst, $globals.world.intType, span);
+}
+IntValue.prototype.get$actualValue = function() { return this.actualValue; };
+IntValue.prototype.set$actualValue = function(value) { return this.actualValue = value; };
+IntValue.prototype.get$code = function() {
+ return ("(" + this.actualValue + ")");
+}
+IntValue.prototype.binop = function(kind, other, context, node) {
+ if (!(other instanceof IntValue)) return Value.prototype.binop.call(this, kind, other, context, node);
+ switch (kind) {
+ case (50):
+
+ return new BoolValue(this.actualValue == other.get$actualValue(), this.isConst && other.get$isConst(), node.get$span());
+
+ case (51):
+
+ return new BoolValue(this.actualValue != other.get$actualValue(), this.isConst && other.get$isConst(), node.get$span());
+
+ }
+ return Value.prototype.binop.call(this, kind, other, context, node);
+}
+IntValue.prototype.binop$4 = IntValue.prototype.binop;
+// ********** Code for DoubleValue **************
+$inherits(DoubleValue, EvaluatedValue);
+function DoubleValue(actualValue, isConst, span) {
+ this.actualValue = actualValue;
+ // Initializers done
+ EvaluatedValue.call(this, isConst, $globals.world.doubleType, span);
+}
+DoubleValue.prototype.get$actualValue = function() { return this.actualValue; };
+DoubleValue.prototype.set$actualValue = function(value) { return this.actualValue = value; };
+DoubleValue.prototype.get$code = function() {
+ return ("(" + this.actualValue + ")");
+}
+DoubleValue.prototype.binop = function(kind, other, context, node) {
+ if (!(other instanceof DoubleValue)) return Value.prototype.binop.call(this, kind, other, context, node);
+ switch (kind) {
+ case (50):
+
+ return new BoolValue(this.actualValue == other.get$actualValue(), this.isConst && other.get$isConst(), node.get$span());
+
+ case (51):
+
+ return new BoolValue(this.actualValue != other.get$actualValue(), this.isConst && other.get$isConst(), node.get$span());
+
+ }
+ return Value.prototype.binop.call(this, kind, other, context, node);
+}
+DoubleValue.prototype.binop$4 = DoubleValue.prototype.binop;
+// ********** Code for StringValue **************
+$inherits(StringValue, EvaluatedValue);
+function StringValue(actualValue, isConst, span) {
+ this.actualValue = actualValue;
+ // Initializers done
+ EvaluatedValue.call(this, isConst, $globals.world.stringType, span);
+}
+StringValue.prototype.get$actualValue = function() { return this.actualValue; };
+StringValue.prototype.set$actualValue = function(value) { return this.actualValue = value; };
+StringValue.prototype.binop = function(kind, other, context, node) {
+ if (!(other instanceof StringValue)) return Value.prototype.binop.call(this, kind, other, context, node);
+ switch (kind) {
+ case (50):
+
+ return new BoolValue(this.actualValue == other.get$actualValue(), this.isConst && other.get$isConst(), node.get$span());
+
+ case (51):
+
+ return new BoolValue(this.actualValue != other.get$actualValue(), this.isConst && other.get$isConst(), node.get$span());
+
+ }
+ return Value.prototype.binop.call(this, kind, other, context, node);
+}
+StringValue.prototype.get$code = function() {
var buf = new StringBufferImpl("");
buf.add("\"");
- for (var i = 0;
- i < value.length; i++) {
- var ch = value.charCodeAt(i);
+ for (var i = (0);
+ i < this.actualValue.length; i++) {
+ var ch = this.actualValue.charCodeAt(i);
switch (ch) {
- case 9:
+ case (9):
buf.add("\\t");
break;
- case 10:
+ case (10):
buf.add("\\n");
break;
- case 13:
+ case (13):
buf.add("\\r");
break;
- case 34:
+ case (34):
buf.add("\\\"");
break;
- case 92:
+ case (92):
buf.add("\\\\");
break;
default:
- if (ch >= 32 && ch <= 126) {
- buf.add(value[i]);
+ if (ch >= (32) && ch <= (126)) {
+ buf.add(this.actualValue[i]);
}
else {
- var hex = ch.toRadixString$1(16);
+ var hex = ch.toRadixString$1((16));
switch (hex.get$length()) {
- case 1:
+ case (1):
buf.add("\\x0");
buf.add(hex);
break;
- case 2:
+ case (2):
buf.add("\\x");
buf.add(hex);
break;
- case 3:
+ case (3):
buf.add("\\u0");
buf.add(hex);
break;
- case 4:
+ case (4):
buf.add("\\u");
buf.add(hex);
@@ -12742,154 +12893,135 @@ Value.fromString = function(value, span) {
}
}
buf.add("\"");
- return EvaluatedValue.EvaluatedValue$factory($globals.world.stringType, value, buf.toString(), span);
+ return buf.toString();
}
-Value.fromNull = function(span) {
- return EvaluatedValue.EvaluatedValue$factory($globals.world.varType, null, "null", span);
-}
-Value.prototype.checkFirstClass$1 = Value.prototype.checkFirstClass;
-Value.prototype.convertTo$2 = function($0, $1) {
- return this.convertTo($0, $1, false);
-};
-Value.prototype.convertTo$3 = Value.prototype.convertTo;
-Value.prototype.get_$3 = Value.prototype.get_;
-Value.prototype.instanceOf$3$isTrue$forceCheck = Value.prototype.instanceOf;
-Value.prototype.instanceOf$4 = function($0, $1, $2, $3) {
- return this.instanceOf($0, $1, $2, $3, false);
-};
-Value.prototype.invoke$4 = function($0, $1, $2, $3) {
- return this.invoke($0, $1, $2, $3, false);
-};
-Value.prototype.invoke$4$isDynamic = Value.prototype.invoke;
-Value.prototype.invoke$5 = Value.prototype.invoke;
-Value.prototype.needsConversion$1 = Value.prototype.needsConversion;
-Value.prototype.set_$4 = function($0, $1, $2, $3) {
- return this.set_($0, $1, $2, $3, false);
-};
-// ********** Code for EvaluatedValue **************
-$inherits(EvaluatedValue, Value);
-function EvaluatedValue() {}
-EvaluatedValue._internal$ctor = function(type, actualValue, canonicalCode, span, code) {
- this.actualValue = actualValue;
- this.canonicalCode = canonicalCode;
+StringValue.prototype.binop$4 = StringValue.prototype.binop;
+// ********** Code for ListValue **************
+$inherits(ListValue, EvaluatedValue);
+function ListValue(values, isConst, type, span) {
+ this.values = values;
// Initializers done
- Value.call(this, type, code, span, false);
-}
-EvaluatedValue._internal$ctor.prototype = EvaluatedValue.prototype;
-EvaluatedValue.EvaluatedValue$factory = function(type, actualValue, canonicalCode, span) {
- return new EvaluatedValue._internal$ctor(type, actualValue, canonicalCode, span, EvaluatedValue.codeWithComments(canonicalCode, span));
-}
-EvaluatedValue.prototype.get$actualValue = function() { return this.actualValue; };
-EvaluatedValue.prototype.set$actualValue = function(value) { return this.actualValue = value; };
-EvaluatedValue.prototype.get$isConst = function() {
- return true;
+ EvaluatedValue.call(this, isConst, type, span);
}
-EvaluatedValue.prototype.get$constValue = function() {
- return this;
+ListValue.prototype.get$code = function() {
+ var buf = new StringBufferImpl("");
+ buf.add("[");
+ for (var i = (0);
+ i < this.values.get$length(); i = i + (1)) {
+ if (i > (0)) buf.add(", ");
+ buf.add(this.values.$index(i).get$code());
+ }
+ buf.add("]");
+ var listCode = buf.toString();
+ if (!this.isConst) return listCode;
+ var v = new Value($globals.world.listType, listCode, this.span, true);
+ var immutableListCtor = $globals.world.immutableListType.getConstructor("from");
+ var result = immutableListCtor.invoke$4(null, null, new Value.type$ctor(v.get$type(), this.span), new Arguments(null, [v]));
+ return result.get$code();
+}
+ListValue.prototype.binop = function(kind, other, context, node) {
+ if (!(other instanceof ListValue)) return Value.prototype.binop.call(this, kind, other, context, node);
+ switch (kind) {
+ case (50):
+
+ return new BoolValue($eq(this.get$type(), other.get$type()) && this.get$code() == other.get$code(), this.isConst && other.get$isConst(), node.get$span());
+
+ case (51):
+
+ return new BoolValue($ne(this.get$type(), other.get$type()) || this.get$code() != other.get$code(), this.isConst && other.get$isConst(), node.get$span());
+
+ }
+ return Value.prototype.binop.call(this, kind, other, context, node);
}
-EvaluatedValue.prototype.get$canonicalCode = function() { return this.canonicalCode; };
-EvaluatedValue.prototype.set$canonicalCode = function(value) { return this.canonicalCode = value; };
-EvaluatedValue.codeWithComments = function(canonicalCode, span) {
- return canonicalCode;
+ListValue.prototype.getGlobalValue = function() {
+ return $globals.world.gen.globalForConst(this, this.values);
}
-// ********** Code for ConstListValue **************
-$inherits(ConstListValue, EvaluatedValue);
-function ConstListValue() {}
-ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCode, span, code) {
+ListValue.prototype.binop$4 = ListValue.prototype.binop;
+ListValue.prototype.getGlobalValue$0 = ListValue.prototype.getGlobalValue;
+// ********** Code for MapValue **************
+$inherits(MapValue, EvaluatedValue);
+function MapValue(values, isConst, type, span) {
this.values = values;
// Initializers done
- EvaluatedValue._internal$ctor.call(this, type, actualValue, canonicalCode, span, code);
+ EvaluatedValue.call(this, isConst, type, span);
}
-ConstListValue._internal$ctor.prototype = ConstListValue.prototype;
-ConstListValue.ConstListValue$factory = function(type, values, actualValue, canonicalCode, span) {
- return new ConstListValue._internal$ctor(type, values, actualValue, canonicalCode, span, EvaluatedValue.codeWithComments(canonicalCode, span));
+MapValue.prototype.get$code = function() {
+ var items = new ListValue(this.values, false, $globals.world.listType, this.span);
+ var tp = $globals.world.corelib.topType;
+ var f = this.isConst ? tp.getMember$1("_constMap") : tp.getMember$1("_map");
+ var value = f.invoke(null, null, new Value.type$ctor(tp, null), new Arguments(null, [items]), false);
+ return value.get$code();
}
-ConstListValue.prototype.get$values = function() { return this.values; };
-ConstListValue.prototype.set$values = function(value) { return this.values = value; };
-// ********** Code for ConstMapValue **************
-$inherits(ConstMapValue, EvaluatedValue);
-function ConstMapValue() {}
-ConstMapValue._internal$ctor = function(type, values, actualValue, canonicalCode, span, code) {
- this.values = values;
- // Initializers done
- EvaluatedValue._internal$ctor.call(this, type, actualValue, canonicalCode, span, code);
+MapValue.prototype.getGlobalValue = function() {
+ return $globals.world.gen.globalForConst(this, this.values);
}
-ConstMapValue._internal$ctor.prototype = ConstMapValue.prototype;
-ConstMapValue.ConstMapValue$factory = function(type, keyValuePairs, actualValue, canonicalCode, span) {
- var values = new HashMapImplementation();
- for (var i = 0;
- i < keyValuePairs.get$length(); i += 2) {
- values.$setindex(keyValuePairs.$index(i).get$actualValue(), keyValuePairs.$index(i + 1));
+MapValue.prototype.binop = function(kind, other, context, node) {
+ if (!(other instanceof MapValue)) return Value.prototype.binop.call(this, kind, other, context, node);
+ switch (kind) {
+ case (50):
+
+ return new BoolValue($eq(this.get$type(), other.get$type()) && this.get$code() == other.get$code(), this.isConst && other.get$isConst(), node.get$span());
+
+ case (51):
+
+ return new BoolValue($ne(this.get$type(), other.get$type()) || this.get$code() != other.get$code(), this.isConst && other.get$isConst(), node.get$span());
+
}
- return new ConstMapValue._internal$ctor(type, values, actualValue, canonicalCode, span, EvaluatedValue.codeWithComments(canonicalCode, span));
+ return Value.prototype.binop.call(this, kind, other, context, node);
}
-ConstMapValue.prototype.get$values = function() { return this.values; };
-ConstMapValue.prototype.set$values = function(value) { return this.values = value; };
-// ********** Code for ConstObjectValue **************
-$inherits(ConstObjectValue, EvaluatedValue);
-function ConstObjectValue() {}
-ConstObjectValue._internal$ctor = function(type, fields, actualValue, canonicalCode, span, code) {
+MapValue.prototype.binop$4 = MapValue.prototype.binop;
+MapValue.prototype.getGlobalValue$0 = MapValue.prototype.getGlobalValue;
+// ********** Code for ObjectValue **************
+$inherits(ObjectValue, EvaluatedValue);
+function ObjectValue(fields, isConst, type, _code, span) {
this.fields = fields;
+ this._code = _code;
// Initializers done
- EvaluatedValue._internal$ctor.call(this, type, actualValue, canonicalCode, span, code);
+ EvaluatedValue.call(this, isConst, type, span);
}
-ConstObjectValue._internal$ctor.prototype = ConstObjectValue.prototype;
-ConstObjectValue.ConstObjectValue$factory = function(type, fields, canonicalCode, span) {
- var fieldValues = [];
- var $$list = fields.getKeys();
- for (var $$i = fields.getKeys().iterator$0(); $$i.hasNext$0(); ) {
- var f = $$i.next$0();
- fieldValues.add(("" + f + " = " + fields.$index(f).get$actualValue()));
+ObjectValue.prototype.get$fields = function() { return this.fields; };
+ObjectValue.prototype.set$fields = function(value) { return this.fields = value; };
+ObjectValue.prototype.get$code = function() {
+ return this._code;
+}
+ObjectValue.prototype.binop = function(kind, other, context, node) {
+ if (!(other instanceof ObjectValue)) return Value.prototype.binop.call(this, kind, other, context, node);
+ switch (kind) {
+ case (50):
+
+ return new BoolValue($eq(this.get$type(), other.get$type()) && this.get$code() == other.get$code(), this.isConst && other.get$isConst(), node.get$span());
+
+ case (51):
+
+ return new BoolValue($ne(this.get$type(), other.get$type()) || this.get$code() != other.get$code(), this.isConst && other.get$isConst(), node.get$span());
+
}
- fieldValues.sort((function (a, b) {
- return a.compareTo$1(b);
- })
- );
- var actualValue = ("const " + type.get$jsname() + " [") + Strings.join(fieldValues, ",") + "]";
- return new ConstObjectValue._internal$ctor(type, fields, actualValue, canonicalCode, span, EvaluatedValue.codeWithComments(canonicalCode, span));
+ return Value.prototype.binop.call(this, kind, other, context, node);
}
-ConstObjectValue.prototype.get$fields = function() { return this.fields; };
-ConstObjectValue.prototype.set$fields = function(value) { return this.fields = value; };
+ObjectValue.prototype.binop$4 = ObjectValue.prototype.binop;
// ********** Code for GlobalValue **************
$inherits(GlobalValue, Value);
-function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span, _dependencies) {
+function GlobalValue(type, code, isConst, field, name, exp, span, _dependencies) {
this.field = field;
this.name = name;
this.exp = exp;
- this.canonicalCode = canonicalCode;
this.dependencies = [];
// Initializers done
Value.call(this, type, code, span, !isConst);
for (var $$i = 0;$$i < _dependencies.get$length(); $$i++) {
var dep = _dependencies.$index($$i);
- this.dependencies.add(dep);
- this.dependencies.addAll(dep.get$dependencies());
+ if ((dep instanceof GlobalValue)) {
+ this.dependencies.add(dep);
+ this.dependencies.addAll(dep.get$dependencies());
+ }
}
}
-GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies) {
- var code = (exp.get$isConst() ? exp.get$canonicalCode() : exp.code);
- var codeWithComment = ("" + code + "/*" + field.get$declaringType().get$name() + "." + field.get$name() + "*/");
- return new GlobalValue(exp.get$type(), codeWithComment, field.get$isFinal(), field, null, exp, code, exp.span, dependencies.filter$1((function (d) {
- return (d instanceof GlobalValue);
- })
- ));
-}
-GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies) {
- var name = ("const$" + uniqueId);
- var codeWithComment = ("" + name + "/*" + _escapeForComment(exp.span.get$text()) + "*/");
- return new GlobalValue(exp.get$type(), codeWithComment, true, null, name, exp, name, exp.span, dependencies.filter$1((function (d) {
- return (d instanceof GlobalValue);
- })
- ));
-}
GlobalValue.prototype.get$field = function() { return this.field; };
GlobalValue.prototype.set$field = function(value) { return this.field = value; };
GlobalValue.prototype.get$name = function() { return this.name; };
GlobalValue.prototype.set$name = function(value) { return this.name = value; };
GlobalValue.prototype.get$exp = function() { return this.exp; };
GlobalValue.prototype.set$exp = function(value) { return this.exp = value; };
-GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode; };
-GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonicalCode = value; };
GlobalValue.prototype.get$isConst = function() {
return this.exp.get$isConst() && (this.field == null || this.field.isFinal);
}
@@ -12903,25 +13035,25 @@ GlobalValue.prototype.get$dependencies = function() { return this.dependencies;
GlobalValue.prototype.set$dependencies = function(value) { return this.dependencies = value; };
GlobalValue.prototype.compareTo = function(other) {
if ($eq(other, this)) {
- return 0;
+ return (0);
}
- else if (this.dependencies.indexOf(other) >= 0) {
- return 1;
+ else if (this.dependencies.indexOf(other) >= (0)) {
+ return (1);
}
- else if (other.dependencies.indexOf(this) >= 0) {
- return -1;
+ else if (other.dependencies.indexOf(this) >= (0)) {
+ return (-1);
}
else if (this.dependencies.get$length() > other.dependencies.get$length()) {
- return 1;
+ return (1);
}
else if (this.dependencies.get$length() < other.dependencies.get$length()) {
- return -1;
+ return (-1);
}
else if (this.name == null && other.name != null) {
- return 1;
+ return (1);
}
else if (this.name != null && other.name == null) {
- return -1;
+ return (-1);
}
else if (this.name != null) {
return this.name.compareTo(other.name);
@@ -12984,10 +13116,10 @@ CompilerException.prototype.toString = function() {
CompilerException.prototype.toString$0 = CompilerException.prototype.toString;
// ********** Code for World **************
function World(files) {
- this.errors = 0
- this.warnings = 0
- this.dartBytesRead = 0
- this.jsBytesWritten = 0
+ this.errors = (0)
+ this.warnings = (0)
+ this.dartBytesRead = (0)
+ this.jsBytesWritten = (0)
this.seenFatal = false
this.files = files;
this.libraries = new HashMapImplementation();
@@ -13048,7 +13180,7 @@ World.prototype._addTopName = function(named) {
}
World.prototype._addJavascriptTopName = function(named, name) {
var existing = this._topNames.$index(name);
- if (existing === named) {
+ if (existing == named) {
if (named.get$avoidNativeName()) {
this._renameJavascriptTopName(named);
}
@@ -13057,7 +13189,7 @@ World.prototype._addJavascriptTopName = function(named, name) {
this.info(("mangling matching top level name \"" + named.get$jsname() + "\" in ") + ("both \"" + named.get$library().get$jsname() + "\" and \"" + existing.get$library().get$jsname() + "\""));
var existingPri = existing.get$jsnamePriority();
var namedPri = named.get$jsnamePriority();
- if (existingPri > namedPri || namedPri == 0) {
+ if (existingPri > namedPri || namedPri == (0)) {
this._renameJavascriptTopName(named);
}
else if (namedPri > existingPri) {
@@ -13205,7 +13337,7 @@ World.prototype.getOrAddLibrary = function(filename) {
return library;
}
World.prototype.process = function() {
- while (this._todo.get$length() > 0) {
+ while (this._todo.get$length() > (0)) {
var todo = this._todo;
this._todo = [];
for (var $$i = 0;$$i < todo.get$length(); $$i++) {
@@ -13233,10 +13365,10 @@ World.prototype.get$resolveAll = function() {
World.prototype.findMainMethod = function(lib) {
var mainMembers = lib.topType.resolveMember("main");
var main = null;
- if (mainMembers == null || $eq(mainMembers.get$members().get$length(), 0)) {
+ if (mainMembers == null || $eq(mainMembers.get$members().get$length(), (0))) {
this.fatal("no main method specified");
}
- else if (mainMembers.get$members().get$length() > 1) {
+ else if (mainMembers.get$members().get$length() > (1)) {
var $$list = mainMembers.get$members();
for (var $$i = mainMembers.get$members().iterator$0(); $$i.hasNext$0(); ) {
var m = $$i.next$0();
@@ -13245,7 +13377,7 @@ World.prototype.findMainMethod = function(lib) {
}
}
else {
- main = mainMembers.get$members().$index(0);
+ main = mainMembers.get$members().$index((0));
}
return main;
}
@@ -13320,7 +13452,7 @@ World.prototype.withoutForceDynamic = function(fn) {
}
}
World.prototype.get$hasErrors = function() {
- return this.errors > 0;
+ return this.errors > (0);
}
World.prototype.printStatus = function() {
this.info(("compiled " + this.dartBytesRead + " bytes Dart -> " + this.jsBytesWritten + " bytes JS"));
@@ -13328,7 +13460,7 @@ World.prototype.printStatus = function() {
print(("compilation failed with " + this.errors + " errors"));
}
else {
- if (this.warnings > 0) {
+ if (this.warnings > (0)) {
this.info(("compilation completed successfully with " + this.warnings + " warnings"));
}
else {
@@ -13372,13 +13504,13 @@ function FrogOptions(homedir, args, files) {
}
else {
$globals.world.error(("Invalid configuration " + this.config));
- $throw(("Invalid configuration"));
+ $throw("Invalid configuration");
}
var ignoreUnrecognizedFlags = false;
var passedLibDir = false;
this.childArgs = [];
loop:
- for (var i = 2;
+ for (var i = (2);
i < args.get$length(); i++) {
var arg = args.$index(i);
switch (arg) {
@@ -13468,7 +13600,7 @@ function FrogOptions(homedir, args, files) {
if (arg.endsWith$1(".dart")) {
this.dartScript = arg;
- this.childArgs = args.getRange(i + 1, args.get$length() - i - 1);
+ this.childArgs = args.getRange(i + (1), args.get$length() - i - (1));
break loop;
}
else if (arg.startsWith$1("--out=")) {
@@ -13535,7 +13667,7 @@ VarMember.prototype.get$returnType = function() {
return $globals.world.varType;
}
VarMember.prototype.invoke = function(context, node, target, args) {
- return new Value(this.get$returnType(), ("" + target.code + "." + this.name + "(" + args.getCode() + ")"), node.span, true);
+ return new Value(this.get$returnType(), ("" + target.get$code() + "." + this.name + "(" + args.getCode() + ")"), node.span, true);
}
VarMember.prototype.generate$1 = VarMember.prototype.generate;
VarMember.prototype.invoke$4 = VarMember.prototype.invoke;
@@ -13631,7 +13763,7 @@ VarMethodStub.prototype._needsExactTypeCheck = function() {
return members.filter$1((function (m) {
return $ne(m, $this.member) && m.get$declaringType().get$isHiddenNativeType();
})
- ).get$length() >= 1;
+ ).get$length() >= (1);
}
VarMethodStub.prototype._useDirectCall = function(args) {
if ((this.member instanceof MethodMember) && !this.member.declaringType.get$hasNativeSubtypes()) {
@@ -13704,7 +13836,7 @@ function map(source, mapper) {
if (!!(source && source.is$List())) {
var list = source;
result.set$length(list.get$length());
- for (var i = 0;
+ for (var i = (0);
i < list.get$length(); i++) {
result.$setindex(i, mapper(list.$index(i)));
}
@@ -13741,9 +13873,6 @@ function orderValuesByKeys(map) {
}
return values;
}
-function _escapeForComment(text) {
- return text.replaceAll("/*", "/ *").replaceAll("*/", "* /");
-}
var world;
var experimentalAwaitPhase;
var legCompile;
@@ -13776,12 +13905,12 @@ function _getCallStubName(name, args) {
// ********** Library minfrog **************
// ********** Code for top level **************
function main() {
- var homedir = path.dirname(fs.realpathSync(get$process().get$argv().$index(1)));
+ var homedir = path.dirname(fs.realpathSync(get$process().get$argv().$index((1))));
var argv = [];
- for (var i = 0;
+ for (var i = (0);
i < get$process().get$argv().get$length(); i++) {
argv.add$1(get$process().get$argv().$index(i));
- if (i == 1) {
+ if (i == (1)) {
var terminal = get$process().get$env().$index("TERM");
if (terminal == null || !terminal.startsWith$1("xterm")) {
argv.add$1("--no_colors");
@@ -13799,13 +13928,13 @@ function main() {
}
}
else {
- get$process().set$argv([argv.$index(0), argv.$index(1)]);
+ get$process().set$argv([argv.$index((0)), argv.$index((1))]);
get$process().get$argv().addAll($globals.options.childArgs);
vm.runInNewContext(code, createSandbox());
}
}
else {
- get$process().exit(1);
+ get$process().exit((1));
}
}
// ********** Generic Type Inheritance **************

Powered by Google App Engine
This is Rietveld 408576698