Index: frog/minfrog |
diff --git a/frog/minfrog b/frog/minfrog |
index 0264c9962365eda9bdadefda9a2e7b742a908b8e..579cb3f23d2edc27b7890f82fd59cc76e107de82 100755 |
--- a/frog/minfrog |
+++ b/frog/minfrog |
@@ -38,6 +38,10 @@ function $add(x, y) { |
(typeof(x) == 'string')) |
? x + y : x.$add(y); |
} |
+function $bit_xor(x, y) { |
+ return (typeof(x) == 'number' && typeof(y) == 'number') |
+ ? x ^ y : x.$bit_xor(y); |
+} |
function $eq(x, y) { |
if (x == null) return y == null; |
return (typeof(x) == 'number' && typeof(y) == 'number') || |
@@ -49,6 +53,22 @@ function $eq(x, y) { |
Object.defineProperty(Object.prototype, '$eq', { value: function(other) { |
return this === other; |
}, enumerable: false, writable: true, configurable: true }); |
+function $gt(x, y) { |
+ return (typeof(x) == 'number' && typeof(y) == 'number') |
+ ? x > y : x.$gt(y); |
+} |
+function $gte(x, y) { |
+ return (typeof(x) == 'number' && typeof(y) == 'number') |
+ ? x >= y : x.$gte(y); |
+} |
+function $lt(x, y) { |
+ return (typeof(x) == 'number' && typeof(y) == 'number') |
+ ? x < y : x.$lt(y); |
+} |
+function $lte(x, y) { |
+ return (typeof(x) == 'number' && typeof(y) == 'number') |
+ ? x <= y : x.$lte(y); |
+} |
function $mod(x, y) { |
if (typeof(x) == 'number' && typeof(y) == 'number') { |
var result = x % y; |
@@ -66,6 +86,10 @@ function $mod(x, y) { |
return x.$mod(y); |
} |
} |
+function $mul(x, y) { |
+ return (typeof(x) == 'number' && typeof(y) == 'number') |
+ ? x * y : x.$mul(y); |
+} |
function $ne(x, y) { |
if (x == null) return y != null; |
return (typeof(x) == 'number' && typeof(y) == 'number') || |
@@ -73,6 +97,14 @@ function $ne(x, y) { |
(typeof(x) == 'string' && typeof(y) == 'string') |
? x != y : !x.$eq(y); |
} |
+function $shl(x, y) { |
+ return (typeof(x) == 'number' && typeof(y) == 'number') |
+ ? x << y : x.$shl(y); |
+} |
+function $sub(x, y) { |
+ return (typeof(x) == 'number' && typeof(y) == 'number') |
+ ? x - y : x.$sub(y); |
+} |
function $truncdiv(x, y) { |
if (typeof(x) == 'number' && typeof(y) == 'number') { |
if (y == 0) $throw(new IntegerDivisionByZeroException()); |
@@ -89,182 +121,29 @@ Object.defineProperty(Object.prototype, "get$dynamic", { value: function() { |
Object.defineProperty(Object.prototype, "noSuchMethod", { value: function(name, args) { |
$throw(new NoSuchMethodException(this, name, args)); |
}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "_asNonSentinelEntry$0", { value: function() { |
- return this.noSuchMethod$2("_asNonSentinelEntry", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "_checkExtends$0", { value: function() { |
- return this.noSuchMethod$2("_checkExtends", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "_checkNonStatic$1", { value: function($0) { |
- return this.noSuchMethod$2("_checkNonStatic", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "_evalConstConstructor$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("_evalConstConstructor", [$0, $1]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "_get$3", { value: function($0, $1, $2) { |
- return this.noSuchMethod$2("_get", [$0, $1, $2]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "_get$3$isDynamic", { value: function($0, $1, $2, isDynamic) { |
- return this.noSuchMethod$2("_get", [$0, $1, $2, isDynamic]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "_get$4", { value: function($0, $1, $2, $3) { |
- return this.noSuchMethod$2("_get", [$0, $1, $2, $3]); |
-}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "_pushBlock$1", { value: function($0) { |
- return this.noSuchMethod$2("_pushBlock", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "_set$4$isDynamic", { value: function($0, $1, $2, $3, isDynamic) { |
- return this.noSuchMethod$2("_set", [$0, $1, $2, $3, isDynamic]); |
+ return this.noSuchMethod("_pushBlock", [$0]); |
}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "_set$5", { value: function($0, $1, $2, $3, $4) { |
- return this.noSuchMethod$2("_set", [$0, $1, $2, $3, $4]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "add$1", { value: function($0) { |
- return this.noSuchMethod$2("add", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "addAll$1", { value: function($0) { |
- return this.noSuchMethod$2("addAll", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "addDirectSubtype$1", { value: function($0) { |
- return this.noSuchMethod$2("addDirectSubtype", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "addLast$1", { value: function($0) { |
- return this.noSuchMethod$2("addLast", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "addMethod$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("addMethod", [$0, $1]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "addSource$1", { value: function($0) { |
- return this.noSuchMethod$2("addSource", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "binop$4", { value: function($0, $1, $2, $3) { |
- return this.noSuchMethod$2("binop", [$0, $1, $2, $3]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "block$0", { value: function() { |
- return this.noSuchMethod$2("block", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "canInvoke$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("canInvoke", [$0, $1]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "checkFirstClass$1", { value: function($0) { |
- return this.noSuchMethod$2("checkFirstClass", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "compareTo$1", { value: function($0) { |
- return this.noSuchMethod$2("compareTo", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "compilationUnit$0", { value: function() { |
- return this.noSuchMethod$2("compilationUnit", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "computeValue$0", { value: function() { |
- return this.noSuchMethod$2("computeValue", []); |
+Object.defineProperty(Object.prototype, "analyze$1", { value: function($0) { |
+ return this.noSuchMethod("analyze", [$0]); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "contains$1", { value: function($0) { |
- return this.noSuchMethod$2("contains", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "containsKey$1", { value: function($0) { |
- return this.noSuchMethod$2("containsKey", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "convertTo$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("convertTo", [$0, $1]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "convertTo$3", { value: function($0, $1, $2) { |
- return this.noSuchMethod$2("convertTo", [$0, $1, $2]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "copyWithNewType$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("copyWithNewType", [$0, $1]); |
+ return this.noSuchMethod("contains", [$0]); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "create$3$isFinal", { value: function($0, $1, $2, isFinal) { |
- return this.noSuchMethod$2("create", [$0, $1, $2, isFinal]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "elapsedInMs$0", { value: function() { |
- return this.noSuchMethod$2("elapsedInMs", []); |
+ return this.noSuchMethod("create", [$0, $1, $2, isFinal]); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "end$0", { value: function() { |
- return this.noSuchMethod$2("end", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "endsWith$1", { value: function($0) { |
- return this.noSuchMethod$2("endsWith", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "ensureSubtypeOf$3", { value: function($0, $1, $2) { |
- return this.noSuchMethod$2("ensureSubtypeOf", [$0, $1, $2]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "evalBody$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("evalBody", [$0, $1]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "filter$1", { value: function($0) { |
- return this.noSuchMethod$2("filter", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "findTypeByName$1", { value: function($0) { |
- return this.noSuchMethod$2("findTypeByName", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "forEach$1", { value: function($0) { |
- return this.noSuchMethod$2("forEach", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "genValue$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("genValue", [$0, $1]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "generate$1", { value: function($0) { |
- return this.noSuchMethod$2("generate", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "getColumn$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("getColumn", [$0, $1]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "getConstructor$1", { value: function($0) { |
- return this.noSuchMethod$2("getConstructor", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "getFactory$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("getFactory", [$0, $1]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "getGlobalValue$0", { value: function() { |
- return this.noSuchMethod$2("getGlobalValue", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "getKeys$0", { value: function() { |
- return this.noSuchMethod$2("getKeys", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "getLine$1", { value: function($0) { |
- return this.noSuchMethod$2("getLine", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "getMember$1", { value: function($0) { |
- return this.noSuchMethod$2("getMember", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "getOrMakeConcreteType$1", { value: function($0) { |
- return this.noSuchMethod$2("getOrMakeConcreteType", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "getValues$0", { value: function() { |
- return this.noSuchMethod$2("getValues", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "get_$3", { value: function($0, $1, $2) { |
- return this.noSuchMethod$2("get_", [$0, $1, $2]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "hasNext$0", { value: function() { |
- return this.noSuchMethod$2("hasNext", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "hashCode$0", { value: function() { |
- return this.noSuchMethod$2("hashCode", []); |
+ return this.noSuchMethod("end", []); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "indexOf$1", { value: function($0) { |
- return this.noSuchMethod$2("indexOf", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "initFields$0", { value: function() { |
- return this.noSuchMethod$2("initFields", []); |
+ return this.noSuchMethod("indexOf", [$0]); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "instanceOf$3$isTrue$forceCheck", { value: function($0, $1, $2, isTrue, forceCheck) { |
- return this.noSuchMethod$2("instanceOf", [$0, $1, $2, isTrue, forceCheck]); |
+ return this.noSuchMethod("instanceOf", [$0, $1, $2, isTrue, forceCheck]); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "instanceOf$4", { value: function($0, $1, $2, $3) { |
- return this.noSuchMethod$2("instanceOf", [$0, $1, $2, $3]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "invoke$4", { value: function($0, $1, $2, $3) { |
- return this.noSuchMethod$2("invoke", [$0, $1, $2, $3]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "invoke$4$isDynamic", { value: function($0, $1, $2, $3, isDynamic) { |
- return this.noSuchMethod$2("invoke", [$0, $1, $2, $3, isDynamic]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "invoke$5", { value: function($0, $1, $2, $3, $4) { |
- return this.noSuchMethod$2("invoke", [$0, $1, $2, $3, $4]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "invokeNoSuchMethod$4", { value: function($0, $1, $2, $3) { |
- return this.noSuchMethod$2("invokeNoSuchMethod", [$0, $1, $2, $3]); |
+ return this.noSuchMethod("instanceOf", [$0, $1, $2, $3]); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "is$List", { value: function() { |
return false; |
@@ -272,197 +151,38 @@ Object.defineProperty(Object.prototype, "is$List", { value: function() { |
Object.defineProperty(Object.prototype, "is$RegExp", { value: function() { |
return false; |
}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "isAssignable$1", { value: function($0) { |
- return this.noSuchMethod$2("isAssignable", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "isEmpty$0", { value: function() { |
- return this.noSuchMethod$2("isEmpty", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "isSubtypeOf$1", { value: function($0) { |
- return this.noSuchMethod$2("isSubtypeOf", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "iterator$0", { value: function() { |
- return this.noSuchMethod$2("iterator", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "last$0", { value: function() { |
- return this.noSuchMethod$2("last", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "lookup$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("lookup", [$0, $1]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "markUsed$0", { value: function() { |
- return this.noSuchMethod$2("markUsed", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "namesInOrder$1", { value: function($0) { |
- return this.noSuchMethod$2("namesInOrder", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "needsConversion$1", { value: function($0) { |
- return this.noSuchMethod$2("needsConversion", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "next$0", { value: function() { |
- return this.noSuchMethod$2("next", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "noSuchMethod$2", { value: function($0, $1) { |
- return this.noSuchMethod($0, $1); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "postResolveChecks$0", { value: function() { |
- return this.noSuchMethod$2("postResolveChecks", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "provideFieldSyntax$0", { value: function() { |
- return this.noSuchMethod$2("provideFieldSyntax", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "providePropertySyntax$0", { value: function() { |
- return this.noSuchMethod$2("providePropertySyntax", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "removeLast$0", { value: function() { |
- return this.noSuchMethod$2("removeLast", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "replaceFirst$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("replaceFirst", [$0, $1]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "replaceValue$1", { value: function($0) { |
- return this.noSuchMethod$2("replaceValue", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "resolve$0", { value: function() { |
- return this.noSuchMethod$2("resolve", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "resolveType$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("resolveType", [$0, $1]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "resolveTypeParams$1", { value: function($0) { |
- return this.noSuchMethod$2("resolveTypeParams", [$0]); |
+Object.defineProperty(Object.prototype, "remove$1", { value: function($0) { |
+ return this.noSuchMethod("remove", [$0]); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "run$0", { value: function() { |
- return this.noSuchMethod$2("run", []); |
+ return this.noSuchMethod("run", []); |
}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "setDefinition$1", { value: function($0) { |
- return this.noSuchMethod$2("setDefinition", [$0]); |
+Object.defineProperty(Object.prototype, "setIndex$4$kind", { value: function($0, $1, $2, $3, kind) { |
+ return this.noSuchMethod("setIndex", [$0, $1, $2, $3, kind]); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "setIndex$4$kind$returnKind", { value: function($0, $1, $2, $3, kind, returnKind) { |
- return this.noSuchMethod$2("setIndex", [$0, $1, $2, $3, kind, returnKind]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "set_$4$kind$returnKind", { value: function($0, $1, $2, $3, kind, returnKind) { |
- return this.noSuchMethod$2("set_", [$0, $1, $2, $3, kind, returnKind]); |
+ return this.noSuchMethod("setIndex", [$0, $1, $2, $3, kind, returnKind]); |
}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "sort$1", { value: function($0) { |
- return this.noSuchMethod$2("sort", [$0]); |
+Object.defineProperty(Object.prototype, "set_$4$kind", { value: function($0, $1, $2, $3, kind) { |
+ return this.noSuchMethod("set_", [$0, $1, $2, $3, kind]); |
}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "start$0", { value: function() { |
- return this.noSuchMethod$2("start", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "startsWith$1", { value: function($0) { |
- return this.noSuchMethod$2("startsWith", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "stop$0", { value: function() { |
- return this.noSuchMethod$2("stop", []); |
+Object.defineProperty(Object.prototype, "set_$4$kind$returnKind", { value: function($0, $1, $2, $3, kind, returnKind) { |
+ return this.noSuchMethod("set_", [$0, $1, $2, $3, kind, returnKind]); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "substring$1", { value: function($0) { |
- return this.noSuchMethod$2("substring", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "substring$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("substring", [$0, $1]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "toRadixString$1", { value: function($0) { |
- return this.noSuchMethod$2("toRadixString", [$0]); |
+ return this.noSuchMethod("substring", [$0]); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "toString$0", { value: function() { |
return this.toString(); |
}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "unop$3", { value: function($0, $1, $2) { |
- return this.noSuchMethod$2("unop", [$0, $1, $2]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visit$1", { value: function($0) { |
- return this.noSuchMethod$2("visit", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitAssertStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitAssertStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "visitBinaryExpression$1", { value: function($0) { |
- return this.noSuchMethod$2("visitBinaryExpression", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitBlockStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitBlockStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitBreakStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitBreakStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitContinueStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitContinueStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitDeclaredIdentifier$1", { value: function($0) { |
- return this.noSuchMethod$2("visitDeclaredIdentifier", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitDietStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitDietStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitDoStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitDoStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitEmptyStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitEmptyStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitExpressionStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitExpressionStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitForInStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitForInStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitForStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitForStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitFunctionDefinition$1", { value: function($0) { |
- return this.noSuchMethod$2("visitFunctionDefinition", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitIfStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitIfStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitIndexExpression$1", { value: function($0) { |
- return this.noSuchMethod$2("visitIndexExpression", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitLabeledStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitLabeledStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitLambdaExpression$1", { value: function($0) { |
- return this.noSuchMethod$2("visitLambdaExpression", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitLiteralExpression$1", { value: function($0) { |
- return this.noSuchMethod$2("visitLiteralExpression", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitMapExpression$1", { value: function($0) { |
- return this.noSuchMethod$2("visitMapExpression", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitNewExpression$1", { value: function($0) { |
- return this.noSuchMethod$2("visitNewExpression", [$0]); |
+ return this.noSuchMethod("visitBinaryExpression", [$0]); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "visitPostfixExpression$1", { value: function($0) { |
- return this.noSuchMethod$2("visitPostfixExpression", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitReturnStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitReturnStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitSources$0", { value: function() { |
- return this.noSuchMethod$2("visitSources", []); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitSwitchStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitSwitchStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitThrowStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitThrowStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitTryStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitTryStatement", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitVariableDefinition$1", { value: function($0) { |
- return this.noSuchMethod$2("visitVariableDefinition", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "visitWhileStatement$1", { value: function($0) { |
- return this.noSuchMethod$2("visitWhileStatement", [$0]); |
+ return this.noSuchMethod("visitPostfixExpression", [$0]); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(Object.prototype, "write$1", { value: function($0) { |
- return this.noSuchMethod$2("write", [$0]); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(Object.prototype, "writeDefinition$2", { value: function($0, $1) { |
- return this.noSuchMethod$2("writeDefinition", [$0, $1]); |
+ return this.noSuchMethod("write", [$0]); |
}, enumerable: false, writable: true, configurable: true }); |
// ********** Code for Clock ************** |
function Clock() {} |
@@ -493,10 +213,10 @@ NoSuchMethodException.prototype.toString = function() { |
if (i > (0)) { |
sb.add(", "); |
} |
- sb.add(this._arguments[i]); |
+ sb.add(this._arguments.$index(i)); |
} |
sb.add("]"); |
- return ("NoSuchMethodException - receiver: '" + this._receiver + "' ") + ("function name: '" + this._functionName + "' arguments: [" + sb + "]"); |
+ return $add(("NoSuchMethodException - receiver: '" + this._receiver + "' "), ("function name: '" + this._functionName + "' arguments: [" + sb + "]")); |
} |
NoSuchMethodException.prototype.toString$0 = NoSuchMethodException.prototype.toString; |
// ********** Code for ClosureArgumentMismatchException ************** |
@@ -682,9 +402,9 @@ ListFactory = Array; |
Object.defineProperty(ListFactory.prototype, "is$List", { value: function(){return true}, enumerable: false, writable: true, configurable: true }); |
ListFactory.ListFactory$from$factory = function(other) { |
var list = []; |
- for (var $$i = other.iterator$0(); $$i.hasNext$0(); ) { |
- var e = $$i.next$0(); |
- list.add$1(e); |
+ for (var $$i = other.iterator(); $$i.hasNext(); ) { |
+ var e = $$i.next(); |
+ list.add(e); |
} |
return list; |
} |
@@ -697,8 +417,8 @@ Object.defineProperty(ListFactory.prototype, "addLast", { value: function(value) |
this.push(value); |
}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(ListFactory.prototype, "addAll", { value: function(collection) { |
- for (var $$i = collection.iterator$0(); $$i.hasNext$0(); ) { |
- var item = $$i.next$0(); |
+ for (var $$i = collection.iterator(); $$i.hasNext(); ) { |
+ var item = $$i.next(); |
this.add(item); |
} |
}, enumerable: false, writable: true, configurable: true }); |
@@ -720,30 +440,7 @@ Object.defineProperty(ListFactory.prototype, "isEmpty", { value: function() { |
Object.defineProperty(ListFactory.prototype, "iterator", { value: function() { |
return new ListIterator(this); |
}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(ListFactory.prototype, "add$1", { value: ListFactory.prototype.add, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(ListFactory.prototype, "addAll$1", { value: ListFactory.prototype.addAll, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(ListFactory.prototype, "addLast$1", { value: ListFactory.prototype.addLast, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(ListFactory.prototype, "filter$1", { value: function($0) { |
- return this.filter(to$call$1($0)); |
-}, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(ListFactory.prototype, "forEach$1", { value: function($0) { |
- return this.forEach(to$call$1($0)); |
-}, enumerable: false, writable: true, configurable: true }); |
Object.defineProperty(ListFactory.prototype, "indexOf$1", { value: ListFactory.prototype.indexOf, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(ListFactory.prototype, "isEmpty$0", { value: ListFactory.prototype.isEmpty, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(ListFactory.prototype, "iterator$0", { value: ListFactory.prototype.iterator, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(ListFactory.prototype, "last$0", { value: ListFactory.prototype.last, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(ListFactory.prototype, "removeLast$0", { value: ListFactory.prototype.removeLast, enumerable: false, writable: true, configurable: true }); |
-Object.defineProperty(ListFactory.prototype, "sort$1", { value: function($0) { |
- return this.sort(to$call$2($0)); |
-}, enumerable: false, writable: true, configurable: true }); |
-ListFactory_E = ListFactory; |
-ListFactory_Expression = ListFactory; |
-ListFactory_K = ListFactory; |
-ListFactory_dart_core_String = ListFactory; |
-ListFactory_V = ListFactory; |
-ListFactory_VariableValue = ListFactory; |
-ListFactory_int = ListFactory; |
// ********** Code for ListIterator ************** |
function ListIterator(array) { |
this._array = array; |
@@ -754,12 +451,10 @@ ListIterator.prototype.hasNext = function() { |
} |
ListIterator.prototype.next = function() { |
if (!this.hasNext()) { |
- $throw(const$0005); |
+ $throw(const$0001); |
} |
- return this._array[this._pos++]; |
+ return this._array.$index(this._pos++); |
} |
-ListIterator.prototype.hasNext$0 = ListIterator.prototype.hasNext; |
-ListIterator.prototype.next$0 = ListIterator.prototype.next; |
// ********** Code for ImmutableList ************** |
/** Implements extends for Dart classes on JavaScript prototypes. */ |
function $inherits(child, parent) { |
@@ -772,7 +467,7 @@ function $inherits(child, parent) { |
child.prototype.constructor = child; |
} |
} |
-$inherits(ImmutableList, ListFactory_E); |
+$inherits(ImmutableList, ListFactory); |
function ImmutableList(length) { |
Array.call(this, length); |
} |
@@ -783,39 +478,32 @@ ImmutableList.prototype.get$length = function() { |
return this.length; |
} |
ImmutableList.prototype.set$length = function(length) { |
- $throw(const$0007); |
+ $throw(const$0006); |
} |
ImmutableList.prototype.$setindex = function(index, value) { |
- $throw(const$0007); |
+ $throw(const$0006); |
} |
ImmutableList.prototype.sort = function(compare) { |
- $throw(const$0007); |
+ $throw(const$0006); |
} |
ImmutableList.prototype.add = function(element) { |
- $throw(const$0007); |
+ $throw(const$0006); |
} |
ImmutableList.prototype.addLast = function(element) { |
- $throw(const$0007); |
+ $throw(const$0006); |
} |
ImmutableList.prototype.addAll = function(elements) { |
- $throw(const$0007); |
+ $throw(const$0006); |
} |
ImmutableList.prototype.clear = function() { |
- $throw(const$0007); |
+ $throw(const$0006); |
} |
ImmutableList.prototype.removeLast = function() { |
- $throw(const$0007); |
+ $throw(const$0006); |
} |
ImmutableList.prototype.toString = function() { |
return ListFactory.ListFactory$from$factory(this).toString$0(); |
} |
-ImmutableList.prototype.add$1 = ImmutableList.prototype.add; |
-ImmutableList.prototype.addAll$1 = ImmutableList.prototype.addAll; |
-ImmutableList.prototype.addLast$1 = ImmutableList.prototype.addLast; |
-ImmutableList.prototype.removeLast$0 = ImmutableList.prototype.removeLast; |
-ImmutableList.prototype.sort$1 = function($0) { |
- return this.sort(to$call$2($0)); |
-}; |
ImmutableList.prototype.toString$0 = ImmutableList.prototype.toString; |
// ********** Code for NumImplementation ************** |
NumImplementation = Number; |
@@ -865,9 +553,6 @@ NumImplementation.prototype.compareTo = function(other) { |
return (-1); |
} |
} |
-NumImplementation.prototype.compareTo$1 = NumImplementation.prototype.compareTo; |
-NumImplementation.prototype.hashCode$0 = NumImplementation.prototype.hashCode; |
-NumImplementation.prototype.toRadixString$1 = NumImplementation.prototype.toRadixString; |
// ********** Code for HashMapImplementation ************** |
function HashMapImplementation() { |
this._numberOfEntries = (0); |
@@ -877,7 +562,7 @@ function HashMapImplementation() { |
this._values = new Array((8)); |
} |
HashMapImplementation.HashMapImplementation$from$factory = function(other) { |
- var result = new HashMapImplementation_K$V(); |
+ var result = new HashMapImplementation(); |
other.forEach((function (key, value) { |
result.$setindex(key, value); |
}) |
@@ -894,12 +579,12 @@ HashMapImplementation._nextProbe = function(currentProbe, numberOfProbes, length |
return (currentProbe + numberOfProbes) & (length - (1)); |
} |
HashMapImplementation.prototype._probeForAdding = function(key) { |
- var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$length()); |
+ var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.get$length()); |
var numberOfProbes = (1); |
var initialHash = hash; |
var insertionIndex = (-1); |
while (true) { |
- var existingKey = this._keys[hash]; |
+ var existingKey = this._keys.$index(hash); |
if (existingKey == null) { |
if (insertionIndex < (0)) return hash; |
return insertionIndex; |
@@ -907,18 +592,18 @@ HashMapImplementation.prototype._probeForAdding = function(key) { |
else if ($eq(existingKey, key)) { |
return hash; |
} |
- else if ((insertionIndex < (0)) && (const$0001 == existingKey)) { |
+ else if ((insertionIndex < (0)) && (const$0000 == existingKey)) { |
insertionIndex = hash; |
} |
hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length()); |
} |
} |
HashMapImplementation.prototype._probeForLookup = function(key) { |
- var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$length()); |
+ var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.get$length()); |
var numberOfProbes = (1); |
var initialHash = hash; |
while (true) { |
- var existingKey = this._keys[hash]; |
+ var existingKey = this._keys.$index(hash); |
if (existingKey == null) return (-1); |
if ($eq(existingKey, key)) return hash; |
hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length()); |
@@ -949,11 +634,11 @@ HashMapImplementation.prototype._grow = function(newCapacity) { |
this._values = new Array(newCapacity); |
for (var i = (0); |
i < capacity; i++) { |
- var key = oldKeys[i]; |
- if (key == null || key == const$0001) { |
+ var key = oldKeys.$index(i); |
+ if (key == null || key == const$0000) { |
continue; |
} |
- var value = oldValues[i]; |
+ var value = oldValues.$index(i); |
var newIndex = this._probeForAdding(key); |
this._keys.$setindex(newIndex, key); |
this._values.$setindex(newIndex, value); |
@@ -963,7 +648,7 @@ HashMapImplementation.prototype._grow = function(newCapacity) { |
HashMapImplementation.prototype.$setindex = function(key, value) { |
this._ensureCapacity(); |
var index = this._probeForAdding(key); |
- if ((this._keys[index] == null) || (this._keys[index] == const$0001)) { |
+ if ((this._keys.$index(index) == null) || (this._keys.$index(index) == const$0000)) { |
this._numberOfEntries++; |
} |
this._keys.$setindex(index, key); |
@@ -972,15 +657,27 @@ HashMapImplementation.prototype.$setindex = function(key, value) { |
HashMapImplementation.prototype.$index = function(key) { |
var index = this._probeForLookup(key); |
if (index < (0)) return null; |
- return this._values[index]; |
+ return this._values.$index(index); |
} |
HashMapImplementation.prototype.putIfAbsent = function(key, ifAbsent) { |
var index = this._probeForLookup(key); |
- if (index >= (0)) return this._values[index]; |
- var value = ifAbsent.call$0(); |
+ 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)) { |
+ this._numberOfEntries--; |
+ var value = this._values.$index(index); |
+ this._values.$setindex(index); |
+ this._keys.$setindex(index, const$0000); |
+ this._numberOfDeleted++; |
+ return value; |
+ } |
+ return null; |
+} |
HashMapImplementation.prototype.isEmpty = function() { |
return this._numberOfEntries == (0); |
} |
@@ -991,9 +688,9 @@ HashMapImplementation.prototype.forEach = function(f) { |
var length = this._keys.get$length(); |
for (var i = (0); |
i < length; i++) { |
- var key = this._keys[i]; |
- if ((key != null) && (key != const$0001)) { |
- f.call$2(key, this._values[i]); |
+ var key = this._keys.$index(i); |
+ if ((key != null) && (key != const$0000)) { |
+ f(key, this._values.$index(i)); |
} |
} |
} |
@@ -1018,429 +715,111 @@ HashMapImplementation.prototype.getValues = function() { |
HashMapImplementation.prototype.containsKey = function(key) { |
return (this._probeForLookup(key) != (-1)); |
} |
-HashMapImplementation.prototype.containsKey$1 = HashMapImplementation.prototype.containsKey; |
-HashMapImplementation.prototype.forEach$1 = function($0) { |
- return this.forEach(to$call$2($0)); |
-}; |
-HashMapImplementation.prototype.getKeys$0 = HashMapImplementation.prototype.getKeys; |
-HashMapImplementation.prototype.getValues$0 = HashMapImplementation.prototype.getValues; |
-HashMapImplementation.prototype.isEmpty$0 = HashMapImplementation.prototype.isEmpty; |
-// ********** Code for HashMapImplementation_E$E ************** |
-$inherits(HashMapImplementation_E$E, HashMapImplementation); |
-function HashMapImplementation_E$E() { |
+HashMapImplementation.prototype.remove$1 = HashMapImplementation.prototype.remove; |
+// ********** Code for HashMapImplementation_Dynamic$DoubleLinkedQueueEntry_KeyValuePair ************** |
+$inherits(HashMapImplementation_Dynamic$DoubleLinkedQueueEntry_KeyValuePair, HashMapImplementation); |
+function HashMapImplementation_Dynamic$DoubleLinkedQueueEntry_KeyValuePair() { |
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)); |
-} |
-HashMapImplementation_E$E._firstProbe = function(hashCode, length) { |
- return hashCode & (length - (1)); |
+HashMapImplementation_Dynamic$DoubleLinkedQueueEntry_KeyValuePair.prototype.remove$1 = HashMapImplementation_Dynamic$DoubleLinkedQueueEntry_KeyValuePair.prototype.remove; |
+// ********** Code for HashMapImplementation_Library$Library ************** |
+$inherits(HashMapImplementation_Library$Library, HashMapImplementation); |
+function HashMapImplementation_Library$Library() { |
+ this._numberOfEntries = (0); |
+ this._numberOfDeleted = (0); |
+ this._loadLimit = HashMapImplementation._computeLoadLimit((8)); |
+ this._keys = new Array((8)); |
+ this._values = new Array((8)); |
} |
-HashMapImplementation_E$E._nextProbe = function(currentProbe, numberOfProbes, length) { |
- return (currentProbe + numberOfProbes) & (length - (1)); |
+// ********** Code for HashMapImplementation_Member$Member ************** |
+$inherits(HashMapImplementation_Member$Member, HashMapImplementation); |
+function HashMapImplementation_Member$Member() { |
+ this._numberOfEntries = (0); |
+ this._numberOfDeleted = (0); |
+ this._loadLimit = HashMapImplementation._computeLoadLimit((8)); |
+ this._keys = new Array((8)); |
+ this._values = new Array((8)); |
} |
-HashMapImplementation_E$E.prototype._probeForAdding = function(key) { |
- var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$length()); |
- var numberOfProbes = (1); |
- var initialHash = hash; |
- var insertionIndex = (-1); |
- while (true) { |
- var existingKey = this._keys[hash]; |
- if (existingKey == null) { |
- if (insertionIndex < (0)) return hash; |
- return insertionIndex; |
- } |
- else if ($eq(existingKey, key)) { |
- return hash; |
- } |
- else if ((insertionIndex < (0)) && (const$0001 == existingKey)) { |
- insertionIndex = hash; |
- } |
- hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length()); |
- } |
+// ********** Code for HashMapImplementation_dart_core_String$dart_core_String ************** |
+$inherits(HashMapImplementation_dart_core_String$dart_core_String, HashMapImplementation); |
+function HashMapImplementation_dart_core_String$dart_core_String() { |
+ this._numberOfEntries = (0); |
+ this._numberOfDeleted = (0); |
+ this._loadLimit = HashMapImplementation._computeLoadLimit((8)); |
+ this._keys = new Array((8)); |
+ this._values = new Array((8)); |
} |
-HashMapImplementation_E$E.prototype._probeForLookup = function(key) { |
- var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$length()); |
- var numberOfProbes = (1); |
- var initialHash = hash; |
- while (true) { |
- var existingKey = this._keys[hash]; |
- if (existingKey == null) return (-1); |
- if ($eq(existingKey, key)) return hash; |
- hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length()); |
- } |
+HashMapImplementation_dart_core_String$dart_core_String.prototype.remove$1 = HashMapImplementation_dart_core_String$dart_core_String.prototype.remove; |
+// ********** Code for HashMapImplementation_dart_core_String$VariableValue ************** |
+$inherits(HashMapImplementation_dart_core_String$VariableValue, HashMapImplementation); |
+function HashMapImplementation_dart_core_String$VariableValue() { |
+ this._numberOfEntries = (0); |
+ this._numberOfDeleted = (0); |
+ this._loadLimit = HashMapImplementation._computeLoadLimit((8)); |
+ this._keys = new Array((8)); |
+ this._values = new Array((8)); |
} |
-HashMapImplementation_E$E.prototype._ensureCapacity = function() { |
- var newNumberOfEntries = this._numberOfEntries + (1); |
- if (newNumberOfEntries >= this._loadLimit) { |
- this._grow(this._keys.get$length() * (2)); |
- return; |
- } |
- var capacity = this._keys.get$length(); |
- var numberOfFreeOrDeleted = capacity - newNumberOfEntries; |
- var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; |
- if (this._numberOfDeleted > numberOfFree) { |
- this._grow(this._keys.get$length()); |
- } |
+HashMapImplementation_dart_core_String$VariableValue.prototype.remove$1 = HashMapImplementation_dart_core_String$VariableValue.prototype.remove; |
+// ********** Code for HashMapImplementation_Type$Type ************** |
+$inherits(HashMapImplementation_Type$Type, HashMapImplementation); |
+function HashMapImplementation_Type$Type() { |
+ this._numberOfEntries = (0); |
+ this._numberOfDeleted = (0); |
+ this._loadLimit = HashMapImplementation._computeLoadLimit((8)); |
+ this._keys = new Array((8)); |
+ this._values = new Array((8)); |
} |
-HashMapImplementation_E$E._isPowerOfTwo = function(x) { |
- return ((x & (x - (1))) == (0)); |
+// ********** Code for HashSetImplementation ************** |
+function HashSetImplementation() { |
+ this._backingMap = new HashMapImplementation(); |
} |
-HashMapImplementation_E$E.prototype._grow = function(newCapacity) { |
- var capacity = this._keys.get$length(); |
- this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); |
- var oldKeys = this._keys; |
- var oldValues = this._values; |
- this._keys = new Array(newCapacity); |
- this._values = new Array(newCapacity); |
- for (var i = (0); |
- i < capacity; i++) { |
- var key = oldKeys[i]; |
- if (key == null || key == const$0001) { |
- continue; |
- } |
- var value = oldValues[i]; |
- var newIndex = this._probeForAdding(key); |
- this._keys.$setindex(newIndex, key); |
- this._values.$setindex(newIndex, value); |
+HashSetImplementation.HashSetImplementation$from$factory = function(other) { |
+ var set = new HashSetImplementation(); |
+ for (var $$i = other.iterator(); $$i.hasNext(); ) { |
+ var e = $$i.next(); |
+ set.add(e); |
} |
- this._numberOfDeleted = (0); |
+ return set; |
} |
-HashMapImplementation_E$E.prototype.$setindex = function(key, value) { |
- this._ensureCapacity(); |
- var index = this._probeForAdding(key); |
- if ((this._keys[index] == null) || (this._keys[index] == const$0001)) { |
- this._numberOfEntries++; |
- } |
- this._keys.$setindex(index, key); |
- this._values.$setindex(index, value); |
+HashSetImplementation.prototype.add = function(value) { |
+ this._backingMap.$setindex(value, value); |
} |
-HashMapImplementation_E$E.prototype.isEmpty = function() { |
- return this._numberOfEntries == (0); |
+HashSetImplementation.prototype.contains = function(value) { |
+ return this._backingMap.containsKey(value); |
} |
-HashMapImplementation_E$E.prototype.forEach = function(f) { |
- var length = this._keys.get$length(); |
- for (var i = (0); |
- i < length; i++) { |
- var key = this._keys[i]; |
- if ((key != null) && (key != const$0001)) { |
- f.call$2(key, this._values[i]); |
- } |
+HashSetImplementation.prototype.remove = function(value) { |
+ if (!this._backingMap.containsKey(value)) return false; |
+ this._backingMap.remove(value); |
+ return true; |
+} |
+HashSetImplementation.prototype.addAll = function(collection) { |
+ var $this = this; // closure support |
+ collection.forEach(function _(value) { |
+ $this.add(value); |
} |
+ ); |
} |
-HashMapImplementation_E$E.prototype.getKeys = function() { |
- var list = new Array(this.get$length()); |
- var i = (0); |
- this.forEach(function _(key, value) { |
- list.$setindex(i++, key); |
+HashSetImplementation.prototype.forEach = function(f) { |
+ this._backingMap.forEach(function _(key, value) { |
+ f(key); |
} |
); |
- return list; |
} |
-HashMapImplementation_E$E.prototype.containsKey = function(key) { |
- return (this._probeForLookup(key) != (-1)); |
+HashSetImplementation.prototype.filter = function(f) { |
+ var result = new HashSetImplementation(); |
+ this._backingMap.forEach(function _(key, value) { |
+ if (f(key)) result.add(key); |
+ } |
+ ); |
+ return result; |
} |
-// ********** Code for HashMapImplementation_K$DoubleLinkedQueueEntry_KeyValuePair_K$V ************** |
-$inherits(HashMapImplementation_K$DoubleLinkedQueueEntry_KeyValuePair_K$V, HashMapImplementation); |
-function HashMapImplementation_K$DoubleLinkedQueueEntry_KeyValuePair_K$V() {} |
-// ********** Code for HashMapImplementation_K$V ************** |
-$inherits(HashMapImplementation_K$V, HashMapImplementation); |
-function HashMapImplementation_K$V() { |
- 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)); |
-} |
-HashMapImplementation_K$V._firstProbe = function(hashCode, length) { |
- return hashCode & (length - (1)); |
-} |
-HashMapImplementation_K$V._nextProbe = function(currentProbe, numberOfProbes, length) { |
- return (currentProbe + numberOfProbes) & (length - (1)); |
-} |
-HashMapImplementation_K$V.prototype._probeForAdding = function(key) { |
- var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$length()); |
- var numberOfProbes = (1); |
- var initialHash = hash; |
- var insertionIndex = (-1); |
- while (true) { |
- var existingKey = this._keys[hash]; |
- if (existingKey == null) { |
- if (insertionIndex < (0)) return hash; |
- return insertionIndex; |
- } |
- else if ($eq(existingKey, key)) { |
- return hash; |
- } |
- else if ((insertionIndex < (0)) && (const$0001 == existingKey)) { |
- insertionIndex = hash; |
- } |
- hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length()); |
- } |
-} |
-HashMapImplementation_K$V.prototype._probeForLookup = function(key) { |
- var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$length()); |
- var numberOfProbes = (1); |
- var initialHash = hash; |
- while (true) { |
- var existingKey = this._keys[hash]; |
- if (existingKey == null) return (-1); |
- if ($eq(existingKey, key)) return hash; |
- hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length()); |
- } |
-} |
-HashMapImplementation_K$V.prototype._ensureCapacity = function() { |
- var newNumberOfEntries = this._numberOfEntries + (1); |
- if (newNumberOfEntries >= this._loadLimit) { |
- this._grow(this._keys.get$length() * (2)); |
- return; |
- } |
- var capacity = this._keys.get$length(); |
- var numberOfFreeOrDeleted = capacity - newNumberOfEntries; |
- var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; |
- if (this._numberOfDeleted > numberOfFree) { |
- this._grow(this._keys.get$length()); |
- } |
-} |
-HashMapImplementation_K$V._isPowerOfTwo = function(x) { |
- return ((x & (x - (1))) == (0)); |
-} |
-HashMapImplementation_K$V.prototype._grow = function(newCapacity) { |
- var capacity = this._keys.get$length(); |
- this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); |
- var oldKeys = this._keys; |
- var oldValues = this._values; |
- this._keys = new Array(newCapacity); |
- this._values = new Array(newCapacity); |
- for (var i = (0); |
- i < capacity; i++) { |
- var key = oldKeys[i]; |
- if (key == null || key == const$0001) { |
- continue; |
- } |
- var value = oldValues[i]; |
- var newIndex = this._probeForAdding(key); |
- this._keys.$setindex(newIndex, key); |
- this._values.$setindex(newIndex, value); |
- } |
- this._numberOfDeleted = (0); |
-} |
-HashMapImplementation_K$V.prototype.$setindex = function(key, value) { |
- this._ensureCapacity(); |
- var index = this._probeForAdding(key); |
- if ((this._keys[index] == null) || (this._keys[index] == const$0001)) { |
- this._numberOfEntries++; |
- } |
- this._keys.$setindex(index, key); |
- this._values.$setindex(index, value); |
-} |
-HashMapImplementation_K$V.prototype.$index = function(key) { |
- var index = this._probeForLookup(key); |
- if (index < (0)) return null; |
- return this._values[index]; |
-} |
-HashMapImplementation_K$V.prototype.putIfAbsent = function(key, ifAbsent) { |
- var index = this._probeForLookup(key); |
- if (index >= (0)) return this._values[index]; |
- var value = ifAbsent.call$0(); |
- this.$setindex(key, value); |
- return value; |
-} |
-HashMapImplementation_K$V.prototype.isEmpty = function() { |
- return this._numberOfEntries == (0); |
-} |
-HashMapImplementation_K$V.prototype.forEach = function(f) { |
- var length = this._keys.get$length(); |
- for (var i = (0); |
- i < length; i++) { |
- var key = this._keys[i]; |
- if ((key != null) && (key != const$0001)) { |
- f.call$2(key, this._values[i]); |
- } |
- } |
-} |
-HashMapImplementation_K$V.prototype.getKeys = function() { |
- var list = new Array(this.get$length()); |
- var i = (0); |
- this.forEach(function _(key, value) { |
- list.$setindex(i++, key); |
- } |
- ); |
- return list; |
-} |
-HashMapImplementation_K$V.prototype.getValues = function() { |
- var list = new Array(this.get$length()); |
- var i = (0); |
- this.forEach(function _(key, value) { |
- list.$setindex(i++, value); |
- } |
- ); |
- return list; |
-} |
-HashMapImplementation_K$V.prototype.containsKey = function(key) { |
- return (this._probeForLookup(key) != (-1)); |
-} |
-// ********** Code for HashMapImplementation_dart_core_String$VariableValue ************** |
-$inherits(HashMapImplementation_dart_core_String$VariableValue, HashMapImplementation); |
-function HashMapImplementation_dart_core_String$VariableValue() { |
- this._numberOfEntries = (0); |
- this._numberOfDeleted = (0); |
- this._loadLimit = HashMapImplementation._computeLoadLimit((8)); |
- this._keys = new Array((8)); |
- this._values = new Array((8)); |
-} |
-HashMapImplementation_dart_core_String$VariableValue._computeLoadLimit = function(capacity) { |
- return $truncdiv((capacity * (3)), (4)); |
-} |
-HashMapImplementation_dart_core_String$VariableValue._firstProbe = function(hashCode, length) { |
- return hashCode & (length - (1)); |
-} |
-HashMapImplementation_dart_core_String$VariableValue._nextProbe = function(currentProbe, numberOfProbes, length) { |
- return (currentProbe + numberOfProbes) & (length - (1)); |
-} |
-HashMapImplementation_dart_core_String$VariableValue.prototype._probeForAdding = function(key) { |
- var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.get$length()); |
- var numberOfProbes = (1); |
- var initialHash = hash; |
- var insertionIndex = (-1); |
- while (true) { |
- var existingKey = this._keys[hash]; |
- if (existingKey == null) { |
- if (insertionIndex < (0)) return hash; |
- return insertionIndex; |
- } |
- else if ($eq(existingKey, key)) { |
- return hash; |
- } |
- else if ((insertionIndex < (0)) && (const$0001 == existingKey)) { |
- insertionIndex = hash; |
- } |
- hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length()); |
- } |
-} |
-HashMapImplementation_dart_core_String$VariableValue.prototype._probeForLookup = function(key) { |
- var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.get$length()); |
- var numberOfProbes = (1); |
- var initialHash = hash; |
- while (true) { |
- var existingKey = this._keys[hash]; |
- if (existingKey == null) return (-1); |
- if ($eq(existingKey, key)) return hash; |
- hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length()); |
- } |
-} |
-HashMapImplementation_dart_core_String$VariableValue.prototype._ensureCapacity = function() { |
- var newNumberOfEntries = this._numberOfEntries + (1); |
- if (newNumberOfEntries >= this._loadLimit) { |
- this._grow(this._keys.get$length() * (2)); |
- return; |
- } |
- var capacity = this._keys.get$length(); |
- var numberOfFreeOrDeleted = capacity - newNumberOfEntries; |
- var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; |
- if (this._numberOfDeleted > numberOfFree) { |
- this._grow(this._keys.get$length()); |
- } |
-} |
-HashMapImplementation_dart_core_String$VariableValue._isPowerOfTwo = function(x) { |
- return ((x & (x - (1))) == (0)); |
-} |
-HashMapImplementation_dart_core_String$VariableValue.prototype._grow = function(newCapacity) { |
- var capacity = this._keys.get$length(); |
- this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); |
- var oldKeys = this._keys; |
- var oldValues = this._values; |
- this._keys = new Array(newCapacity); |
- this._values = new Array(newCapacity); |
- for (var i = (0); |
- i < capacity; i++) { |
- var key = oldKeys[i]; |
- if (key == null || key == const$0001) { |
- continue; |
- } |
- var value = oldValues[i]; |
- var newIndex = this._probeForAdding(key); |
- this._keys.$setindex(newIndex, key); |
- this._values.$setindex(newIndex, value); |
- } |
- this._numberOfDeleted = (0); |
-} |
-HashMapImplementation_dart_core_String$VariableValue.prototype.$setindex = function(key, value) { |
- this._ensureCapacity(); |
- var index = this._probeForAdding(key); |
- if ((this._keys[index] == null) || (this._keys[index] == const$0001)) { |
- this._numberOfEntries++; |
- } |
- this._keys.$setindex(index, key); |
- this._values.$setindex(index, value); |
-} |
-HashMapImplementation_dart_core_String$VariableValue.prototype.$index = function(key) { |
- var index = this._probeForLookup(key); |
- if (index < (0)) return null; |
- return this._values[index]; |
-} |
-HashMapImplementation_dart_core_String$VariableValue.prototype.forEach = function(f) { |
- var length = this._keys.get$length(); |
- for (var i = (0); |
- i < length; i++) { |
- var key = this._keys[i]; |
- if ((key != null) && (key != const$0001)) { |
- f.call$2(key, this._values[i]); |
- } |
- } |
-} |
-HashMapImplementation_dart_core_String$VariableValue.prototype.containsKey = function(key) { |
- return (this._probeForLookup(key) != (-1)); |
-} |
-// ********** Code for HashSetImplementation ************** |
-function HashSetImplementation() { |
- this._backingMap = new HashMapImplementation_E$E(); |
-} |
-HashSetImplementation.HashSetImplementation$from$factory = function(other) { |
- var set = new HashSetImplementation_E(); |
- for (var $$i = other.iterator$0(); $$i.hasNext$0(); ) { |
- var e = $$i.next$0(); |
- set.add(e); |
- } |
- return set; |
-} |
-HashSetImplementation.prototype.add = function(value) { |
- this._backingMap.$setindex(value, value); |
-} |
-HashSetImplementation.prototype.contains = function(value) { |
- return this._backingMap.containsKey(value); |
-} |
-HashSetImplementation.prototype.addAll = function(collection) { |
- var $this = this; // closure support |
- collection.forEach(function _(value) { |
- $this.add(value); |
- } |
- ); |
-} |
-HashSetImplementation.prototype.forEach = function(f) { |
- this._backingMap.forEach(function _(key, value) { |
- f.call$1(key); |
- } |
- ); |
-} |
-HashSetImplementation.prototype.filter = function(f) { |
- var result = new HashSetImplementation(); |
- this._backingMap.forEach(function _(key, value) { |
- if (f.call$1(key)) result.add(key); |
- } |
- ); |
- return result; |
-} |
-HashSetImplementation.prototype.every = function(f) { |
- var keys = this._backingMap.getKeys(); |
- return keys.every(f); |
+HashSetImplementation.prototype.every = function(f) { |
+ var keys = this._backingMap.getKeys(); |
+ return keys.every(f); |
} |
HashSetImplementation.prototype.some = function(f) { |
var keys = this._backingMap.getKeys(); |
@@ -1453,36 +832,33 @@ HashSetImplementation.prototype.get$length = function() { |
return this._backingMap.get$length(); |
} |
HashSetImplementation.prototype.iterator = function() { |
- return new HashSetIterator_E(this); |
+ return new HashSetIterator(this); |
} |
-HashSetImplementation.prototype.add$1 = HashSetImplementation.prototype.add; |
-HashSetImplementation.prototype.addAll$1 = HashSetImplementation.prototype.addAll; |
HashSetImplementation.prototype.contains$1 = HashSetImplementation.prototype.contains; |
-HashSetImplementation.prototype.filter$1 = function($0) { |
- return this.filter(to$call$1($0)); |
-}; |
-HashSetImplementation.prototype.forEach$1 = function($0) { |
- return this.forEach(to$call$1($0)); |
-}; |
-HashSetImplementation.prototype.isEmpty$0 = HashSetImplementation.prototype.isEmpty; |
-HashSetImplementation.prototype.iterator$0 = HashSetImplementation.prototype.iterator; |
-// ********** Code for HashSetImplementation_E ************** |
-$inherits(HashSetImplementation_E, HashSetImplementation); |
-function HashSetImplementation_E() { |
- this._backingMap = new HashMapImplementation_E$E(); |
-} |
+HashSetImplementation.prototype.remove$1 = HashSetImplementation.prototype.remove; |
// ********** Code for HashSetImplementation_Library ************** |
$inherits(HashSetImplementation_Library, HashSetImplementation); |
-function HashSetImplementation_Library() {} |
+function HashSetImplementation_Library() { |
+ this._backingMap = new HashMapImplementation_Library$Library(); |
+} |
+HashSetImplementation_Library.prototype.contains$1 = HashSetImplementation_Library.prototype.contains; |
// ********** Code for HashSetImplementation_Member ************** |
$inherits(HashSetImplementation_Member, HashSetImplementation); |
-function HashSetImplementation_Member() {} |
+function HashSetImplementation_Member() { |
+ this._backingMap = new HashMapImplementation_Member$Member(); |
+} |
// ********** Code for HashSetImplementation_dart_core_String ************** |
$inherits(HashSetImplementation_dart_core_String, HashSetImplementation); |
-function HashSetImplementation_dart_core_String() {} |
+function HashSetImplementation_dart_core_String() { |
+ this._backingMap = new HashMapImplementation_dart_core_String$dart_core_String(); |
+} |
+HashSetImplementation_dart_core_String.prototype.contains$1 = HashSetImplementation_dart_core_String.prototype.contains; |
// ********** Code for HashSetImplementation_Type ************** |
$inherits(HashSetImplementation_Type, HashSetImplementation); |
-function HashSetImplementation_Type() {} |
+function HashSetImplementation_Type() { |
+ this._backingMap = new HashMapImplementation_Type$Type(); |
+} |
+HashSetImplementation_Type.prototype.contains$1 = HashSetImplementation_Type.prototype.contains; |
// ********** Code for HashSetIterator ************** |
function HashSetIterator(set_) { |
this._entries = set_._backingMap._keys; |
@@ -1491,45 +867,26 @@ function HashSetIterator(set_) { |
} |
HashSetIterator.prototype.hasNext = function() { |
if (this._nextValidIndex >= this._entries.get$length()) return false; |
- if (this._entries[this._nextValidIndex] == const$0001) { |
+ if (this._entries.$index(this._nextValidIndex) == const$0000) { |
this._advance(); |
} |
return this._nextValidIndex < this._entries.get$length(); |
} |
HashSetIterator.prototype.next = function() { |
if (!this.hasNext()) { |
- $throw(const$0005); |
+ $throw(const$0001); |
} |
- var res = this._entries[this._nextValidIndex]; |
+ var res = this._entries.$index(this._nextValidIndex); |
this._advance(); |
return res; |
} |
HashSetIterator.prototype._advance = function() { |
var length = this._entries.get$length(); |
var entry; |
- var deletedKey = const$0001; |
- do { |
- if (++this._nextValidIndex >= length) break; |
- entry = this._entries[this._nextValidIndex]; |
- } |
- 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._entries = set_._backingMap._keys; |
- this._advance(); |
-} |
-HashSetIterator_E.prototype._advance = function() { |
- var length = this._entries.get$length(); |
- var entry; |
- var deletedKey = const$0001; |
+ var deletedKey = const$0000; |
do { |
if (++this._nextValidIndex >= length) break; |
- entry = this._entries[this._nextValidIndex]; |
+ entry = this._entries.$index(this._nextValidIndex); |
} |
while ((entry == null) || (entry == deletedKey)) |
} |
@@ -1544,23 +901,17 @@ function KeyValuePair(key, value) { |
} |
KeyValuePair.prototype.get$value = function() { return this.value; }; |
KeyValuePair.prototype.set$value = function(value) { return this.value = value; }; |
-// ********** Code for KeyValuePair_K$V ************** |
-$inherits(KeyValuePair_K$V, KeyValuePair); |
-function KeyValuePair_K$V(key, value) { |
- this.key = key; |
- this.value = value; |
-} |
// ********** Code for LinkedHashMapImplementation ************** |
function LinkedHashMapImplementation() { |
- this._map = new HashMapImplementation(); |
- this._list = new DoubleLinkedQueue_KeyValuePair_K$V(); |
+ this._map = new HashMapImplementation_Dynamic$DoubleLinkedQueueEntry_KeyValuePair(); |
+ this._list = new DoubleLinkedQueue_KeyValuePair(); |
} |
LinkedHashMapImplementation.prototype.$setindex = function(key, value) { |
if (this._map.containsKey(key)) { |
this._map.$index(key).get$element().set$value(value); |
} |
else { |
- this._list.addLast(new KeyValuePair_K$V(key, value)); |
+ this._list.addLast(new KeyValuePair(key, value)); |
this._map.$setindex(key, this._list.lastEntry()); |
} |
} |
@@ -1569,10 +920,16 @@ LinkedHashMapImplementation.prototype.$index = function(key) { |
if (entry == null) return null; |
return entry.get$element().get$value(); |
} |
+LinkedHashMapImplementation.prototype.remove = function(key) { |
+ var entry = this._map.remove(key); |
+ if (entry == null) return null; |
+ entry.remove(); |
+ return entry.get$element().get$value(); |
+} |
LinkedHashMapImplementation.prototype.putIfAbsent = function(key, ifAbsent) { |
var value = this.$index(key); |
if ((this.$index(key) == null) && !(this.containsKey(key))) { |
- value = ifAbsent.call$0(); |
+ value = ifAbsent(); |
this.$setindex(key, value); |
} |
return value; |
@@ -1597,7 +954,7 @@ LinkedHashMapImplementation.prototype.getValues = function() { |
} |
LinkedHashMapImplementation.prototype.forEach = function(f) { |
this._list.forEach(function _(entry) { |
- f.call$2(entry.key, entry.value); |
+ f(entry.key, entry.value); |
} |
); |
} |
@@ -1610,13 +967,7 @@ LinkedHashMapImplementation.prototype.get$length = function() { |
LinkedHashMapImplementation.prototype.isEmpty = function() { |
return this.get$length() == (0); |
} |
-LinkedHashMapImplementation.prototype.containsKey$1 = LinkedHashMapImplementation.prototype.containsKey; |
-LinkedHashMapImplementation.prototype.forEach$1 = function($0) { |
- return this.forEach(to$call$2($0)); |
-}; |
-LinkedHashMapImplementation.prototype.getKeys$0 = LinkedHashMapImplementation.prototype.getKeys; |
-LinkedHashMapImplementation.prototype.getValues$0 = LinkedHashMapImplementation.prototype.getValues; |
-LinkedHashMapImplementation.prototype.isEmpty$0 = LinkedHashMapImplementation.prototype.isEmpty; |
+LinkedHashMapImplementation.prototype.remove$1 = LinkedHashMapImplementation.prototype.remove; |
// ********** Code for DoubleLinkedQueueEntry ************** |
function DoubleLinkedQueueEntry(e) { |
this._element = e; |
@@ -1628,7 +979,7 @@ DoubleLinkedQueueEntry.prototype._link = function(p, n) { |
n._previous = this; |
} |
DoubleLinkedQueueEntry.prototype.prepend = function(e) { |
- new DoubleLinkedQueueEntry_E(e)._link(this._previous, this); |
+ new DoubleLinkedQueueEntry(e)._link(this._previous, this); |
} |
DoubleLinkedQueueEntry.prototype.remove = function() { |
this._previous._next = this._next; |
@@ -1646,90 +997,40 @@ DoubleLinkedQueueEntry.prototype.previousEntry = function() { |
DoubleLinkedQueueEntry.prototype.get$element = function() { |
return this._element; |
} |
-DoubleLinkedQueueEntry.prototype._asNonSentinelEntry$0 = DoubleLinkedQueueEntry.prototype._asNonSentinelEntry; |
-// ********** Code for DoubleLinkedQueueEntry_E ************** |
-$inherits(DoubleLinkedQueueEntry_E, DoubleLinkedQueueEntry); |
-function DoubleLinkedQueueEntry_E(e) { |
+// ********** Code for DoubleLinkedQueueEntry_KeyValuePair ************** |
+$inherits(DoubleLinkedQueueEntry_KeyValuePair, DoubleLinkedQueueEntry); |
+function DoubleLinkedQueueEntry_KeyValuePair(e) { |
this._element = e; |
} |
-DoubleLinkedQueueEntry_E.prototype._link = function(p, n) { |
- this._next = n; |
- this._previous = p; |
- p._next = this; |
- n._previous = this; |
-} |
-DoubleLinkedQueueEntry_E.prototype.prepend = function(e) { |
- new DoubleLinkedQueueEntry_E(e)._link(this._previous, this); |
-} |
-DoubleLinkedQueueEntry_E.prototype.remove = function() { |
- this._previous._next = this._next; |
- this._next._previous = this._previous; |
- this._next = null; |
- this._previous = null; |
- return this._element; |
-} |
-DoubleLinkedQueueEntry_E.prototype._asNonSentinelEntry = function() { |
- return this; |
-} |
-DoubleLinkedQueueEntry_E.prototype.previousEntry = function() { |
- return this._previous._asNonSentinelEntry(); |
-} |
-// ********** Code for DoubleLinkedQueueEntry_KeyValuePair_K$V ************** |
-$inherits(DoubleLinkedQueueEntry_KeyValuePair_K$V, DoubleLinkedQueueEntry); |
-function DoubleLinkedQueueEntry_KeyValuePair_K$V(e) { |
- this._element = e; |
-} |
-DoubleLinkedQueueEntry_KeyValuePair_K$V.prototype._link = function(p, n) { |
- this._next = n; |
- this._previous = p; |
- p._next = this; |
- n._previous = this; |
-} |
-DoubleLinkedQueueEntry_KeyValuePair_K$V.prototype.prepend = function(e) { |
- new DoubleLinkedQueueEntry_KeyValuePair_K$V(e)._link(this._previous, this); |
-} |
-DoubleLinkedQueueEntry_KeyValuePair_K$V.prototype._asNonSentinelEntry = function() { |
- return this; |
-} |
-DoubleLinkedQueueEntry_KeyValuePair_K$V.prototype.previousEntry = function() { |
- return this._previous._asNonSentinelEntry$0(); |
-} |
// ********** Code for _DoubleLinkedQueueEntrySentinel ************** |
-$inherits(_DoubleLinkedQueueEntrySentinel, DoubleLinkedQueueEntry_E); |
+$inherits(_DoubleLinkedQueueEntrySentinel, DoubleLinkedQueueEntry); |
function _DoubleLinkedQueueEntrySentinel() { |
- DoubleLinkedQueueEntry_E.call(this, null); |
+ DoubleLinkedQueueEntry.call(this, null); |
this._link(this, this); |
} |
_DoubleLinkedQueueEntrySentinel.prototype.remove = function() { |
- $throw(const$0000); |
+ $throw(const$0002); |
} |
_DoubleLinkedQueueEntrySentinel.prototype._asNonSentinelEntry = function() { |
return null; |
} |
_DoubleLinkedQueueEntrySentinel.prototype.get$element = function() { |
- $throw(const$0000); |
-} |
-_DoubleLinkedQueueEntrySentinel.prototype._asNonSentinelEntry$0 = _DoubleLinkedQueueEntrySentinel.prototype._asNonSentinelEntry; |
-// ********** Code for _DoubleLinkedQueueEntrySentinel_E ************** |
-$inherits(_DoubleLinkedQueueEntrySentinel_E, _DoubleLinkedQueueEntrySentinel); |
-function _DoubleLinkedQueueEntrySentinel_E() { |
- DoubleLinkedQueueEntry_E.call(this, null); |
- this._link(this, this); |
+ $throw(const$0002); |
} |
-// ********** Code for _DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V ************** |
-$inherits(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, _DoubleLinkedQueueEntrySentinel); |
-function _DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V() { |
- DoubleLinkedQueueEntry_KeyValuePair_K$V.call(this, null); |
+// ********** Code for _DoubleLinkedQueueEntrySentinel_KeyValuePair ************** |
+$inherits(_DoubleLinkedQueueEntrySentinel_KeyValuePair, _DoubleLinkedQueueEntrySentinel); |
+function _DoubleLinkedQueueEntrySentinel_KeyValuePair() { |
+ DoubleLinkedQueueEntry_KeyValuePair.call(this, null); |
this._link(this, this); |
} |
// ********** Code for DoubleLinkedQueue ************** |
function DoubleLinkedQueue() { |
- this._sentinel = new _DoubleLinkedQueueEntrySentinel_E(); |
+ this._sentinel = new _DoubleLinkedQueueEntrySentinel(); |
} |
DoubleLinkedQueue.DoubleLinkedQueue$from$factory = function(other) { |
var list = new DoubleLinkedQueue(); |
- for (var $$i = other.iterator$0(); $$i.hasNext$0(); ) { |
- var e = $$i.next$0(); |
+ for (var $$i = other.iterator(); $$i.hasNext(); ) { |
+ var e = $$i.next(); |
list.addLast(e); |
} |
return list; |
@@ -1741,8 +1042,8 @@ DoubleLinkedQueue.prototype.add = function(value) { |
this.addLast(value); |
} |
DoubleLinkedQueue.prototype.addAll = function(collection) { |
- for (var $$i = collection.iterator$0(); $$i.hasNext$0(); ) { |
- var e = $$i.next$0(); |
+ for (var $$i = collection.iterator(); $$i.hasNext(); ) { |
+ var e = $$i.next(); |
this.add(e); |
} |
} |
@@ -1773,7 +1074,7 @@ DoubleLinkedQueue.prototype.forEach = function(f) { |
var entry = this._sentinel._next; |
while (entry != this._sentinel) { |
var nextEntry = entry._next; |
- f.call$1(entry._element); |
+ f(entry._element); |
entry = nextEntry; |
} |
} |
@@ -1781,7 +1082,7 @@ DoubleLinkedQueue.prototype.every = function(f) { |
var entry = this._sentinel._next; |
while (entry != this._sentinel) { |
var nextEntry = entry._next; |
- if (!f.call$1(entry._element)) return false; |
+ if (!f(entry._element)) return false; |
entry = nextEntry; |
} |
return true; |
@@ -1790,7 +1091,7 @@ DoubleLinkedQueue.prototype.some = function(f) { |
var entry = this._sentinel._next; |
while (entry != this._sentinel) { |
var nextEntry = entry._next; |
- if (f.call$1(entry._element)) return true; |
+ if (f(entry._element)) return true; |
entry = nextEntry; |
} |
return false; |
@@ -1800,48 +1101,18 @@ DoubleLinkedQueue.prototype.filter = function(f) { |
var entry = this._sentinel._next; |
while (entry != this._sentinel) { |
var nextEntry = entry._next; |
- if (f.call$1(entry._element)) other.addLast(entry._element); |
+ if (f(entry._element)) other.addLast(entry._element); |
entry = nextEntry; |
} |
return other; |
} |
DoubleLinkedQueue.prototype.iterator = function() { |
- return new _DoubleLinkedQueueIterator_E(this._sentinel); |
+ return new _DoubleLinkedQueueIterator(this._sentinel); |
} |
-DoubleLinkedQueue.prototype.add$1 = DoubleLinkedQueue.prototype.add; |
-DoubleLinkedQueue.prototype.addAll$1 = DoubleLinkedQueue.prototype.addAll; |
-DoubleLinkedQueue.prototype.addLast$1 = DoubleLinkedQueue.prototype.addLast; |
-DoubleLinkedQueue.prototype.filter$1 = function($0) { |
- return this.filter(to$call$1($0)); |
-}; |
-DoubleLinkedQueue.prototype.forEach$1 = function($0) { |
- return this.forEach(to$call$1($0)); |
-}; |
-DoubleLinkedQueue.prototype.isEmpty$0 = DoubleLinkedQueue.prototype.isEmpty; |
-DoubleLinkedQueue.prototype.iterator$0 = DoubleLinkedQueue.prototype.iterator; |
-DoubleLinkedQueue.prototype.last$0 = DoubleLinkedQueue.prototype.last; |
-DoubleLinkedQueue.prototype.removeLast$0 = DoubleLinkedQueue.prototype.removeLast; |
-// ********** Code for DoubleLinkedQueue_E ************** |
-$inherits(DoubleLinkedQueue_E, DoubleLinkedQueue); |
-function DoubleLinkedQueue_E() {} |
-// ********** Code for DoubleLinkedQueue_KeyValuePair_K$V ************** |
-$inherits(DoubleLinkedQueue_KeyValuePair_K$V, DoubleLinkedQueue); |
-function DoubleLinkedQueue_KeyValuePair_K$V() { |
- this._sentinel = new _DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V(); |
-} |
-DoubleLinkedQueue_KeyValuePair_K$V.prototype.addLast = function(value) { |
- this._sentinel.prepend(value); |
-} |
-DoubleLinkedQueue_KeyValuePair_K$V.prototype.lastEntry = function() { |
- return this._sentinel.previousEntry(); |
-} |
-DoubleLinkedQueue_KeyValuePair_K$V.prototype.forEach = function(f) { |
- var entry = this._sentinel._next; |
- while (entry != this._sentinel) { |
- var nextEntry = entry._next; |
- f.call$1(entry._element); |
- entry = nextEntry; |
- } |
+// ********** Code for DoubleLinkedQueue_KeyValuePair ************** |
+$inherits(DoubleLinkedQueue_KeyValuePair, DoubleLinkedQueue); |
+function DoubleLinkedQueue_KeyValuePair() { |
+ this._sentinel = new _DoubleLinkedQueueEntrySentinel_KeyValuePair(); |
} |
// ********** Code for _DoubleLinkedQueueIterator ************** |
function _DoubleLinkedQueueIterator(_sentinel) { |
@@ -1853,19 +1124,11 @@ _DoubleLinkedQueueIterator.prototype.hasNext = function() { |
} |
_DoubleLinkedQueueIterator.prototype.next = function() { |
if (!this.hasNext()) { |
- $throw(const$0005); |
+ $throw(const$0001); |
} |
this._currentEntry = this._currentEntry._next; |
return this._currentEntry.get$element(); |
} |
-_DoubleLinkedQueueIterator.prototype.hasNext$0 = _DoubleLinkedQueueIterator.prototype.hasNext; |
-_DoubleLinkedQueueIterator.prototype.next$0 = _DoubleLinkedQueueIterator.prototype.next; |
-// ********** Code for _DoubleLinkedQueueIterator_E ************** |
-$inherits(_DoubleLinkedQueueIterator_E, _DoubleLinkedQueueIterator); |
-function _DoubleLinkedQueueIterator_E(_sentinel) { |
- this._sentinel = _sentinel; |
- this._currentEntry = this._sentinel; |
-} |
// ********** Code for StopwatchImplementation ************** |
function StopwatchImplementation() { |
this._start = null; |
@@ -1903,9 +1166,6 @@ StopwatchImplementation.prototype.elapsedInMs = function() { |
StopwatchImplementation.prototype.frequency = function() { |
return Clock.frequency(); |
} |
-StopwatchImplementation.prototype.elapsedInMs$0 = StopwatchImplementation.prototype.elapsedInMs; |
-StopwatchImplementation.prototype.start$0 = StopwatchImplementation.prototype.start; |
-StopwatchImplementation.prototype.stop$0 = StopwatchImplementation.prototype.stop; |
// ********** Code for StringBufferImpl ************** |
function StringBufferImpl(content) { |
this.clear(); |
@@ -1925,8 +1185,8 @@ StringBufferImpl.prototype.add = function(obj) { |
return this; |
} |
StringBufferImpl.prototype.addAll = function(objects) { |
- for (var $$i = objects.iterator$0(); $$i.hasNext$0(); ) { |
- var obj = $$i.next$0(); |
+ for (var $$i = objects.iterator(); $$i.hasNext(); ) { |
+ var obj = $$i.next(); |
this.add(obj); |
} |
return this; |
@@ -1944,9 +1204,6 @@ StringBufferImpl.prototype.toString = function() { |
this._buffer.add(result); |
return result; |
} |
-StringBufferImpl.prototype.add$1 = StringBufferImpl.prototype.add; |
-StringBufferImpl.prototype.addAll$1 = StringBufferImpl.prototype.addAll; |
-StringBufferImpl.prototype.isEmpty$0 = StringBufferImpl.prototype.isEmpty; |
StringBufferImpl.prototype.toString$0 = StringBufferImpl.prototype.toString; |
// ********** Code for StringBase ************** |
function StringBase() {} |
@@ -1961,7 +1218,7 @@ StringBase.join = function(strings, separator) { |
var s = strings[(0)]; |
for (var i = (1); |
i < strings.get$length(); i++) { |
- s = s + separator + strings[i]; |
+ s = $add($add(s, separator), strings[i]); |
} |
return s; |
} |
@@ -1987,21 +1244,9 @@ StringImplementation.prototype.isEmpty = function() { |
StringImplementation.prototype.contains = function(pattern, startIndex) { |
'use strict'; return this.indexOf(pattern, startIndex) >= 0; |
} |
-StringImplementation.prototype._replaceFirst = function(from, to) { |
- 'use strict';return this.replace(from, to); |
-} |
StringImplementation.prototype._replaceRegExp = function(from, to) { |
'use strict';return this.replace(from.re, to); |
} |
-StringImplementation.prototype.replaceFirst = function(from, to) { |
- if ((typeof(from) == 'string')) return this._replaceFirst(from, to); |
- if (!!(from && from.is$RegExp())) return this._replaceRegExp(from, to); |
- var $$list = from.allMatches(this); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var match = $$i.next$0(); |
- return this.substring((0), match.start$0()) + to + this.substring(match.end$0()); |
- } |
-} |
StringImplementation.prototype._replaceAll = function(from, to) { |
'use strict'; |
from = new RegExp(from.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'g'); |
@@ -2014,13 +1259,13 @@ StringImplementation.prototype.replaceAll = function(from, to) { |
var buffer = new StringBufferImpl(""); |
var lastMatchEnd = (0); |
var $$list = from.allMatches(this); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var match = $$i.next$0(); |
- buffer.add$1(this.substring(lastMatchEnd, match.start$0())); |
- buffer.add$1(to); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var match = $$i.next(); |
+ buffer.add(this.substring(lastMatchEnd, match.start())); |
+ buffer.add(to); |
lastMatchEnd = match.end$0(); |
} |
- buffer.add$1(this.substring(lastMatchEnd)); |
+ buffer.add(this.substring(lastMatchEnd)); |
} |
StringImplementation.prototype.hashCode = function() { |
'use strict'; |
@@ -2038,46 +1283,11 @@ StringImplementation.prototype.hashCode = function() { |
StringImplementation.prototype.compareTo = function(other) { |
'use strict'; return this == other ? 0 : this < other ? -1 : 1; |
} |
-StringImplementation.prototype.compareTo$1 = StringImplementation.prototype.compareTo; |
StringImplementation.prototype.contains$1 = StringImplementation.prototype.contains; |
-StringImplementation.prototype.endsWith$1 = StringImplementation.prototype.endsWith; |
-StringImplementation.prototype.hashCode$0 = StringImplementation.prototype.hashCode; |
StringImplementation.prototype.indexOf$1 = StringImplementation.prototype.indexOf; |
-StringImplementation.prototype.isEmpty$0 = StringImplementation.prototype.isEmpty; |
-StringImplementation.prototype.replaceFirst$2 = StringImplementation.prototype.replaceFirst; |
-StringImplementation.prototype.startsWith$1 = StringImplementation.prototype.startsWith; |
StringImplementation.prototype.substring$1 = StringImplementation.prototype.substring; |
-StringImplementation.prototype.substring$2 = StringImplementation.prototype.substring; |
-// ********** Code for Collections ************** |
-function Collections() {} |
-Collections.forEach = function(iterable, f) { |
- for (var $$i = iterable.iterator$0(); $$i.hasNext$0(); ) { |
- var e = $$i.next$0(); |
- f.call$1(e); |
- } |
-} |
-Collections.some = function(iterable, f) { |
- for (var $$i = iterable.iterator$0(); $$i.hasNext$0(); ) { |
- var e = $$i.next$0(); |
- if (f.call$1(e)) return true; |
- } |
- return false; |
-} |
-Collections.every = function(iterable, f) { |
- for (var $$i = iterable.iterator$0(); $$i.hasNext$0(); ) { |
- var e = $$i.next$0(); |
- if (!f.call$1(e)) return false; |
- } |
- return true; |
-} |
-Collections.filter = function(source, destination, f) { |
- for (var $$i = source.iterator$0(); $$i.hasNext$0(); ) { |
- var e = $$i.next$0(); |
- if (f.call$1(e)) destination.add(e); |
- } |
- return destination; |
-} |
// ********** Code for _Worker ************** |
+var _Worker = {}; |
// ********** Code for _ArgumentMismatchException ************** |
$inherits(_ArgumentMismatchException, ClosureArgumentMismatchException); |
function _ArgumentMismatchException(_message) { |
@@ -2163,7 +1373,7 @@ function _map(itemsAndKeys) { |
var ret = new LinkedHashMapImplementation(); |
for (var i = (0); |
i < itemsAndKeys.get$length(); ) { |
- ret.$setindex(itemsAndKeys[i++], itemsAndKeys[i++]); |
+ ret.$setindex(itemsAndKeys.$index(i++), itemsAndKeys.$index(i++)); |
} |
return ret; |
} |
@@ -2223,7 +1433,9 @@ EnvMap.prototype.$index = function(key) { |
return this._process.env[key]; |
} |
// ********** Code for ReadableStream ************** |
+var ReadableStream = {}; |
// ********** Code for WritableStream ************** |
+var WritableStream = {}; |
Object.defineProperty(Object.prototype, '$typeNameOf', { value: function() { |
if ((typeof(window) != 'undefined' && window.constructor.name == 'DOMWindow') |
|| typeof(process) != 'undefined') { // fast-path for Chrome and Node |
@@ -2259,125 +1471,847 @@ function $dynamic(name) { |
} |
} |
} |
- method = method || methods.Object; |
- var proto = Object.getPrototypeOf(obj); |
- if (!proto.hasOwnProperty(name)) { |
- Object.defineProperty(proto, name, |
- { value: method, enumerable: false, writable: true, |
- configurable: true }); |
+ method = method || methods.Object; |
+ var proto = Object.getPrototypeOf(obj); |
+ if (!proto.hasOwnProperty(name)) { |
+ Object.defineProperty(proto, name, |
+ { value: method, enumerable: false, writable: true, |
+ configurable: true }); |
+ } |
+ |
+ return method.apply(this, Array.prototype.slice.call(arguments)); |
+ }; |
+ $dynamicBind.methods = methods; |
+ Object.defineProperty(Object.prototype, name, { value: $dynamicBind, |
+ enumerable: false, writable: true, configurable: true}); |
+ return methods; |
+} |
+if (typeof $dynamicMetadata == 'undefined') $dynamicMetadata = []; |
+ |
+function $dynamicSetMetadata(inputTable) { |
+ // TODO: Deal with light isolates. |
+ var table = []; |
+ for (var i = 0; i < inputTable.length; i++) { |
+ var tag = inputTable[i][0]; |
+ var tags = inputTable[i][1]; |
+ var map = {}; |
+ var tagNames = tags.split('|'); |
+ for (var j = 0; j < tagNames.length; j++) { |
+ map[tagNames[j]] = true; |
+ } |
+ table.push({tag: tag, tags: tags, map: map}); |
+ } |
+ $dynamicMetadata = table; |
+} |
+$dynamic("end$0").WriteStream = function() { |
+ return this.end(null, "utf8"); |
+}; |
+$dynamic("write$1").WriteStream = function($0) { |
+ return this.write($0, "utf8"); |
+}; |
+// ********** Code for vm ************** |
+vm = require('vm'); |
+// ********** Code for fs ************** |
+fs = require('fs'); |
+// ********** Code for path ************** |
+path = require('path'); |
+// ********** Code for top level ************** |
+function createSandbox() { |
+ return {'require': require, 'process': process, 'console': console, |
+ 'Buffer' : Buffer, |
+ 'setTimeout': setTimeout, 'clearTimeout': clearTimeout}; |
+} |
+function get$_process() { |
+ return process; |
+} |
+function get$process() { |
+ return new Process(get$_process()); |
+} |
+// ********** Library file_system ************** |
+// ********** Code for top level ************** |
+function canonicalizePath(path) { |
+ return path.replaceAll("\\", "/"); |
+} |
+function joinPaths(path1, path2) { |
+ path1 = canonicalizePath(path1); |
+ path2 = canonicalizePath(path2); |
+ var pieces = path1.split("/"); |
+ var $$list = path2.split("/"); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var piece = $$i.next(); |
+ if ($eq(piece, "..") && pieces.get$length() > (0) && $ne(pieces.last(), ".") && $ne(pieces.last(), "..")) { |
+ pieces.removeLast(); |
+ } |
+ else if ($ne(piece, "")) { |
+ if (pieces.get$length() > (0) && $eq(pieces.last(), ".")) { |
+ pieces.removeLast(); |
+ } |
+ pieces.add(piece); |
+ } |
+ } |
+ return Strings.join(pieces, "/"); |
+} |
+function dirname(path) { |
+ path = canonicalizePath(path); |
+ var lastSlash = path.lastIndexOf("/", path.length); |
+ if (lastSlash == (-1)) { |
+ return "."; |
+ } |
+ else { |
+ return path.substring((0), lastSlash); |
+ } |
+} |
+function basename(path) { |
+ path = canonicalizePath(path); |
+ var lastSlash = path.lastIndexOf("/", path.length); |
+ if (lastSlash == (-1)) { |
+ return path; |
+ } |
+ else { |
+ return path.substring(lastSlash + (1)); |
+ } |
+} |
+// ********** Library file_system_node ************** |
+// ********** Code for NodeFileSystem ************** |
+function NodeFileSystem() { |
+ |
+} |
+NodeFileSystem.prototype.writeString = function(outfile, text) { |
+ fs.writeFileSync(outfile, text); |
+} |
+NodeFileSystem.prototype.readAll = function(filename) { |
+ return fs.readFileSync(filename, "utf8"); |
+} |
+NodeFileSystem.prototype.fileExists = function(filename) { |
+ return path.existsSync(filename); |
+} |
+// ********** Code for top level ************** |
+// ********** Library lang ************** |
+// ********** Code for MethodAnalyzer ************** |
+function MethodAnalyzer(method, body) { |
+ this.method = method; |
+ this.body = body; |
+ this.hasTypeParams = false; |
+} |
+MethodAnalyzer.prototype.get$method = function() { return this.method; }; |
+MethodAnalyzer.prototype.set$method = function(value) { return this.method = value; }; |
+MethodAnalyzer.prototype.get$body = function() { return this.body; }; |
+MethodAnalyzer.prototype.set$body = function(value) { return this.body = value; }; |
+MethodAnalyzer.prototype.get$hasTypeParams = function() { return this.hasTypeParams; }; |
+MethodAnalyzer.prototype.set$hasTypeParams = function(value) { return this.hasTypeParams = value; }; |
+MethodAnalyzer.prototype.analyze = function(context) { |
+ var thisValue; |
+ if (context != null) { |
+ thisValue = context.thisValue; |
+ } |
+ else { |
+ thisValue = new PureStaticValue(this.method.declaringType, null, false, false); |
+ } |
+ var values = []; |
+ var $$list = this.method.parameters; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var p = $$i.next(); |
+ values.add(new PureStaticValue(p.get$type(), null, false, false)); |
+ } |
+ var args = new Arguments(null, values); |
+ this._frame = new CallFrame(this, this.method, thisValue, args, context); |
+ this._bindArguments(this._frame.args); |
+ this.body.visit(this); |
+} |
+MethodAnalyzer.prototype._hasTypeParams = function(node) { |
+ if ((node instanceof NameTypeReference)) { |
+ var name = node.get$name().get$name(); |
+ return (this.method.declaringType.lookupTypeParam(name) != null); |
+ } |
+ else if ((node instanceof GenericTypeReference)) { |
+ var $$list = node.get$typeArguments(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var typeArg = $$i.next(); |
+ if (this._hasTypeParams(typeArg)) return true; |
+ } |
+ return false; |
+ } |
+ else { |
+ return false; |
+ } |
+} |
+MethodAnalyzer.prototype.resolveType = function(node, typeErrors, allowTypeParams) { |
+ if (!this.hasTypeParams && this._hasTypeParams(node)) { |
+ this.hasTypeParams = true; |
+ } |
+ return this.method.resolveType(node, typeErrors, allowTypeParams); |
+} |
+MethodAnalyzer.prototype.makeNeutral = function(inValue, span) { |
+ return new PureStaticValue(inValue.get$type(), span, false, false); |
+} |
+MethodAnalyzer.prototype._bindArguments = function(args) { |
+ for (var i = (0); |
+ i < this.method.parameters.get$length(); i++) { |
+ var p = this.method.parameters[i]; |
+ var currentArg = null; |
+ if (i < args.get$bareCount()) { |
+ currentArg = args.values.$index(i); |
+ } |
+ else { |
+ currentArg = args.getValue(p.get$name()); |
+ if (currentArg == null) { |
+ p.genValue(this.method, this._frame); |
+ if (p.get$value() == null) { |
+ $globals.world.warning("missing argument at call - does not match"); |
+ } |
+ currentArg = p.get$value(); |
+ } |
+ } |
+ currentArg = this.makeNeutral(currentArg, p.get$definition().get$span()); |
+ this._frame.declareParameter(p, currentArg); |
+ } |
+} |
+MethodAnalyzer.prototype.visitBool = function(node) { |
+ return this.visitTypedValue(node, $globals.world.boolType); |
+} |
+MethodAnalyzer.prototype.visitValue = function(node) { |
+ if (node == null) return null; |
+ var value = node.visit(this); |
+ value.checkFirstClass(node.span); |
+ return value; |
+} |
+MethodAnalyzer.prototype.visitTypedValue = function(node, expectedType) { |
+ var val = this.visitValue(node); |
+ return val; |
+} |
+MethodAnalyzer.prototype.visitVoid = function(node) { |
+ return this.visitValue(node); |
+} |
+MethodAnalyzer.prototype._visitArgs = function(arguments) { |
+ var args = []; |
+ var seenLabel = false; |
+ for (var $$i = arguments.iterator(); $$i.hasNext(); ) { |
+ var arg = $$i.next(); |
+ if (arg.get$label() != null) { |
+ seenLabel = true; |
+ } |
+ else if (seenLabel) { |
+ $globals.world.error("bare argument can not follow named arguments", arg.get$span()); |
+ } |
+ args.add(this.visitValue(arg.get$value())); |
+ } |
+ return new Arguments(arguments, args); |
+} |
+MethodAnalyzer.prototype._makeLambdaMethod = function(name, func) { |
+ var meth = new MethodMember(name, this.method.declaringType, func); |
+ meth.set$isLambda(true); |
+ meth.set$enclosingElement(this.method); |
+ meth.set$_methodData(new MethodData(meth, this._frame)); |
+ meth.resolve(); |
+ return meth; |
+} |
+MethodAnalyzer.prototype._pushBlock = function(node) { |
+ this._frame.pushBlock(node); |
+} |
+MethodAnalyzer.prototype._popBlock = function(node) { |
+ this._frame.popBlock(node); |
+} |
+MethodAnalyzer.prototype._resolveBare = function(name, node) { |
+ var type = this._frame.method.declaringType; |
+ var member = type.getMember(name); |
+ if ($eq(member) || $ne(member.get$declaringType(), type)) { |
+ var libMember = this._frame.get$library().lookup(name, node.span); |
+ if (libMember != null) return libMember; |
+ } |
+ if (member != null && !member.get$isStatic() && this._frame.get$isStatic()) { |
+ $globals.world.error("can not refer to instance member from static method", node.span); |
+ } |
+ return member; |
+} |
+MethodAnalyzer.prototype.visitDietStatement = function(node) { |
+ var parser = new Parser(node.span.file, false, false, false, node.span.start); |
+ parser.block().visit(this); |
+} |
+MethodAnalyzer.prototype.visitVariableDefinition = function(node) { |
+ var isFinal = false; |
+ if (node.modifiers != null && node.modifiers[(0)].kind == (99)) { |
+ isFinal = true; |
+ } |
+ var type = this.resolveType(node.type, false, true); |
+ for (var i = (0); |
+ i < node.names.get$length(); i++) { |
+ var name = node.names[i].name; |
+ var value = this.visitValue(node.values[i]); |
+ this._frame.create(name, type, node.names[i], isFinal, value); |
+ } |
+} |
+MethodAnalyzer.prototype.visitFunctionDefinition = function(node) { |
+ var meth = this._makeLambdaMethod(node.name.name, node); |
+ var funcValue = this._frame.create(meth.get$name(), meth.get$functionType(), this.method.definition, true, null); |
+ meth.get$methodData().analyze(); |
+} |
+MethodAnalyzer.prototype.visitReturnStatement = function(node) { |
+ if (node.value == null) { |
+ this._frame.returns(Value.fromNull(node.span)); |
+ } |
+ else { |
+ this._frame.returns(this.visitValue(node.value)); |
+ } |
+} |
+MethodAnalyzer.prototype.visitThrowStatement = function(node) { |
+ if (node.value != null) { |
+ var value = this.visitValue(node.value); |
+ } |
+ else { |
+ } |
+} |
+MethodAnalyzer.prototype.visitAssertStatement = function(node) { |
+ var test = this.visitValue(node.test); |
+} |
+MethodAnalyzer.prototype.visitBreakStatement = function(node) { |
+ |
+} |
+MethodAnalyzer.prototype.visitContinueStatement = function(node) { |
+ |
+} |
+MethodAnalyzer.prototype.visitIfStatement = function(node) { |
+ var test = this.visitBool(node.test); |
+ node.trueBranch.visit(this); |
+ if (node.falseBranch != null) { |
+ node.falseBranch.visit(this); |
+ } |
+} |
+MethodAnalyzer.prototype.visitWhileStatement = function(node) { |
+ var test = this.visitBool(node.test); |
+ node.body.visit(this); |
+} |
+MethodAnalyzer.prototype.visitDoStatement = function(node) { |
+ node.body.visit(this); |
+ var test = this.visitBool(node.test); |
+} |
+MethodAnalyzer.prototype.visitForStatement = function(node) { |
+ this._pushBlock(node); |
+ if (node.init != null) node.init.visit(this); |
+ if (node.test != null) { |
+ var test = this.visitBool(node.test); |
+ } |
+ var $$list = node.step; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var s = $$i.next(); |
+ var sv = this.visitVoid(s); |
+ } |
+ this._pushBlock(node.body); |
+ node.body.visit(this); |
+ this._popBlock(node.body); |
+ this._popBlock(node); |
+} |
+MethodAnalyzer.prototype.visitForInStatement = function(node) { |
+ var itemType = this.resolveType(node.item.type, false, true); |
+ var list = node.list.visit(this); |
+ this._visitForInBody(node, itemType, list); |
+} |
+MethodAnalyzer.prototype._isFinal = function(typeRef) { |
+ if ((typeRef instanceof GenericTypeReference)) { |
+ typeRef = typeRef.get$baseType(); |
+ } |
+ else if ((typeRef instanceof SimpleTypeReference)) { |
+ return false; |
+ } |
+ return $ne(typeRef) && typeRef.get$isFinal(); |
+} |
+MethodAnalyzer.prototype._visitForInBody = function(node, itemType, list) { |
+ this._pushBlock(node); |
+ var isFinal = this._isFinal(node.item.type); |
+ var itemName = node.item.name.name; |
+ var item = this._frame.create(itemName, itemType, node.item.name, isFinal, null); |
+ var iterator = list.invoke(this._frame, "iterator", node.list, Arguments.get$EMPTY()); |
+ node.body.visit(this); |
+ this._popBlock(node); |
+} |
+MethodAnalyzer.prototype._createDI = function(di) { |
+ this._frame.create(di.name.name, this.resolveType(di.type, false, true), di.name, true, null); |
+} |
+MethodAnalyzer.prototype.visitTryStatement = function(node) { |
+ this._pushBlock(node.body); |
+ node.body.visit(this); |
+ this._popBlock(node.body); |
+ if (node.catches.get$length() > (0)) { |
+ for (var i = (0); |
+ i < node.catches.get$length(); i++) { |
+ var catch_ = node.catches[i]; |
+ this._pushBlock(catch_); |
+ this._createDI(catch_.get$exception()); |
+ if (catch_.get$trace() != null) { |
+ this._createDI(catch_.get$trace()); |
+ } |
+ catch_.get$body().visit(this); |
+ this._popBlock(catch_); |
+ } |
+ } |
+ if (node.finallyBlock != null) { |
+ node.finallyBlock.visit(this); |
+ } |
+} |
+MethodAnalyzer.prototype.visitSwitchStatement = function(node) { |
+ var test = this.visitValue(node.test); |
+ var $$list = node.cases; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var case_ = $$i.next(); |
+ this._pushBlock(case_); |
+ for (var i = (0); |
+ i < case_.get$cases().get$length(); i++) { |
+ var expr = case_.get$cases().$index(i); |
+ if ($eq(expr)) { |
+ } |
+ else { |
+ var value = this.visitValue(expr); |
+ } |
+ } |
+ this._visitAllStatements(case_.get$statements()); |
+ this._popBlock(case_); |
+ } |
+} |
+MethodAnalyzer.prototype._visitAllStatements = function(statementList) { |
+ for (var i = (0); |
+ i < statementList.get$length(); i++) { |
+ var stmt = statementList.$index(i); |
+ stmt.visit(this); |
+ } |
+} |
+MethodAnalyzer.prototype.visitBlockStatement = function(node) { |
+ this._pushBlock(node); |
+ this._visitAllStatements(node.body); |
+ this._popBlock(node); |
+} |
+MethodAnalyzer.prototype.visitLabeledStatement = function(node) { |
+ node.body.visit(this); |
+} |
+MethodAnalyzer.prototype.visitExpressionStatement = function(node) { |
+ var value = this.visitVoid(node.body); |
+} |
+MethodAnalyzer.prototype.visitEmptyStatement = function(node) { |
+ |
+} |
+MethodAnalyzer.prototype.visitLambdaExpression = function(node) { |
+ var name = (node.func.name != null) ? node.func.name.name : ""; |
+ var meth = this._makeLambdaMethod(name, node.func); |
+ meth.get$methodData().analyze(); |
+ return this._frame._makeValue($globals.world.functionType, node); |
+} |
+MethodAnalyzer.prototype.visitCallExpression = function(node) { |
+ var target; |
+ var position = node.target; |
+ var name = ":call"; |
+ if ((node.target instanceof DotExpression)) { |
+ var dot = node.target; |
+ target = dot.self.visit(this); |
+ name = dot.name.name; |
+ position = dot.name; |
+ } |
+ else if ((node.target instanceof VarExpression)) { |
+ var varExpr = node.target; |
+ name = varExpr.name.name; |
+ target = this._frame.lookup(name); |
+ if ($ne(target)) { |
+ return target.get().invoke(this._frame, ":call", node, this._visitArgs(node.arguments)); |
+ } |
+ var member = this._resolveBare(name, varExpr.name); |
+ if (member != null) { |
+ return member.invoke(this._frame, node, this._frame.makeThisValue(node), this._visitArgs(node.arguments)); |
+ } |
+ else { |
+ $globals.world.warning(("can not find \"" + name + "\""), node.span); |
+ return this._frame._makeValue($globals.world.varType, node); |
+ } |
+ } |
+ else { |
+ target = node.target.visit(this); |
+ } |
+ return target.invoke(this._frame, name, position, this._visitArgs(node.arguments)); |
+} |
+MethodAnalyzer.prototype.visitIndexExpression = function(node) { |
+ var target = this.visitValue(node.target); |
+ var index = this.visitValue(node.index); |
+ return target.invoke(this._frame, ":index", node, new Arguments(null, [index])); |
+} |
+MethodAnalyzer.prototype.visitBinaryExpression = function(node, isVoid) { |
+ var kind = node.op.kind; |
+ if ($eq(kind, (35)) || $eq(kind, (34))) { |
+ var xb = this.visitBool(node.x); |
+ var yb = this.visitBool(node.y); |
+ return xb.binop(kind, yb, this._frame, node); |
+ } |
+ var assignKind = TokenKind.kindFromAssign(node.op.kind); |
+ if ($eq(assignKind, (-1))) { |
+ var x = this.visitValue(node.x); |
+ var y = this.visitValue(node.y); |
+ return x.binop(kind, y, this._frame, node); |
+ } |
+ else { |
+ return this._visitAssign(assignKind, node.x, node.y, node); |
+ } |
+} |
+MethodAnalyzer.prototype._visitAssign = function(kind, xn, yn, position) { |
+ if ((xn instanceof VarExpression)) { |
+ return this._visitVarAssign(kind, xn, yn, position); |
+ } |
+ else if ((xn instanceof IndexExpression)) { |
+ return this._visitIndexAssign(kind, xn, yn, position); |
+ } |
+ else if ((xn instanceof DotExpression)) { |
+ return this._visitDotAssign(kind, xn, yn, position); |
+ } |
+ else { |
+ $globals.world.error("illegal lhs", xn.span); |
+ } |
+} |
+MethodAnalyzer.prototype._visitVarAssign = function(kind, xn, yn, node) { |
+ var value = this.visitValue(yn); |
+ var name = xn.name.name; |
+ var slot = this._frame.lookup(name); |
+ if ($ne(slot)) { |
+ slot.set(value); |
+ } |
+ else { |
+ var member = this._resolveBare(name, xn.name); |
+ if (member != null) { |
+ member._set(this._frame, node, this._frame.makeThisValue(node), value); |
+ } |
+ else { |
+ $globals.world.warning(("can not find \"" + name + "\""), node.span); |
+ } |
+ } |
+ return this._frame._makeValue(value.get$type(), node); |
+} |
+MethodAnalyzer.prototype._visitIndexAssign = function(kind, xn, yn, position) { |
+ var target = this.visitValue(xn.target); |
+ var index = this.visitValue(xn.index); |
+ var y = this.visitValue(yn); |
+ return target.setIndex$4$kind(this._frame, index, position, y, kind); |
+} |
+MethodAnalyzer.prototype._visitDotAssign = function(kind, xn, yn, position) { |
+ var target = xn.self.visit(this); |
+ var y = this.visitValue(yn); |
+ return target.set_$4$kind(this._frame, xn.name.name, xn.name, y, kind); |
+} |
+MethodAnalyzer.prototype.visitUnaryExpression = function(node) { |
+ var value = this.visitValue(node.self); |
+ switch (node.op.kind) { |
+ case (16): |
+ case (17): |
+ |
+ return value.binop((42), this._frame._makeValue($globals.world.intType, node), this._frame, node); |
+ |
+ } |
+ return value.unop(node.op.kind, this._frame, node); |
+} |
+MethodAnalyzer.prototype.visitDeclaredIdentifier = function(node) { |
+ $globals.world.error("Expected expression", node.span); |
+} |
+MethodAnalyzer.prototype.visitAwaitExpression = function(node) { |
+ $globals.world.internalError("Await expressions should have been eliminated before code generation", node.span); |
+} |
+MethodAnalyzer.prototype.visitPostfixExpression = function(node, isVoid) { |
+ var value = this.visitValue(node.body); |
+ return this._frame._makeValue(value.get$type(), node); |
+} |
+MethodAnalyzer.prototype.visitNewExpression = function(node) { |
+ var typeRef = node.type; |
+ var constructorName = ""; |
+ if (node.name != null) { |
+ constructorName = node.name.name; |
+ } |
+ if ($eq(constructorName, "") && (typeRef instanceof NameTypeReference) && typeRef.get$names() != null) { |
+ var names = ListFactory.ListFactory$from$factory(typeRef.get$names()); |
+ constructorName = names.removeLast().get$name(); |
+ if (names.get$length() == (0)) names = null; |
+ typeRef = new NameTypeReference(typeRef.get$isFinal(), typeRef.get$name(), names, typeRef.get$span()); |
+ } |
+ var type = this.resolveType(typeRef, true, true); |
+ if (type.get$isTop()) { |
+ type = type.get$library().findTypeByName(constructorName); |
+ constructorName = ""; |
+ } |
+ if ((type instanceof ParameterType)) { |
+ $globals.world.error("cannot instantiate a type parameter", node.span); |
+ return this._frame._makeValue($globals.world.varType, node); |
+ } |
+ var m = type.getConstructor(constructorName); |
+ if ($eq(m)) { |
+ var name = type.get$jsname(); |
+ if (type.get$isVar()) { |
+ name = typeRef.get$name().get$name(); |
+ } |
+ $globals.world.warning(("no matching constructor for " + name), node.span); |
+ return this._frame._makeValue(type, node); |
+ } |
+ if (node.isConst) { |
+ if (!m.get$isConst()) { |
+ $globals.world.error("can't use const on a non-const constructor", node.span); |
+ } |
+ var $$list = node.arguments; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var arg = $$i.next(); |
+ if (!this.visitValue(arg.get$value()).get$isConst()) { |
+ $globals.world.error("const constructor expects const arguments", arg.get$span()); |
+ } |
+ } |
+ } |
+ var args = this._visitArgs(node.arguments); |
+ var target = new TypeValue(type, typeRef.get$span()); |
+ return new PureStaticValue(type, node.span, node.isConst, false); |
+} |
+MethodAnalyzer.prototype.visitListExpression = function(node) { |
+ var argValues = []; |
+ var listType = $globals.world.listType; |
+ var type = $globals.world.varType; |
+ if (node.itemType != null) { |
+ type = this.resolveType(node.itemType, true, !node.isConst); |
+ if (node.isConst && ((type instanceof ParameterType) || type.get$hasTypeParams())) { |
+ $globals.world.error("type parameter cannot be used in const list literals"); |
+ } |
+ listType = listType.getOrMakeConcreteType([type]); |
+ } |
+ var $$list = node.values; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var item = $$i.next(); |
+ var arg = this.visitTypedValue(item, type); |
+ argValues.add(arg); |
+ } |
+ $globals.world.listFactoryType.markUsed(); |
+ return new PureStaticValue(listType, node.span, node.isConst, false); |
+} |
+MethodAnalyzer.prototype.visitMapExpression = function(node) { |
+ var values = []; |
+ 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, !node.isConst); |
+ if (!keyType.get$isString()) { |
+ $globals.world.error("the key type of a map literal must be \"String\"", keyType.get$span()); |
+ } |
+ if (node.isConst && ((keyType instanceof ParameterType) || keyType.get$hasTypeParams())) { |
+ $globals.world.error("type parameter cannot be used in const map literals"); |
+ } |
+ } |
+ valueType = this.resolveType(node.valueType, true, !node.isConst); |
+ if (node.isConst && ((valueType instanceof ParameterType) || valueType.get$hasTypeParams())) { |
+ $globals.world.error("type parameter cannot be used in const map literals"); |
} |
- |
- return method.apply(this, Array.prototype.slice.call(arguments)); |
- }; |
- $dynamicBind.methods = methods; |
- Object.defineProperty(Object.prototype, name, { value: $dynamicBind, |
- enumerable: false, writable: true, configurable: true}); |
- return methods; |
+ mapType = mapType.getOrMakeConcreteType([keyType, valueType]); |
+ } |
+ for (var i = (0); |
+ i < node.items.get$length(); i += (2)) { |
+ var key = this.visitTypedValue(node.items[i], keyType); |
+ values.add(key); |
+ var value = this.visitTypedValue(node.items[i + (1)], valueType); |
+ if (node.isConst && !value.get$isConst()) { |
+ $globals.world.error("const map can only contain const values", value.get$span()); |
+ } |
+ values.add(value); |
+ } |
+ return new PureStaticValue(mapType, node.span, node.isConst, false); |
} |
-if (typeof $dynamicMetadata == 'undefined') $dynamicMetadata = []; |
- |
-function $dynamicSetMetadata(inputTable) { |
- // TODO: Deal with light isolates. |
- var table = []; |
- for (var i = 0; i < inputTable.length; i++) { |
- var tag = inputTable[i][0]; |
- var tags = inputTable[i][1]; |
- var map = {}; |
- var tagNames = tags.split('|'); |
- for (var j = 0; j < tagNames.length; j++) { |
- map[tagNames[j]] = true; |
+MethodAnalyzer.prototype.visitConditionalExpression = function(node) { |
+ var test = this.visitBool(node.test); |
+ var trueBranch = this.visitValue(node.trueBranch); |
+ var falseBranch = this.visitValue(node.falseBranch); |
+ return this._frame._makeValue(Type.union(trueBranch.get$type(), falseBranch.get$type()), node); |
+} |
+MethodAnalyzer.prototype.visitIsExpression = function(node) { |
+ var value = this.visitValue(node.x); |
+ var type = this.resolveType(node.type, false, true); |
+ return this._frame._makeValue($globals.world.boolType, node); |
+} |
+MethodAnalyzer.prototype.visitParenExpression = function(node) { |
+ return this.visitValue(node.body); |
+} |
+MethodAnalyzer.prototype.visitDotExpression = function(node) { |
+ var target = node.self.visit(this); |
+ return target.get_(this._frame, node.name.name, node); |
+} |
+MethodAnalyzer.prototype.visitVarExpression = function(node) { |
+ var name = node.name.name; |
+ var slot = this._frame.lookup(name); |
+ if ($ne(slot)) { |
+ return slot.get(); |
+ } |
+ var member = this._resolveBare(name, node.name); |
+ if (member != null) { |
+ if ((member instanceof TypeMember)) { |
+ return new PureStaticValue(member.get$dynamic().get$type(), node.span, true, true); |
+ } |
+ else { |
+ return member._get(this._frame, node, this._frame.makeThisValue(node)); |
} |
- table.push({tag: tag, tags: tags, map: map}); |
} |
- $dynamicMetadata = table; |
+ else { |
+ $globals.world.warning(("can not find \"" + name + "\""), node.span); |
+ return this._frame._makeValue($globals.world.varType, node); |
+ } |
} |
-$dynamic("get$end").WriteStream = function() { |
- return this.end.bind(this); |
+MethodAnalyzer.prototype.visitThisExpression = function(node) { |
+ return this._frame.makeThisValue(node); |
} |
-$dynamic("end$0").WriteStream = function() { |
- return this.end(null, "utf8"); |
+MethodAnalyzer.prototype.visitSuperExpression = function(node) { |
+ return this._frame.makeSuperValue(node); |
+} |
+MethodAnalyzer.prototype.visitLiteralExpression = function(node) { |
+ return new PureStaticValue(node.value.get$type(), node.span, true, false); |
+} |
+MethodAnalyzer.prototype.visitStringInterpExpression = function(node) { |
+ return this._frame._makeValue($globals.world.stringType, node); |
+} |
+MethodAnalyzer.prototype._pushBlock$1 = MethodAnalyzer.prototype._pushBlock; |
+MethodAnalyzer.prototype.analyze$1 = MethodAnalyzer.prototype.analyze; |
+MethodAnalyzer.prototype.visitBinaryExpression$1 = function($0) { |
+ return this.visitBinaryExpression($0, false); |
}; |
-$dynamic("write$1").WriteStream = function($0) { |
- return this.write($0, "utf8"); |
+MethodAnalyzer.prototype.visitPostfixExpression$1 = function($0) { |
+ return this.visitPostfixExpression($0, false); |
}; |
-// ********** Code for vm ************** |
-vm = require('vm'); |
-// ********** Code for fs ************** |
-fs = require('fs'); |
-// ********** Code for path ************** |
-path = require('path'); |
-// ********** Code for top level ************** |
-function createSandbox() { |
- return {'require': require, 'process': process, 'console': console, |
- 'Buffer' : Buffer, |
- 'setTimeout': setTimeout, 'clearTimeout': clearTimeout}; |
+// ********** Code for CallFrame ************** |
+function CallFrame(analyzer, method, thisValue, args, enclosingFrame) { |
+ this.args = args; |
+ this.analyzer = analyzer; |
+ this.enclosingFrame = enclosingFrame; |
+ this.method = method; |
+ this.thisValue = thisValue; |
+ this._slots = []; |
+ this._scope = new AnalyzeScope(null, this, this.analyzer.body); |
+ this._returnSlot = new VariableSlot(this._scope, "return", this.method.returnType, this.analyzer.body, false); |
} |
-function get$_process() { |
- return process; |
+CallFrame.prototype.findMembers = function(name) { |
+ return this.get$library()._findMembers(name); |
} |
-function get$process() { |
- return new Process(get$_process()); |
+CallFrame.prototype.get$counters = function() { |
+ return $globals.world.counters; |
} |
-// ********** Library file_system ************** |
-// ********** Code for top level ************** |
-function canonicalizePath(path) { |
- return path.replaceAll("\\", "/"); |
+CallFrame.prototype.get$library = function() { |
+ return this.method.get$library(); |
} |
-function joinPaths(path1, path2) { |
- path1 = canonicalizePath(path1); |
- path2 = canonicalizePath(path2); |
- var pieces = path1.split("/"); |
- var $$list = path2.split("/"); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var piece = $$list[$$i]; |
- 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(), ".")) { |
- pieces.removeLast$0(); |
- } |
- pieces.add$1(piece); |
- } |
- } |
- return Strings.join(pieces, "/"); |
+CallFrame.prototype.get$method = function() { return this.method; }; |
+CallFrame.prototype.set$method = function(value) { return this.method = value; }; |
+CallFrame.prototype.get$needsCode = function() { |
+ return false; |
} |
-function dirname(path) { |
- path = canonicalizePath(path); |
- var lastSlash = path.lastIndexOf("/", path.length); |
- if (lastSlash == (-1)) { |
- return "."; |
- } |
- else { |
- return path.substring((0), lastSlash); |
+CallFrame.prototype.get$showWarnings = function() { |
+ return true; |
+} |
+CallFrame.prototype._makeThisCode = function() { |
+ return null; |
+} |
+CallFrame.prototype.getTemp = function(value) { |
+ return null; |
+} |
+CallFrame.prototype.forceTemp = function(value) { |
+ return null; |
+} |
+CallFrame.prototype.assignTemp = function(tmp, v) { |
+ return null; |
+} |
+CallFrame.prototype.freeTemp = function(value) { |
+ return null; |
+} |
+CallFrame.prototype.get$isStatic = function() { |
+ return this.enclosingFrame != null ? this.enclosingFrame.get$isStatic() : this.method.isStatic; |
+} |
+CallFrame.prototype.get$_slots = function() { return this._slots; }; |
+CallFrame.prototype.set$_slots = function(value) { return this._slots = value; }; |
+CallFrame.prototype.get$_scope = function() { return this._scope; }; |
+CallFrame.prototype.set$_scope = function(value) { return this._scope = value; }; |
+CallFrame.prototype.pushBlock = function(node) { |
+ this._scope = new AnalyzeScope(this._scope, this, node); |
+} |
+CallFrame.prototype.popBlock = function(node) { |
+ if ($ne(this._scope.node, node)) { |
+ $globals.world.internalError("incorrect pop", node.span, this._scope.node.span); |
} |
+ this._scope = this._scope.parent; |
} |
-function basename(path) { |
- path = canonicalizePath(path); |
- var lastSlash = path.lastIndexOf("/", path.length); |
- if (lastSlash == (-1)) { |
- return path; |
+CallFrame.prototype.returns = function(value) { |
+ this._returnSlot.set(value); |
+} |
+CallFrame.prototype.lookup = function(name) { |
+ var slot = this._scope._lookup(name); |
+ if ($eq(slot) && this.enclosingFrame != null) { |
+ return this.enclosingFrame.lookup(name); |
} |
- else { |
- return path.substring(lastSlash + (1)); |
+ return slot; |
+} |
+CallFrame.prototype.create = function(name, staticType, node, isFinal, value) { |
+ var slot = new VariableSlot(this._scope, name, staticType, node, isFinal, value); |
+ var existingSlot = this._scope._lookup(name); |
+ if (existingSlot != null) { |
+ if ($eq(existingSlot.get$scope(), this)) { |
+ $globals.world.error(("duplicate name \"" + name + "\""), node.span); |
+ } |
+ else { |
+ } |
} |
+ this._slots.add(slot); |
+ this._scope._slots.add(slot); |
} |
-// ********** Library file_system_node ************** |
-// ********** Code for NodeFileSystem ************** |
-function NodeFileSystem() { |
- |
+CallFrame.prototype.declareParameter = function(p, value) { |
+ return this.create(p.name, p.type, p.definition, false, value); |
} |
-NodeFileSystem.prototype.writeString = function(outfile, text) { |
- fs.writeFileSync(outfile, text); |
+CallFrame.prototype._makeValue = function(type, node) { |
+ return new PureStaticValue(type, node == null ? null : node.span, false, false); |
} |
-NodeFileSystem.prototype.readAll = function(filename) { |
- return fs.readFileSync(filename, "utf8"); |
+CallFrame.prototype.makeSuperValue = function(node) { |
+ return this._makeValue(this.thisValue.get$type().get$parent(), node); |
} |
-NodeFileSystem.prototype.fileExists = function(filename) { |
- return path.existsSync(filename); |
+CallFrame.prototype.makeThisValue = function(node) { |
+ return this._makeValue(this.thisValue.get$type(), node); |
+} |
+// ********** Code for VariableSlot ************** |
+function VariableSlot(scope, name, staticType, node, isFinal, value) { |
+ this.value = value; |
+ this.name = name; |
+ this.scope = scope; |
+ this.node = node; |
+ this.staticType = staticType; |
+ this.isFinal = isFinal; |
+} |
+VariableSlot.prototype.get$scope = function() { return this.scope; }; |
+VariableSlot.prototype.set$scope = function(value) { return this.scope = value; }; |
+VariableSlot.prototype.get$name = function() { return this.name; }; |
+VariableSlot.prototype.get$staticType = function() { return this.staticType; }; |
+VariableSlot.prototype.set$staticType = function(value) { return this.staticType = value; }; |
+VariableSlot.prototype.get$isFinal = function() { return this.isFinal; }; |
+VariableSlot.prototype.set$isFinal = function(value) { return this.isFinal = value; }; |
+VariableSlot.prototype.get$value = function() { return this.value; }; |
+VariableSlot.prototype.set$value = function(value) { return this.value = value; }; |
+VariableSlot.prototype.get = function() { |
+ return this.scope.frame._makeValue(this.staticType, null); |
+} |
+VariableSlot.prototype.set = function(newValue) { |
+ if (this.value == null) this.value = newValue; |
+ else this.value = Value.union(this.value, newValue); |
+} |
+VariableSlot.prototype.toString = function() { |
+ var valueString = this.value != null ? (" = " + this.value.get$type().name) : ""; |
+ return ("" + this.staticType.name + " " + this.name + valueString); |
+} |
+VariableSlot.prototype.toString$0 = VariableSlot.prototype.toString; |
+// ********** Code for AnalyzeScope ************** |
+function AnalyzeScope(parent, frame, node) { |
+ this.frame = frame; |
+ this.parent = parent; |
+ this.node = node; |
+ this._slots = []; |
+} |
+AnalyzeScope.prototype.get$parent = function() { return this.parent; }; |
+AnalyzeScope.prototype.set$parent = function(value) { return this.parent = value; }; |
+AnalyzeScope.prototype.get$_slots = function() { return this._slots; }; |
+AnalyzeScope.prototype.set$_slots = function(value) { return this._slots = value; }; |
+AnalyzeScope.prototype._lookup = function(name) { |
+ for (var s = this; |
+ $ne(s); s = s.get$parent()) { |
+ for (var i = (0); |
+ i < s.get$_slots().get$length(); i++) { |
+ var ret = s.get$_slots()[i]; |
+ if ($eq(ret.get$name(), name)) return ret; |
+ } |
+ } |
+ return null; |
} |
-// ********** Code for top level ************** |
-// ********** Library lang ************** |
// ********** Code for BlockScope ************** |
function BlockScope(enclosingMethod, parent, node, reentrant) { |
this.enclosingMethod = enclosingMethod; |
@@ -2385,9 +2319,9 @@ function BlockScope(enclosingMethod, parent, node, reentrant) { |
this.parent = parent; |
this.node = node; |
this.reentrant = reentrant; |
- this._jsNames = new HashSetImplementation(); |
+ this._jsNames = new HashSetImplementation_dart_core_String(); |
if (this.get$isMethodScope()) { |
- this._closedOver = new HashSetImplementation(); |
+ this._closedOver = new HashSetImplementation_dart_core_String(); |
} |
else { |
this.reentrant = reentrant || this.parent.reentrant; |
@@ -2427,7 +2361,7 @@ BlockScope.prototype.get$methodScope = function() { |
} |
BlockScope.prototype.lookup = function(name) { |
for (var s = this; |
- s != null; s = s.get$parent()) { |
+ $ne(s); s = s.get$parent()) { |
var ret = s.get$_vars().$index(name); |
if (ret != null) return this._capture(s, ret); |
} |
@@ -2438,10 +2372,10 @@ BlockScope.prototype.inferAssign = function(name, value) { |
} |
BlockScope.prototype.assign = function(name, value) { |
for (var s = this; |
- s != null; s = s.get$parent()) { |
+ $ne(s); s = s.get$parent()) { |
var existing = s.get$_vars().$index(name); |
- if (existing != null) { |
- s.get$_vars().$setindex(name, existing.replaceValue$1(value)); |
+ if ($ne(existing)) { |
+ s.get$_vars().$setindex(name, existing.replaceValue(value)); |
return; |
} |
} |
@@ -2459,13 +2393,13 @@ BlockScope.prototype._capture = function(other, value) { |
BlockScope.prototype._isDefinedInParent = function(name) { |
if (this.get$isMethodScope() && this._closedOver.contains(name)) return true; |
for (var s = this.parent; |
- s != null; s = s.get$parent()) { |
- if (s.get$_vars().containsKey$1(name)) return true; |
- if (s.get$_jsNames().contains$1(name)) return true; |
- if (s.get$isMethodScope() && s.get$_closedOver().contains$1(name)) return true; |
+ $ne(s); s = s.get$parent()) { |
+ if (s.get$_vars().containsKey(name)) return true; |
+ if (s.get$_jsNames().contains(name)) return true; |
+ if (s.get$isMethodScope() && s.get$_closedOver().contains(name)) return true; |
} |
var type = this.enclosingMethod.method.declaringType; |
- if (type.get$library().lookup$2(name) != null) return true; |
+ if (type.get$library().lookup(name, null) != null) return true; |
return false; |
} |
BlockScope.prototype.create = function(name, type, span, isFinal, isParameter) { |
@@ -2488,12 +2422,12 @@ BlockScope.prototype.declareParameter = function(p) { |
return this.create(p.name, p.type, p.definition.span, false, true); |
} |
BlockScope.prototype.declare = function(id) { |
- var type = this.enclosingMethod.method.resolveType$2(id.type, false); |
+ var type = this.enclosingMethod.method.resolveType(id.type, false, true); |
return this.create(id.name.name, type, id.span, false, false); |
} |
BlockScope.prototype.getRethrow = function() { |
var scope = this; |
- while (scope.get$rethrow() == null && scope.get$parent() != null) { |
+ while (scope.get$rethrow() == null && $ne(scope.get$parent())) { |
scope = scope.get$parent(); |
} |
return scope.get$rethrow(); |
@@ -2604,8 +2538,10 @@ function CoreJs() { |
this.useSetIndex = false; |
this.useIndex = false; |
} |
+CoreJs.prototype.get$writer = function() { return this.writer; }; |
+CoreJs.prototype.set$writer = function(value) { return this.writer = value; }; |
CoreJs.prototype.useOperator = function(name) { |
- if (this._usedOperators.$index(name) != null) return; |
+ if ($ne(this._usedOperators.$index(name))) return; |
var code; |
switch (name) { |
case ":ne": |
@@ -2704,8 +2640,8 @@ CoreJs.prototype.generate = function(w) { |
} |
} |
var $$list = orderValuesByKeys(this._usedOperators); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var opImpl = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var opImpl = $$i.next(); |
w.writeln(opImpl); |
} |
if ($globals.world.dom != null) { |
@@ -2713,7 +2649,6 @@ CoreJs.prototype.generate = function(w) { |
w.writeln("Object.defineProperty(Object.prototype, \"get$typeName\", { value: Object.prototype.$typeNameOf, enumerable: false, writable: true, configurable: true});"); |
} |
} |
-CoreJs.prototype.generate$1 = CoreJs.prototype.generate; |
// ********** Code for Element ************** |
function Element(name, _enclosingElement) { |
this.name = name; |
@@ -2754,6 +2689,9 @@ Element.prototype.resolve = function() { |
Element.prototype.get$typeParameters = function() { |
return null; |
} |
+Element.prototype.get$typeArgsInOrder = function() { |
+ return const$0007; |
+} |
Element.prototype.get$enclosingElement = function() { |
return this._enclosingElement == null ? this.get$library() : this._enclosingElement; |
} |
@@ -2761,49 +2699,61 @@ Element.prototype.set$enclosingElement = function(e) { |
var $0; |
return (this._enclosingElement = ($0 = e), $0); |
} |
-Element.prototype.resolveType = function(node, typeErrors) { |
+Element.prototype.lookupTypeParam = function(name) { |
+ if (this.get$typeParameters() == null) return null; |
+ for (var i = (0); |
+ i < this.get$typeParameters().get$length(); i++) { |
+ if (this.get$typeParameters()[i].name == name) { |
+ return this.get$typeArgsInOrder().$index(i); |
+ } |
+ } |
+ return null; |
+} |
+Element.prototype.resolveType = function(node, typeErrors, allowTypeParams) { |
if (node == null) return $globals.world.varType; |
- if (node.type != null) return node.type; |
- if ((node instanceof NameTypeReference)) { |
+ if ((node instanceof SimpleTypeReference)) { |
+ var ret = node.get$dynamic().get$type(); |
+ if ($eq(ret, $globals.world.voidType)) { |
+ $globals.world.error("\"void\" only allowed as return type", node.span); |
+ return $globals.world.varType; |
+ } |
+ return ret; |
+ } |
+ else if ((node instanceof NameTypeReference)) { |
var typeRef = node; |
var name; |
if (typeRef.names != null) { |
- name = typeRef.names.last().get$name(); |
+ name = typeRef.names.last().name; |
} |
else { |
name = typeRef.name.name; |
} |
- if (this.get$typeParameters() != null) { |
- var $$list = this.get$typeParameters(); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var tp = $$list[$$i]; |
- if ($eq(tp.get$name(), name)) { |
- typeRef.type = tp; |
- } |
+ var typeParamType = this.lookupTypeParam(name); |
+ if ($ne(typeParamType)) { |
+ if (!allowTypeParams) { |
+ $globals.world.error("using type parameter in illegal context.", node.span); |
} |
+ return typeParamType; |
} |
- if (typeRef.type != null) { |
- return typeRef.type; |
- } |
- return this.get$enclosingElement().resolveType$2(node, typeErrors); |
+ return this.get$enclosingElement().resolveType(node, typeErrors, allowTypeParams); |
} |
else if ((node instanceof GenericTypeReference)) { |
var typeRef = node; |
- var baseType = this.resolveType$2(typeRef.baseType, typeErrors); |
+ var baseType = this.resolveType(typeRef.baseType, typeErrors, allowTypeParams); |
if (!baseType.get$isGeneric()) { |
$globals.world.error(("" + baseType.get$name() + " is not generic"), typeRef.span); |
- return null; |
+ return $globals.world.varType; |
} |
if (typeRef.typeArguments.get$length() != baseType.get$typeParameters().get$length()) { |
$globals.world.error("wrong number of type arguments", typeRef.span); |
- return null; |
+ return $globals.world.varType; |
} |
var typeArgs = []; |
for (var i = (0); |
i < typeRef.typeArguments.get$length(); i++) { |
- typeArgs.add$1(this.resolveType$2(typeRef.typeArguments[i], typeErrors)); |
+ typeArgs.add(this.resolveType(typeRef.typeArguments[i], typeErrors, allowTypeParams)); |
} |
- typeRef.type = baseType.getOrMakeConcreteType$1(typeArgs); |
+ return baseType.getOrMakeConcreteType(typeArgs); |
} |
else if ((node instanceof FunctionTypeReference)) { |
var typeRef = node; |
@@ -2811,16 +2761,10 @@ Element.prototype.resolveType = function(node, typeErrors) { |
if (typeRef.func.name != null) { |
name = typeRef.func.name.name; |
} |
- typeRef.type = this.get$library().getOrAddFunctionType(this, name, typeRef.func); |
+ return this.get$library().getOrAddFunctionType(this, name, typeRef.func, null); |
} |
- else { |
- $globals.world.internalError("unknown type reference", node.span); |
- } |
- return node.type; |
+ $globals.world.internalError("unexpected TypeReference", node.span); |
} |
-Element.prototype.hashCode$0 = Element.prototype.hashCode; |
-Element.prototype.resolve$0 = Element.prototype.resolve; |
-Element.prototype.resolveType$2 = Element.prototype.resolveType; |
// ********** Code for ExistingJsGlobal ************** |
$inherits(ExistingJsGlobal, Element); |
function ExistingJsGlobal(name, declaringElement) { |
@@ -2847,10 +2791,37 @@ function WorldGenerator(main, writer) { |
this.globals = new HashMapImplementation(); |
this.writer = writer; |
} |
+WorldGenerator.prototype.get$writer = function() { return this.writer; }; |
+WorldGenerator.prototype.set$writer = function(value) { return this.writer = value; }; |
+WorldGenerator.prototype.analyze = function() { |
+ var nlibs = (0), ntypes = (0), nmems = (0), nnews = (0); |
+ var $$list = $globals.world.libraries.getValues(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var lib = $$i.next(); |
+ nlibs += (1); |
+ var $list0 = lib.get$types().getValues(); |
+ for (var $i0 = $list0.iterator(); $i0.hasNext(); ) { |
+ var type = $i0.next(); |
+ ntypes += (1); |
+ var allMembers = []; |
+ allMembers.addAll(type.get$constructors().getValues()); |
+ allMembers.addAll(type.get$members().getValues()); |
+ type.get$factories().forEach((function (allMembers, f) { |
+ return allMembers.add(f); |
+ }).bind(null, allMembers) |
+ ); |
+ for (var $i1 = allMembers.iterator(); $i1.hasNext(); ) { |
+ var m = $i1.next(); |
+ if (m.get$isAbstract() || !m.get$isMethod()) continue; |
+ m.get$methodData().analyze(); |
+ } |
+ } |
+ } |
+} |
WorldGenerator.prototype.run = function() { |
- var metaGen = new MethodGenerator(this.main, null); |
+ this.mainContext = new MethodGenerator(this.main, null); |
var mainTarget = new TypeValue(this.main.declaringType, this.main.get$span()); |
- var mainCall = this.main.invoke(metaGen, null, mainTarget, Arguments.get$EMPTY(), false); |
+ var mainCall = this.main.invoke(this.mainContext, null, mainTarget, Arguments.get$EMPTY()); |
this.main.declaringType.markUsed(); |
if ($globals.options.compileAll) { |
this.markLibrariesUsed([$globals.world.coreimpl, $globals.world.corelib, this.main.declaringType.get$library()]); |
@@ -2859,13 +2830,13 @@ WorldGenerator.prototype.run = function() { |
$globals.world.stringImplType.markUsed(); |
if ($globals.world.corelib.types.$index("Isolate").get$isUsed() || $globals.world.coreimpl.types.$index("ReceivePortImpl").get$isUsed()) { |
if (this.corejs.useWrap0 || this.corejs.useWrap1) { |
- this.genMethod($globals.world.coreimpl.types.$index("IsolateContext").getMember$1("eval")); |
- this.genMethod($globals.world.coreimpl.types.$index("EventLoop").getMember$1("run")); |
+ this.genMethod($globals.world.coreimpl.types.$index("IsolateContext").getMember("eval")); |
+ this.genMethod($globals.world.coreimpl.types.$index("EventLoop").getMember("run")); |
} |
this.corejs.useIsolates = true; |
var isolateMain = $globals.world.coreimpl.lookup("startRootIsolate", this.main.get$span()); |
var isolateMainTarget = new TypeValue($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); |
+ mainCall = isolateMain.invoke(this.mainContext, null, isolateMainTarget, new Arguments(null, [this.main._get(this.mainContext, this.main.definition, null)])); |
} |
this.writeTypes($globals.world.coreimpl); |
this.writeTypes($globals.world.corelib); |
@@ -2887,13 +2858,13 @@ WorldGenerator.prototype.markTypeUsed = function(type) { |
}) |
)); |
var members = ListFactory.ListFactory$from$factory(type.get$members().getValues()); |
- members.addAll$1(type.get$constructors().getValues()); |
+ members.addAll(type.get$constructors().getValues()); |
type.get$factories().forEach((function (f) { |
- return members.add$1(f); |
+ return members.add(f); |
}) |
); |
- for (var $$i = members.iterator$0(); $$i.hasNext$0(); ) { |
- var member = $$i.next$0(); |
+ for (var $$i = members.iterator(); $$i.hasNext(); ) { |
+ var member = $$i.next(); |
if ((member instanceof PropertyMember)) { |
if (member.get$getter() != null) this.genMethod(member.get$getter()); |
if (member.get$setter() != null) this.genMethod(member.get$setter()); |
@@ -2906,19 +2877,19 @@ WorldGenerator.prototype.get$markTypeUsed = function() { |
} |
WorldGenerator.prototype.getAllTypes = function(libs) { |
var types = []; |
- var seen = new HashSetImplementation(); |
- for (var $$i = 0;$$i < libs.get$length(); $$i++) { |
- var mainLib = libs[$$i]; |
+ var seen = new HashSetImplementation_Library(); |
+ for (var $$i = libs.iterator(); $$i.hasNext(); ) { |
+ var mainLib = $$i.next(); |
var toCheck = DoubleLinkedQueue.DoubleLinkedQueue$from$factory([mainLib]); |
while (!toCheck.isEmpty()) { |
var lib = toCheck.removeFirst(); |
if (seen.contains(lib)) continue; |
seen.add(lib); |
- lib.get$imports().forEach$1((function (lib, toCheck, i) { |
+ lib.get$imports().forEach((function (lib, toCheck, i) { |
return toCheck.addLast(lib); |
}).bind(null, lib, toCheck) |
); |
- lib.get$types().getValues$0().forEach$1((function (t) { |
+ lib.get$types().getValues().forEach((function (t) { |
return types.add(t); |
}) |
); |
@@ -2937,11 +2908,11 @@ WorldGenerator.prototype.globalForStaticField = function(field, exp, dependencie |
return ret; |
} |
WorldGenerator.prototype.globalForConst = function(exp, dependencies) { |
- var key = exp.get$type().get$jsname() + ":" + exp.get$code(); |
+ var key = $add($add(exp.get$type().get$jsname(), ":"), exp.get$code()); |
var ret = this.globals.$index(key); |
if (ret == null) { |
var ns = this.globals.get$length().toString$0(); |
- while (ns.get$length() < (4)) ns = "0" + ns; |
+ while (ns.get$length() < (4)) ns = $add("0", ns); |
var name = ("const$" + ns); |
ret = new GlobalValue(exp.get$type(), name, true, null, name, exp, exp.span, dependencies); |
this.globals.$setindex(key, ret); |
@@ -2952,13 +2923,13 @@ WorldGenerator.prototype.writeTypes = function(lib) { |
if (lib.isWritten) return; |
lib.isWritten = true; |
var $$list = lib.imports; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var import_ = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var import_ = $$i.next(); |
this.writeTypes(import_.get$library()); |
} |
for (var i = (0); |
i < lib.sources.get$length(); i++) { |
- lib.sources[i].set$orderInLibrary(i); |
+ lib.sources[i].orderInLibrary = i; |
} |
this.writer.comment(("// ********** Library " + lib.name + " **************")); |
if (lib.get$isCore()) { |
@@ -2966,29 +2937,29 @@ WorldGenerator.prototype.writeTypes = function(lib) { |
this.corejs.generate(this.writer); |
} |
var $$list = lib.natives; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var file = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var file = $$i.next(); |
var filename = basename(file.get$filename()); |
this.writer.comment(("// ********** Natives " + filename + " **************")); |
this.writer.writeln(file.get$text()); |
} |
lib.topType.markUsed(); |
var orderedTypes = this._orderValues(lib.types); |
- for (var $$i = orderedTypes.iterator$0(); $$i.hasNext$0(); ) { |
- var type = $$i.next$0(); |
+ for (var $$i = orderedTypes.iterator(); $$i.hasNext(); ) { |
+ var type = $$i.next(); |
if ((type.get$library().get$isDom() || type.get$isHiddenNativeType()) && type.get$isClass()) { |
- type.markUsed$0(); |
+ type.markUsed(); |
} |
} |
- for (var $$i = orderedTypes.iterator$0(); $$i.hasNext$0(); ) { |
- var type = $$i.next$0(); |
+ for (var $$i = orderedTypes.iterator(); $$i.hasNext(); ) { |
+ var type = $$i.next(); |
if (type.get$isUsed() && type.get$isClass()) { |
this.writeType(type); |
- if (type.get$isGeneric()) { |
+ if (type.get$isGeneric() && type != $globals.world.listFactoryType) { |
var $$list = this._orderValues(type.get$_concreteTypes()); |
- for (var $i0 = 0;$i0 < $$list.get$length(); $i0++) { |
- var ct = $$list[$i0]; |
- this.writeType(ct); |
+ for (var $i0 = $$list.iterator(); $i0.hasNext(); ) { |
+ var ct = $i0.next(); |
+ if (ct.get$isUsed()) this.writeType(ct); |
} |
} |
} |
@@ -3001,10 +2972,8 @@ WorldGenerator.prototype.writeTypes = function(lib) { |
} |
} |
} |
-WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) { |
- if (!meth.isGenerated && !meth.get$isAbstract() && meth.get$definition() != null) { |
- new MethodGenerator(meth, enclosingMethod).run(); |
- } |
+WorldGenerator.prototype.genMethod = function(meth) { |
+ meth.get$methodData().run(meth); |
} |
WorldGenerator.prototype._prototypeOf = function(type, name) { |
if (type.get$isSingletonNative()) { |
@@ -3013,13 +2982,14 @@ WorldGenerator.prototype._prototypeOf = function(type, name) { |
else if (type.get$isHiddenNativeType()) { |
this.corejs.ensureDynamicProto(); |
this._usedDynamicDispatchOnType(type); |
- return ("$dynamic(\"" + name + "\")." + type.get$definition().get$nativeType().get$name()); |
+ return ("$dynamic(\"" + name + "\")." + type.get$definition().get$nativeType().name); |
} |
else { |
return ("" + type.get$jsname() + ".prototype." + name); |
} |
} |
WorldGenerator.prototype._writePrototypePatch = function(type, name, functionBody, writer, isOneLiner) { |
+ var $0; |
var writeFunction = writer.get$writeln(); |
var ending = ";"; |
if (!isOneLiner) { |
@@ -3027,18 +2997,18 @@ WorldGenerator.prototype._writePrototypePatch = function(type, name, functionBod |
ending = ""; |
} |
if (type.get$isObject()) { |
- $globals.world.counters.objectProtoMembers++; |
+ ($0 = $globals.world.counters).objectProtoMembers = $0.objectProtoMembers + (1); |
} |
if (type.get$isObject() || $eq(type.get$genericType(), $globals.world.listFactoryType)) { |
if (isOneLiner) { |
- ending = ", enumerable: false, writable: true, configurable: true })" + ending; |
+ ending = $add(", enumerable: false, writable: true, configurable: true })", ending); |
} |
- writeFunction.call$1(("Object.defineProperty(" + type.get$jsname() + ".prototype, \"" + name + "\",") + (" { value: " + functionBody + ending)); |
+ writeFunction.call$1($add(("Object.defineProperty(" + type.get$jsname() + ".prototype, \"" + name + "\","), (" { value: " + functionBody + ending))); |
if (isOneLiner) return "}"; |
return "}, enumerable: false, writable: true, configurable: true });"; |
} |
else { |
- writeFunction.call$1(this._prototypeOf(type, name) + " = " + functionBody + ending); |
+ writeFunction.call$1($add($add($add(this._prototypeOf(type, name), " = "), functionBody), ending)); |
return isOneLiner ? "" : "}"; |
} |
} |
@@ -3065,14 +3035,10 @@ WorldGenerator.prototype.writeType = function(type) { |
if (type.get$parent() != null && !type.get$isNative()) { |
this.writeType(type.get$parent()); |
} |
- if (type.name != null && (type instanceof ConcreteType) && $eq(type.get$library(), $globals.world.coreimpl) && type.name.startsWith("ListFactory")) { |
- this.writer.writeln(("" + type.get$jsname() + " = " + type.get$genericType().get$jsname() + ";")); |
- return; |
- } |
var typeName = type.get$jsname() != null ? type.get$jsname() : "top level"; |
this.writer.comment(("// ********** Code for " + typeName + " **************")); |
- if (type.get$isNative() && !type.get$isTop()) { |
- var nativeName = type.get$definition().get$nativeType().get$name(); |
+ if (type.get$isNative() && !type.get$isTop() && !type.get$isConcreteGeneric()) { |
+ var nativeName = type.get$definition().get$nativeType().name; |
if ($eq(nativeName, "")) { |
this.writer.writeln(("function " + type.get$jsname() + "() {}")); |
} |
@@ -3088,15 +3054,9 @@ WorldGenerator.prototype.writeType = function(type) { |
} |
} |
if (!type.get$isTop()) { |
- if ((type instanceof ConcreteType)) { |
- var c = type; |
+ if (type.get$genericType() != type) { |
this.corejs.ensureInheritsHelper(); |
- this.writer.writeln(("$inherits(" + c.get$jsname() + ", " + c.genericType.get$jsname() + ");")); |
- for (var p = c._parent; |
- (p instanceof ConcreteType); p = p.get$_parent()) { |
- this._ensureInheritMembersHelper(); |
- this._mixins.writeln(("$inheritsMembers(" + c.get$jsname() + ", " + p.get$jsname() + ");")); |
- } |
+ this.writer.writeln(("$inherits(" + type.get$jsname() + ", " + type.get$genericType().get$jsname() + ");")); |
} |
else if (!type.get$isNative()) { |
if (type.get$parent() != null && !type.get$parent().get$isObject()) { |
@@ -3108,67 +3068,62 @@ WorldGenerator.prototype.writeType = function(type) { |
if (type.get$isTop()) { |
} |
else if (type.get$constructors().get$length() == (0)) { |
- if (!type.get$isNative()) { |
+ if (!type.get$isNative() || type.get$isConcreteGeneric()) { |
this.writer.writeln(("function " + type.get$jsname() + "() {}")); |
} |
} |
else { |
- var standardConstructor = type.get$constructors().$index(""); |
- if (standardConstructor == null || standardConstructor.generator == null) { |
- if (!type.get$isNative()) { |
- this.writer.writeln(("function " + type.get$jsname() + "() {}")); |
- } |
- } |
- else { |
- standardConstructor.generator.writeDefinition(this.writer, null); |
- } |
+ var wroteStandard = false; |
var $$list = type.get$constructors().getValues(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var c = $$i.next$0(); |
- if (c.get$generator() != null && $ne(c, standardConstructor)) { |
- c.get$generator().writeDefinition$2(this.writer); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var c = $$i.next(); |
+ if (c.get$methodData().writeDefinition(c, this.writer)) { |
+ if (c.get$isConstructor() && c.get$constructorName() == "") wroteStandard = true; |
} |
} |
+ if (!wroteStandard && (!type.get$isNative() || type.get$genericType() != type)) { |
+ this.writer.writeln(("function " + type.get$jsname() + "() {}")); |
+ } |
} |
- if (!(type instanceof ConcreteType)) { |
+ if (!type.get$isConcreteGeneric()) { |
this._maybeIsTest(type, type); |
} |
if (type.get$genericType()._concreteTypes != null) { |
var $$list = this._orderValues(type.get$genericType()._concreteTypes); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var ct = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var ct = $$i.next(); |
this._maybeIsTest(type, ct); |
} |
} |
if (type.get$interfaces() != null) { |
var seen = new HashSetImplementation(); |
var worklist = []; |
- worklist.addAll$1(type.get$interfaces()); |
- seen.addAll$1(type.get$interfaces()); |
- while (!worklist.isEmpty$0()) { |
- var interface_ = worklist.removeLast$0(); |
+ worklist.addAll(type.get$interfaces()); |
+ seen.addAll(type.get$interfaces()); |
+ while (!worklist.isEmpty()) { |
+ var interface_ = worklist.removeLast(); |
this._maybeIsTest(type, interface_.get$genericType()); |
- if (interface_.get$genericType().get$_concreteTypes() != null) { |
- var $$list = this._orderValues(interface_.get$genericType().get$_concreteTypes()); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var ct = $$list[$$i]; |
+ if (interface_.get$genericType()._concreteTypes != null) { |
+ var $$list = this._orderValues(interface_.get$genericType()._concreteTypes); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var ct = $$i.next(); |
this._maybeIsTest(type, ct); |
} |
} |
var $$list = interface_.get$interfaces(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var other = $$i.next$0(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var other = $$i.next(); |
if (!seen.contains$1(other)) { |
- worklist.addLast$1(other); |
- seen.add$1(other); |
+ worklist.addLast(other); |
+ seen.add(other); |
} |
} |
} |
} |
type.get$factories().forEach(this.get$_writeMethod()); |
var $$list = this._orderValues(type.get$members()); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var member = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var member = $$i.next(); |
if ((member instanceof FieldMember)) { |
this._writeField(member); |
} |
@@ -3182,30 +3137,13 @@ WorldGenerator.prototype.writeType = function(type) { |
this._writeDynamicStubs(type); |
} |
WorldGenerator.prototype._typeNeedsHolderForStaticMethods = function(type) { |
- var $$list = type.get$members().getValues(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var member = $$i.next$0(); |
- if (member.get$isMethod()) { |
- if (member.get$isConstructor() || member.get$isStatic()) { |
- if (member.get$isGenerated()) { |
- return true; |
- } |
- } |
- } |
- } |
- return false; |
-} |
-WorldGenerator.prototype._ensureInheritMembersHelper = function() { |
- if (this._mixins != null) return; |
- this._mixins = new CodeWriter(); |
- this._mixins.comment("// ********** Generic Type Inheritance **************"); |
- this._mixins.writeln("/** Implements extends for generic types. */\nfunction $inheritsMembers(child, parent) {\n child = child.prototype;\n parent = parent.prototype;\n Object.getOwnPropertyNames(parent).forEach(function(name) {\n if (typeof(child[name]) == 'undefined') child[name] = parent[name];\n });\n}"); |
+ return type.get$isUsed(); |
} |
WorldGenerator.prototype._writeDynamicStubs = function(type) { |
var $$list = orderValuesByKeys(type.varStubs); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var stub = $$list[$$i]; |
- if (!stub.get$isGenerated()) stub.generate$1(this.writer); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var stub = $$i.next(); |
+ if (!stub.get$isGenerated()) stub.generate(this.writer); |
} |
} |
WorldGenerator.prototype._writeStaticField = function(field) { |
@@ -3217,7 +3155,7 @@ WorldGenerator.prototype._writeStaticField = function(field) { |
this.writer.writeln(("$globals." + field.get$jsname() + " = " + value.get$exp().get$code() + ";")); |
} |
else { |
- this.writer.writeln(("$globals." + field.declaringType.get$jsname() + "_" + field.get$jsname()) + (" = " + value.get$exp().get$code() + ";")); |
+ this.writer.writeln($add(("$globals." + field.declaringType.get$jsname() + "_" + field.get$jsname()), (" = " + value.get$exp().get$code() + ";"))); |
} |
} |
} |
@@ -3225,7 +3163,7 @@ WorldGenerator.prototype._writeField = function(field) { |
if (field.declaringType.get$isTop() && !field.isNative && field.value == null) { |
this.writer.writeln(("var " + field.get$jsname() + ";")); |
} |
- if (field._providePropertySyntax) { |
+ if (field._providePropertySyntax && !field.declaringType.get$isConcreteGeneric()) { |
this._writePrototypePatch(field.declaringType, ("get$" + field.get$jsname()), ("function() { return this." + field.get$jsname() + "; }"), this.writer, true); |
if (!field.isFinal) { |
this._writePrototypePatch(field.declaringType, ("set$" + field.get$jsname()), ("function(value) { return this." + field.get$jsname() + " = value; }"), this.writer, true); |
@@ -3235,8 +3173,8 @@ WorldGenerator.prototype._writeField = function(field) { |
WorldGenerator.prototype._writeProperty = function(property) { |
if (property.getter != null) this._writeMethod(property.getter); |
if (property.setter != null) this._writeMethod(property.setter); |
- if (property._provideFieldSyntax) { |
- this.writer.enterBlock("Object.defineProperty(" + ("" + property.declaringType.get$jsname() + ".prototype, \"" + property.get$jsname() + "\", {")); |
+ if (property.get$needsFieldSyntax()) { |
+ this.writer.enterBlock($add("Object.defineProperty(", ("" + property.declaringType.get$jsname() + ".prototype, \"" + property.get$jsname() + "\", {"))); |
if (property.getter != null) { |
this.writer.write(("get: " + property.declaringType.get$jsname() + ".prototype." + property.getter.get$jsname())); |
this.writer.writeln(property.setter == null ? "" : ","); |
@@ -3248,10 +3186,8 @@ WorldGenerator.prototype._writeProperty = function(property) { |
} |
} |
WorldGenerator.prototype._writeMethod = function(m) { |
- if (m.generator != null) { |
- m.generator.writeDefinition(this.writer, null); |
- } |
- else if ((m instanceof MethodMember) && m.get$isNative() && m._providePropertySyntax && !m._provideFieldSyntax) { |
+ m.get$methodData().writeDefinition(m, this.writer); |
+ if (m.get$isNative() && m._providePropertySyntax) { |
MethodGenerator._maybeGenerateBoundGetter(m, this.writer); |
} |
} |
@@ -3262,20 +3198,20 @@ WorldGenerator.prototype.writeGlobals = function() { |
if (this.globals.get$length() > (0)) { |
this.writer.comment("// ********** Globals **************"); |
var list = this.globals.getValues(); |
- list.sort$1((function (a, b) { |
- return a.compareTo$1(b); |
+ list.sort((function (a, b) { |
+ return a.compareTo(b); |
}) |
); |
this.writer.enterBlock("function $static_init(){"); |
- for (var $$i = list.iterator$0(); $$i.hasNext$0(); ) { |
- var global = $$i.next$0(); |
+ for (var $$i = list.iterator(); $$i.hasNext(); ) { |
+ var global = $$i.next(); |
if (global.get$field() != null) { |
this._writeStaticField(global.get$field()); |
} |
} |
this.writer.exitBlock("}"); |
- for (var $$i = list.iterator$0(); $$i.hasNext$0(); ) { |
- var global = $$i.next$0(); |
+ for (var $$i = list.iterator(); $$i.hasNext(); ) { |
+ var global = $$i.next(); |
if (global.get$field() == null) { |
this.writer.writeln(("var " + global.get$name() + " = " + global.get$exp().get$code() + ";")); |
} |
@@ -3302,26 +3238,26 @@ WorldGenerator.prototype.writeDynamicDispatchMetadata = function() { |
var types = []; |
function visit(type) { |
if (seen.contains$1(type)) return; |
- seen.add$1(type); |
+ seen.add(type); |
var $$list = $this._orderCollectionValues(type.get$directSubtypes()); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var subtype = $$list[$$i]; |
- visit.call$1(subtype); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var subtype = $$i.next(); |
+ visit(subtype); |
} |
- types.add$1(type); |
+ types.add(type); |
} |
var $$list = this._orderCollectionValues(this.typesWithDynamicDispatch); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var type = $$list[$$i]; |
- visit.call$1(type); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var type = $$i.next(); |
+ visit(type); |
} |
- var dispatchTypes = types.filter$1((function (type) { |
- return !type.get$directSubtypes().isEmpty$0() && $this.typesWithDynamicDispatch.contains(type); |
+ var dispatchTypes = types.filter((function (type) { |
+ return !type.get$directSubtypes().isEmpty() && $this.typesWithDynamicDispatch.contains(type); |
}) |
); |
this.writer.comment(("// " + types.get$length() + " types")); |
- this.writer.comment(("// " + types.filter$1((function (t) { |
- return !t.get$directSubtypes().isEmpty$0(); |
+ this.writer.comment(("// " + types.filter((function (t) { |
+ return !t.get$directSubtypes().isEmpty(); |
}) |
).get$length() + " !leaf")); |
var varNames = []; |
@@ -3332,33 +3268,33 @@ WorldGenerator.prototype.writeDynamicDispatchMetadata = function() { |
var subtags = [type.get$nativeName()]; |
function walk(type) { |
var $$list = $this._orderCollectionValues(type.get$directSubtypes()); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var subtype = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var subtype = $$i.next(); |
var tag = subtype.get$nativeName(); |
var existing = tagDefns.$index(tag); |
- if (existing == null) { |
- subtags.add$1(tag); |
- walk.call$1(subtype); |
+ if ($eq(existing)) { |
+ subtags.add(tag); |
+ walk(subtype); |
} |
else { |
- if (varDefns.containsKey$1(existing)) { |
- expressions.add$1(existing); |
+ if (varDefns.containsKey(existing)) { |
+ expressions.add(existing); |
} |
else { |
var varName = ("v" + varNames.get$length() + "/*" + tag + "*/"); |
- varNames.add$1(varName); |
+ varNames.add(varName); |
varDefns.$setindex(varName, existing); |
tagDefns.$setindex(tag, varName); |
- expressions.add$1(varName); |
+ expressions.add(varName); |
} |
} |
} |
} |
- walk.call$1(type); |
+ walk(type); |
var constantPart = ("'" + Strings.join(subtags, "|") + "'"); |
- if ($ne(constantPart, "''")) expressions.add$1(constantPart); |
+ if ($ne(constantPart, "''")) expressions.add(constantPart); |
var expression; |
- if ($eq(expressions.get$length(), (1))) { |
+ if (expressions.get$length() == (1)) { |
expression = expressions.$index((0)); |
} |
else { |
@@ -3366,20 +3302,20 @@ WorldGenerator.prototype.writeDynamicDispatchMetadata = function() { |
} |
return expression; |
} |
- for (var $$i = dispatchTypes.iterator$0(); $$i.hasNext$0(); ) { |
- var type = $$i.next$0(); |
- tagDefns.$setindex(type.get$nativeName(), makeExpression.call$1(type)); |
+ for (var $$i = dispatchTypes.iterator(); $$i.hasNext(); ) { |
+ var type = $$i.next(); |
+ tagDefns.$setindex(type.get$nativeName(), makeExpression(type)); |
} |
- if (!tagDefns.isEmpty$0()) { |
+ if (!tagDefns.isEmpty()) { |
this.writer.enterBlock("(function(){"); |
- for (var $$i = varNames.iterator$0(); $$i.hasNext$0(); ) { |
- var varName = $$i.next$0(); |
+ for (var $$i = varNames.iterator(); $$i.hasNext(); ) { |
+ var varName = $$i.next(); |
this.writer.writeln(("var " + varName + " = " + varDefns.$index(varName) + ";")); |
} |
this.writer.enterBlock("var table = ["); |
this.writer.comment("// [dynamic-dispatch-tag, tags of classes implementing dynamic-dispatch-tag]"); |
- for (var $$i = dispatchTypes.iterator$0(); $$i.hasNext$0(); ) { |
- var type = $$i.next$0(); |
+ for (var $$i = dispatchTypes.iterator(); $$i.hasNext(); ) { |
+ var type = $$i.next(); |
this.writer.writeln(("['" + type.get$nativeName() + "', " + tagDefns.$index(type.get$nativeName()) + "],")); |
} |
this.writer.exitBlock("];"); |
@@ -3399,12 +3335,12 @@ 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()); |
+ var spans = x.get$span().compareTo(y.get$span()); |
if (spans != (0)) return spans; |
} |
if (x.get$span() == null) return (1); |
if (y.get$span() == null) return (-1); |
- return x.get$name().compareTo$1(y.get$name()); |
+ return x.get$name().compareTo(y.get$name()); |
} |
WorldGenerator.prototype.get$_compareMembers = function() { |
return this._compareMembers.bind(this); |
@@ -3429,18 +3365,30 @@ function MethodGenerator(method, enclosingMethod) { |
} |
MethodGenerator.prototype.get$method = function() { return this.method; }; |
MethodGenerator.prototype.set$method = function(value) { return this.method = value; }; |
+MethodGenerator.prototype.get$writer = function() { return this.writer; }; |
+MethodGenerator.prototype.set$writer = function(value) { return this.writer = value; }; |
MethodGenerator.prototype.get$_scope = function() { return this._scope; }; |
MethodGenerator.prototype.set$_scope = function(value) { return this._scope = value; }; |
MethodGenerator.prototype.get$enclosingMethod = function() { return this.enclosingMethod; }; |
MethodGenerator.prototype.set$enclosingMethod = function(value) { return this.enclosingMethod = value; }; |
MethodGenerator.prototype.get$needsThis = function() { return this.needsThis; }; |
MethodGenerator.prototype.set$needsThis = function(value) { return this.needsThis = value; }; |
+MethodGenerator.prototype.get$_paramCode = function() { return this._paramCode; }; |
+MethodGenerator.prototype.set$_paramCode = function(value) { return this._paramCode = value; }; |
+MethodGenerator.prototype.get$counters = function() { return this.counters; }; |
+MethodGenerator.prototype.set$counters = function(value) { return this.counters = value; }; |
MethodGenerator.prototype.get$library = function() { |
return this.method.get$library(); |
} |
MethodGenerator.prototype.findMembers = function(name) { |
return this.get$library()._findMembers(name); |
} |
+MethodGenerator.prototype.get$needsCode = function() { |
+ return true; |
+} |
+MethodGenerator.prototype.get$showWarnings = function() { |
+ return false; |
+} |
MethodGenerator.prototype.get$isClosure = function() { |
return (this.enclosingMethod != null); |
} |
@@ -3473,50 +3421,34 @@ MethodGenerator.prototype.freeTemp = function(value) { |
} |
MethodGenerator.prototype.run = function() { |
- if (this.method.isGenerated) return; |
- this.method.isGenerated = true; |
- this.method.generator = this; |
var thisObject; |
if (this.method.get$isConstructor()) { |
thisObject = new ObjectValue(false, this.method.declaringType, this.method.get$span()); |
- thisObject.initFields$0(); |
+ thisObject.initFields(); |
} |
else { |
thisObject = new Value(this.method.declaringType, "this", null); |
} |
var values = []; |
var $$list = this.method.get$parameters(); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var p = $$list[$$i]; |
- values.add$1(new Value(p.get$type(), p.get$name(), null)); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var p = $$i.next(); |
+ values.add(new Value(p.get$type(), p.get$name(), null)); |
} |
var args = new Arguments(null, values); |
this.evalBody(thisObject, args); |
- if (this.method.get$definition().get$nativeBody() != null) { |
- this.writer = new CodeWriter(); |
- if ($eq(this.method.get$definition().get$nativeBody(), "")) { |
- this.method.generator = null; |
- } |
- else { |
- this._paramCode = map(this.method.get$parameters(), (function (p) { |
- return p.get$name(); |
- }) |
- ); |
- this.writer.write(this.method.get$definition().get$nativeBody()); |
- } |
- } |
} |
MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) { |
var paramCode = this._paramCode; |
var names = null; |
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); |
+ names.sort((function (x, y) { |
+ return x.compareTo(y); |
}) |
); |
paramCode = ListFactory.ListFactory$from$factory(names); |
- paramCode.addAll$1(this._paramCode); |
+ paramCode.addAll(this._paramCode); |
} |
var _params = ("(" + Strings.join(this._paramCode, ", ") + ")"); |
var params = ("(" + Strings.join(paramCode, ", ") + ")"); |
@@ -3528,7 +3460,7 @@ MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) { |
if (this.method.name == "") { |
defWriter.enterBlock(("(function " + params + " {")); |
} |
- else if (names != null) { |
+ else if ($ne(names)) { |
if (lambda == null) { |
defWriter.enterBlock(("var " + this.method.get$jsname() + " = (function" + params + " {")); |
} |
@@ -3563,13 +3495,13 @@ MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) { |
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); |
+ return x.compareTo(y); |
}) |
); |
defWriter.writeln(("var " + Strings.join(this._freeTemps, ", ") + ";")); |
} |
defWriter.writeln(this.writer.get$text()); |
- if (names != null) { |
+ if ($ne(names)) { |
defWriter.exitBlock(("}).bind(null, " + Strings.join(names, ", ") + ")")); |
} |
else if (this.get$isClosure() && this.method.name == "") { |
@@ -3579,7 +3511,7 @@ MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) { |
defWriter.exitBlock(suffix); |
} |
if (this.method.get$isConstructor() && this.method.get$constructorName() != "") { |
- defWriter.writeln(("" + this.method.declaringType.get$jsname() + "." + this.method.get$constructorName() + "$ctor.prototype = ") + ("" + this.method.declaringType.get$jsname() + ".prototype;")); |
+ defWriter.writeln($add(("" + this.method.declaringType.get$jsname() + "." + this.method.get$constructorName() + "$ctor.prototype = "), ("" + this.method.declaringType.get$jsname() + ".prototype;"))); |
} |
this._provideOptionalParamInfo(defWriter); |
if ((this.method instanceof MethodMember)) { |
@@ -3588,12 +3520,9 @@ MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) { |
} |
MethodGenerator._maybeGenerateBoundGetter = function(m, defWriter) { |
if (m._providePropertySyntax) { |
- var suffix = $globals.world.gen._writePrototypePatch(m.declaringType, "get$" + m.get$jsname(), "function() {", defWriter, false); |
+ var suffix = $globals.world.gen._writePrototypePatch(m.declaringType, $add("get$", m.get$jsname()), "function() {", defWriter, false); |
defWriter.writeln(("return this." + m.get$jsname() + ".bind(this);")); |
defWriter.exitBlock(suffix); |
- if (m._provideFieldSyntax) { |
- $globals.world.internalError(("bound \"" + m.name + "\" accessed with field syntax"), m.definition.span); |
- } |
} |
} |
MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) { |
@@ -3602,27 +3531,27 @@ MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) { |
if (meth._provideOptionalParamInfo) { |
var optNames = []; |
var optValues = []; |
- meth.genParameterValues(); |
+ meth.genParameterValues(this); |
var $$list = meth.parameters; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var param = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var param = $$i.next(); |
if (param.get$isOptional()) { |
- optNames.add$1(param.get$name()); |
- optValues.add$1(MethodGenerator._escapeString(param.get$value().get$code())); |
+ optNames.add(param.get$name()); |
+ optValues.add(MethodGenerator._escapeString(param.get$value().get$code())); |
} |
} |
if (optNames.get$length() > (0)) { |
var start = ""; |
if (meth.isStatic) { |
if (!meth.declaringType.get$isTop()) { |
- start = meth.declaringType.get$jsname() + "."; |
+ start = $add(meth.declaringType.get$jsname(), "."); |
} |
} |
else { |
- start = meth.declaringType.get$jsname() + ".prototype."; |
+ start = $add(meth.declaringType.get$jsname(), ".prototype."); |
} |
- optNames.addAll$1(optValues); |
- var optional = "['" + Strings.join(optNames, "', '") + "']"; |
+ optNames.addAll(optValues); |
+ var optional = $add($add("['", Strings.join(optNames, "', '")), "']"); |
defWriter.writeln(("" + start + meth.get$jsname() + ".$optional = " + optional)); |
} |
} |
@@ -3630,7 +3559,7 @@ MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) { |
} |
MethodGenerator.prototype._initField = function(newObject, name, value, span) { |
var field = this.method.declaringType.getMember(name); |
- if (field == null) { |
+ if ($eq(field)) { |
$globals.world.error("bad initializer - no matching field", span); |
} |
if (!field.get$isField()) { |
@@ -3649,12 +3578,12 @@ MethodGenerator.prototype.evalBody = function(newObject, args) { |
var p = this.method.get$parameters()[i]; |
var currentArg = null; |
if (i < args.get$bareCount()) { |
- currentArg = args.values[i]; |
+ currentArg = args.values.$index(i); |
} |
else { |
currentArg = args.getValue(p.get$name()); |
if (currentArg == null) { |
- p.genValue$2(this.method, this.method.generator); |
+ p.genValue(this.method, this); |
currentArg = p.get$value(); |
} |
} |
@@ -3667,22 +3596,22 @@ MethodGenerator.prototype.evalBody = function(newObject, args) { |
var paramValue = this._scope.declareParameter(p); |
this._paramCode.add(paramValue.get$code()); |
if (newObject != null && newObject.get$isConst()) { |
- this._scope.assign(p.get$name(), currentArg.convertTo(this, p.get$type(), false)); |
+ this._scope.assign(p.get$name(), currentArg.convertTo(this, p.get$type())); |
} |
} |
} |
var initializerCall = null; |
- var declaredInitializers = this.method.get$definition().get$initializers(); |
- if (declaredInitializers != null) { |
- for (var $$i = declaredInitializers.iterator$0(); $$i.hasNext$0(); ) { |
- var init = $$i.next$0(); |
+ var declaredInitializers = this.method.get$definition().get$dynamic().get$initializers(); |
+ if ($ne(declaredInitializers)) { |
+ for (var $$i = declaredInitializers.iterator(); $$i.hasNext(); ) { |
+ var init = $$i.next(); |
if ((init instanceof CallExpression)) { |
- if (initializerCall != null) { |
+ if ($ne(initializerCall)) { |
$globals.world.error("only one initializer redirecting call is allowed", init.get$span()); |
} |
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().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()); |
@@ -3697,24 +3626,24 @@ MethodGenerator.prototype.evalBody = function(newObject, args) { |
} |
} |
} |
- if (this.method.get$isConstructor() && initializerCall == null && !this.method.get$isNative()) { |
+ if (this.method.get$isConstructor() && $eq(initializerCall) && !this.method.get$isNative()) { |
var parentType = this.method.declaringType.get$parent(); |
- if (parentType != null && !parentType.get$isObject()) { |
+ if ($ne(parentType) && !parentType.get$isObject()) { |
initializerCall = new CallExpression(new SuperExpression(this.method.get$span()), [], this.method.get$span()); |
} |
} |
if (this.method.get$isConstructor() && (newObject instanceof ObjectValue)) { |
var fields = newObject.get$dynamic().get$fields(); |
- var $$list = fields.getKeys$0(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var field = $$i.next$0(); |
+ var $$list = fields.getKeys(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var field = $$i.next(); |
var value = fields.$index(field); |
if (value != null) { |
this.writer.writeln(("this." + field.get$jsname() + " = " + value.get$code() + ";")); |
} |
} |
} |
- if (initializerCall != null) { |
+ if ($ne(initializerCall)) { |
this.evalInitializerCall(newObject, initializerCall, fieldsSet); |
} |
if (this.method.get$isConstructor() && newObject != null && newObject.get$isConst()) { |
@@ -3722,16 +3651,16 @@ MethodGenerator.prototype.evalBody = function(newObject, args) { |
} |
else if (this.method.get$isConstructor()) { |
var fields = newObject.get$dynamic().get$fields(); |
- var $$list = fields.getKeys$0(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var field = $$i.next$0(); |
+ var $$list = fields.getKeys(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var field = $$i.next(); |
var value = fields.$index(field); |
if (value == null && field.get$isFinal() && $eq(field.get$declaringType(), this.method.declaringType) && !newObject.get$dynamic().get$seenNativeInitializer()) { |
$globals.world.error(("uninitialized final field \"" + field.get$name() + "\""), field.get$span(), this.method.get$span()); |
} |
} |
} |
- var body = this.method.get$definition().get$body(); |
+ var body = this.method.get$definition().get$dynamic().get$body(); |
if (body == null) { |
if (!this.method.get$isConstructor() && !this.method.get$isNative()) { |
$globals.world.error(("unexpected empty body for " + this.method.name), this.method.get$definition().get$span()); |
@@ -3765,13 +3694,13 @@ MethodGenerator.prototype.evalInitializerCall = function(newObject, node, fields |
else { |
$globals.world.error("bad call in initializers", node.span); |
} |
- var m = targetType.getConstructor$1(contructorName); |
- if (m == null) { |
+ var m = targetType.getConstructor(contructorName); |
+ if ($eq(m)) { |
$globals.world.error(("no matching constructor for " + targetType.name), node.span); |
} |
this.method.set$initDelegate(m); |
var other = m; |
- while (other != null) { |
+ while ($ne(other)) { |
if ($eq(other, this.method)) { |
$globals.world.error("initialization cycle", node.span); |
break; |
@@ -3780,9 +3709,9 @@ MethodGenerator.prototype.evalInitializerCall = function(newObject, node, fields |
} |
var newArgs = this._makeArgs(node.arguments); |
$globals.world.gen.genMethod(m); |
- m._evalConstConstructor$2(newObject, newArgs); |
+ m._evalConstConstructor(newObject, newArgs); |
if (!newObject.isConst) { |
- var value = m.invoke$4(this, node, target, newArgs); |
+ var value = m.invoke(this, node, target, newArgs); |
if ($ne(target.get$type(), $globals.world.objectType)) { |
this.writer.writeln(("" + value.get$code() + ";")); |
} |
@@ -3791,15 +3720,15 @@ MethodGenerator.prototype.evalInitializerCall = function(newObject, node, fields |
MethodGenerator.prototype._makeArgs = function(arguments) { |
var args = []; |
var seenLabel = false; |
- for (var $$i = 0;$$i < arguments.get$length(); $$i++) { |
- var arg = arguments[$$i]; |
+ for (var $$i = arguments.iterator(); $$i.hasNext(); ) { |
+ var arg = $$i.next(); |
if (arg.get$label() != null) { |
seenLabel = true; |
} |
else if (seenLabel) { |
$globals.world.error("bare argument can not follow named arguments", arg.get$span()); |
} |
- args.add$1(this.visitValue(arg.get$value())); |
+ args.add(this.visitValue(arg.get$value())); |
} |
return new Arguments(arguments, args); |
} |
@@ -3809,7 +3738,7 @@ MethodGenerator.prototype._invokeNative = function(name, arguments) { |
args = new Arguments(null, arguments); |
} |
var method = $globals.world.corelib.topType.members.$index(name); |
- return method.invoke$4(this, method.get$definition(), new Value($globals.world.corelib.topType, null, null), args); |
+ return method.invoke(this, method.get$definition(), new Value($globals.world.corelib.topType, null, null), args); |
} |
MethodGenerator._escapeString = function(text) { |
return text.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\n", "\\n").replaceAll("\r", "\\r"); |
@@ -3818,9 +3747,9 @@ MethodGenerator.prototype.visitStatementsInBlock = function(body) { |
if ((body instanceof BlockStatement)) { |
var block = body; |
var $$list = block.body; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var stmt = $$list[$$i]; |
- stmt.visit$1(this); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var stmt = $$i.next(); |
+ stmt.visit(this); |
} |
} |
else { |
@@ -3834,9 +3763,9 @@ MethodGenerator.prototype._pushBlock = function(node, reentrant) { |
MethodGenerator.prototype._popBlock = function(node) { |
if (this._scope.node != node) { |
function spanOf(n) { |
- return n != null ? n.get$span() : null; |
+ return $ne(n) ? n.get$span() : null; |
} |
- $globals.world.internalError(("scope mismatch. Trying to pop \"" + node + "\" but found ") + (" \"" + this._scope.node + "\""), spanOf.call$1(node), spanOf.call$1(this._scope.node)); |
+ $globals.world.internalError($add(("scope mismatch. Trying to pop \"" + node + "\" but found "), (" \"" + this._scope.node + "\"")), spanOf(node), spanOf(this._scope.node)); |
} |
this._scope = this._scope.parent; |
} |
@@ -3846,7 +3775,7 @@ MethodGenerator.prototype._visitLoop = function(node, visitBody) { |
} |
else { |
this._pushBlock(node, true); |
- visitBody.call$0(); |
+ visitBody(); |
this._popBlock(node); |
} |
} |
@@ -3863,7 +3792,7 @@ MethodGenerator.prototype._loopFixedPoint = function(node, visitBody) { |
if (tries++ >= $globals.options.maxInferenceIterations) { |
this._scope.inferTypes = false; |
} |
- visitBody.call$0(); |
+ visitBody(); |
this._popBlock(node); |
if (!this._scope.inferTypes || !this._scope.unionWith(s)) { |
break; |
@@ -3872,66 +3801,67 @@ MethodGenerator.prototype._loopFixedPoint = function(node, visitBody) { |
} |
savedWriter.write$1(this.writer.get$text()); |
this.writer = savedWriter; |
- savedCounters.add$1(this.counters); |
+ savedCounters.add(this.counters); |
this.counters = savedCounters; |
} |
MethodGenerator.prototype._makeLambdaMethod = function(name, func) { |
var meth = new MethodMember(name, this.method.declaringType, func); |
meth.set$isLambda(true); |
meth.set$enclosingElement(this.method); |
- meth.resolve$0(); |
+ meth.set$_methodData(new MethodData(meth, this)); |
+ meth.resolve(); |
return meth; |
} |
MethodGenerator.prototype.visitBool = function(node) { |
- return this.visitValue(node).convertTo$2(this, $globals.world.nonNullBool); |
+ return this.visitValue(node).convertTo(this, $globals.world.nonNullBool); |
} |
MethodGenerator.prototype.visitValue = function(node) { |
if (node == null) return null; |
var value = node.visit(this); |
- value.checkFirstClass$1(node.span); |
+ value.checkFirstClass(node.span); |
return value; |
} |
MethodGenerator.prototype.visitTypedValue = function(node, expectedType) { |
var val = this.visitValue(node); |
- return expectedType == null ? val : val.convertTo$2(this, expectedType); |
+ return expectedType == null ? val : val.convertTo(this, expectedType); |
} |
MethodGenerator.prototype.visitVoid = function(node) { |
if ((node instanceof PostfixExpression)) { |
var value = this.visitPostfixExpression(node, true); |
- value.checkFirstClass$1(node.span); |
+ value.checkFirstClass(node.span); |
return value; |
} |
else if ((node instanceof BinaryExpression)) { |
var value = this.visitBinaryExpression(node, true); |
- value.checkFirstClass$1(node.span); |
+ value.checkFirstClass(node.span); |
return value; |
} |
return this.visitValue(node); |
} |
MethodGenerator.prototype.visitDietStatement = function(node) { |
var parser = new Parser(node.span.file, false, false, false, node.span.start); |
- this.visitStatementsInBlock(parser.block$0()); |
+ this.visitStatementsInBlock(parser.block()); |
return false; |
} |
MethodGenerator.prototype.visitVariableDefinition = function(node) { |
var isFinal = false; |
- if (node.modifiers != null && $eq(node.modifiers[(0)].get$kind(), (99))) { |
+ if (node.modifiers != null && node.modifiers[(0)].kind == (99)) { |
isFinal = true; |
} |
this.writer.write("var "); |
- var type = this.method.resolveType$2(node.type, false); |
+ var type = this.method.resolveType(node.type, false, true); |
for (var i = (0); |
i < node.names.get$length(); i++) { |
if (i > (0)) { |
this.writer.write(", "); |
} |
- var name = node.names[i].get$name(); |
+ var name = node.names[i].name; |
var value = this.visitValue(node.values[i]); |
- if (isFinal && value == null) { |
+ if (isFinal && $eq(value)) { |
$globals.world.error("no value specified for final variable", node.span); |
} |
- var val = this._scope.create(name, type, node.names[i].get$span(), isFinal, false); |
- if (value == null) { |
+ var val = this._scope.create(name, type, node.names[i].span, isFinal, false); |
+ if ($eq(value)) { |
if (this._scope.reentrant) { |
this.writer.write(("" + val.get$code() + " = null")); |
} |
@@ -3940,7 +3870,7 @@ MethodGenerator.prototype.visitVariableDefinition = function(node) { |
} |
} |
else { |
- value = value.convertTo$2(this, type); |
+ value = value.convertTo(this, type); |
this._scope.inferAssign(name, value); |
this.writer.write(("" + val.get$code() + " = " + value.get$code())); |
} |
@@ -3951,8 +3881,7 @@ MethodGenerator.prototype.visitVariableDefinition = function(node) { |
MethodGenerator.prototype.visitFunctionDefinition = function(node) { |
var meth = this._makeLambdaMethod(node.name.name, node); |
var funcValue = this._scope.create(meth.get$name(), meth.get$functionType(), this.method.get$definition().get$span(), true, false); |
- $globals.world.gen.genMethod(meth, this); |
- meth.get$generator().writeDefinition$2(this.writer); |
+ meth.get$methodData().createFunction(this.writer); |
return false; |
} |
MethodGenerator.prototype.visitReturnStatement = function(node) { |
@@ -3971,13 +3900,13 @@ MethodGenerator.prototype.visitReturnStatement = function(node) { |
MethodGenerator.prototype.visitThrowStatement = function(node) { |
if (node.value != null) { |
var value = this.visitValue(node.value); |
- value.invoke$4(this, "toString", node, Arguments.get$EMPTY()); |
+ value.invoke(this, "toString", node, Arguments.get$EMPTY()); |
this.writer.writeln(("$throw(" + value.get$code() + ");")); |
$globals.world.gen.corejs.useThrow = true; |
} |
else { |
var rethrow = this._scope.getRethrow(); |
- if (rethrow == null) { |
+ if ($eq(rethrow)) { |
$globals.world.error("rethrow outside of catch", node.span); |
} |
else { |
@@ -3990,12 +3919,12 @@ MethodGenerator.prototype.visitAssertStatement = function(node) { |
var test = this.visitValue(node.test); |
if ($globals.options.enableAsserts) { |
var span = node.test.span; |
- var line = $add(span.get$file().getLine$1(span.get$start()), (1)); |
- var column = $add(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 line = span.get$file().getLine(span.get$start()) + (1); |
+ var column = span.get$file().getColumn($sub(line, (1)), span.get$start()) + (1); |
+ var args = [test, Value.fromString(span.get$text(), node.span), Value.fromString(span.get$file().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"); |
- var value = f.invoke(this, node, new TypeValue(tp, null), new Arguments(null, args), false); |
+ var f = tp.getMember("_assert"); |
+ var value = f.invoke(this, node, new TypeValue(tp, null), new Arguments(null, args)); |
this.writer.writeln(("" + value.get$code() + ";")); |
} |
return false; |
@@ -4071,8 +4000,8 @@ MethodGenerator.prototype.visitForStatement = function(node) { |
} |
var needsComma = false; |
var $$list = node.step; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var s = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var s = $$i.next(); |
if (needsComma) $this.writer.write(", "); |
var sv = $this.visitVoid(s); |
$this.writer.write(sv.get$code()); |
@@ -4091,11 +4020,14 @@ MethodGenerator.prototype._isFinal = function(typeRef) { |
if ((typeRef instanceof GenericTypeReference)) { |
typeRef = typeRef.get$baseType(); |
} |
- return typeRef != null && typeRef.get$isFinal(); |
+ else if ((typeRef instanceof SimpleTypeReference)) { |
+ return false; |
+ } |
+ return $ne(typeRef) && typeRef.get$isFinal(); |
} |
MethodGenerator.prototype.visitForInStatement = function(node) { |
var $this = this; // closure support |
- var itemType = this.method.resolveType$2(node.item.type, false); |
+ var itemType = this.method.resolveType(node.item.type, false, true); |
var list = node.list.visit(this); |
this._visitLoop(node, (function () { |
$this._visitForInBody(node, itemType, list); |
@@ -4112,18 +4044,18 @@ MethodGenerator.prototype._visitForInBody = function(node, itemType, list) { |
this.writer.writeln(("var " + listVar.get$code() + " = " + list.get$code() + ";")); |
list = listVar; |
} |
- if (list.get$type().get$isList()) { |
+ if ($eq(list.get$type().get$genericType(), $globals.world.listFactoryType)) { |
var tmpi = this._scope.create("$i", $globals.world.numType, null, false, false); |
var listLength = list.get_(this, "length", node.list); |
- this.writer.enterBlock(("for (var " + tmpi.get$code() + " = 0;") + ("" + tmpi.get$code() + " < " + listLength.get$code() + "; " + tmpi.get$code() + "++) {")); |
- var value = list.invoke(this, ":index", node.list, new Arguments(null, [tmpi]), false); |
+ this.writer.enterBlock($add(("for (var " + tmpi.get$code() + " = 0;"), ("" + tmpi.get$code() + " < " + listLength.get$code() + "; " + tmpi.get$code() + "++) {"))); |
+ var value = list.invoke(this, ":index", node.list, new Arguments(null, [tmpi])); |
this.writer.writeln(("var " + item.get$code() + " = " + value.get$code() + ";")); |
} |
else { |
- var iterator = list.invoke(this, "iterator", node.list, Arguments.get$EMPTY(), false); |
+ var iterator = list.invoke(this, "iterator", node.list, Arguments.get$EMPTY()); |
var tmpi = this._scope.create("$i", iterator.get$type(), null, false, false); |
- var hasNext = tmpi.invoke$4(this, "hasNext", node.list, Arguments.get$EMPTY()); |
- var next = tmpi.invoke$4(this, "next", node.list, Arguments.get$EMPTY()); |
+ var hasNext = tmpi.invoke(this, "hasNext", node.list, Arguments.get$EMPTY()); |
+ var next = tmpi.invoke(this, "next", node.list, Arguments.get$EMPTY()); |
this.writer.enterBlock(("for (var " + tmpi.get$code() + " = " + iterator.get$code() + "; " + hasNext.get$code() + "; ) {")); |
this.writer.writeln(("var " + item.get$code() + " = " + next.get$code() + ";")); |
} |
@@ -4146,11 +4078,11 @@ MethodGenerator.prototype.visitTryStatement = function(node) { |
if (node.catches.get$length() == (1)) { |
var catch_ = node.catches[(0)]; |
this._pushBlock(catch_, false); |
- var exType = this.method.resolveType$2(catch_.get$exception().get$type(), false); |
+ var exType = this.method.resolveType(catch_.get$exception().get$type(), false, true); |
var ex = this._scope.declare(catch_.get$exception()); |
this._scope.rethrow = ex.get$code(); |
this.writer.nextBlock(("} catch (" + ex.get$code() + ") {")); |
- if (catch_.get$trace() != null) { |
+ if ($ne(catch_.get$trace())) { |
var trace = this._scope.declare(catch_.get$trace()); |
this._genStackTraceOf(trace, ex); |
} |
@@ -4159,7 +4091,7 @@ 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[(0)].get$body()); |
+ this.visitStatementsInBlock(node.catches[(0)].body); |
this._popBlock(catch_); |
} |
else if (node.catches.get$length() > (0)) { |
@@ -4169,7 +4101,7 @@ MethodGenerator.prototype.visitTryStatement = function(node) { |
this.writer.nextBlock(("} catch (" + ex.get$code() + ") {")); |
var trace = null; |
if (node.catches.some((function (c) { |
- return c.get$trace() != null; |
+ return $ne(c.get$trace()); |
}) |
)) { |
trace = this._scope.create("$trace", $globals.world.varType, null, false, false); |
@@ -4181,7 +4113,7 @@ MethodGenerator.prototype.visitTryStatement = function(node) { |
i < node.catches.get$length(); i++) { |
var catch_ = node.catches[i]; |
this._pushBlock(catch_, false); |
- var tmpType = this.method.resolveType$2(catch_.get$exception().get$type(), false); |
+ var tmpType = this.method.resolveType(catch_.get$exception().get$type(), false, true); |
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); |
@@ -4196,7 +4128,7 @@ MethodGenerator.prototype.visitTryStatement = function(node) { |
this.writer.nextBlock("} else {"); |
} |
this.writer.writeln(("var " + tmp.get$code() + " = " + ex.get$code() + ";")); |
- if (catch_.get$trace() != null) { |
+ if ($ne(catch_.get$trace())) { |
var tmptrace = this._scope.declare(catch_.get$trace()); |
this.writer.writeln(("var " + tmptrace.get$code() + " = " + trace.get$code() + ";")); |
} |
@@ -4204,7 +4136,7 @@ MethodGenerator.prototype.visitTryStatement = function(node) { |
this._popBlock(catch_); |
if (tmpType.get$isVarOrObject()) { |
if (i + (1) < node.catches.get$length()) { |
- $globals.world.error("Unreachable catch clause", node.catches[i + (1)].get$span()); |
+ $globals.world.error("Unreachable catch clause", node.catches[i + (1)].span); |
} |
if (i > (0)) { |
this.writer.exitBlock("}"); |
@@ -4233,8 +4165,8 @@ MethodGenerator.prototype.visitSwitchStatement = function(node) { |
var test = this.visitValue(node.test); |
this.writer.enterBlock(("switch (" + test.get$code() + ") {")); |
var $$list = node.cases; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var case_ = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var case_ = $$i.next(); |
if (case_.get$label() != null) { |
$globals.world.error("unimplemented: labeled case statement", case_.get$span()); |
} |
@@ -4242,7 +4174,7 @@ MethodGenerator.prototype.visitSwitchStatement = function(node) { |
for (var i = (0); |
i < case_.get$cases().get$length(); i++) { |
var expr = case_.get$cases().$index(i); |
- if (expr == null) { |
+ if ($eq(expr)) { |
if (i < case_.get$cases().get$length() - (1)) { |
$globals.world.error("default clause must be the last case", case_.get$span()); |
} |
@@ -4270,7 +4202,7 @@ MethodGenerator.prototype._visitAllStatements = function(statementList, exits) { |
for (var i = (0); |
i < statementList.get$length(); i++) { |
var stmt = statementList.$index(i); |
- exits = stmt.visit$1(this); |
+ exits = stmt.visit(this); |
if ($ne(stmt, statementList.$index(statementList.get$length() - (1))) && exits) { |
$globals.world.warning("unreachable code", statementList.$index(i + (1)).get$span()); |
} |
@@ -4310,7 +4242,7 @@ MethodGenerator.prototype._checkNonStatic = function(node) { |
MethodGenerator.prototype._makeSuperValue = function(node) { |
var parentType = this.method.declaringType.get$parent(); |
this._checkNonStatic(node); |
- if (parentType == null) { |
+ if ($eq(parentType)) { |
$globals.world.error("no super class", node.span); |
} |
return new SuperValue(parentType, node.span); |
@@ -4334,7 +4266,7 @@ MethodGenerator.prototype._makeThisCode = function() { |
MethodGenerator.prototype._makeThisValue = function(node) { |
if (this.enclosingMethod != null) { |
var outermostMethod = this._getOutermostMethod(); |
- outermostMethod._checkNonStatic$1(node); |
+ outermostMethod._checkNonStatic(node); |
outermostMethod.set$needsThis(true); |
return new ThisValue(outermostMethod.get$method().get$declaringType(), "$this", node != null ? node.span : null); |
} |
@@ -4346,15 +4278,7 @@ MethodGenerator.prototype._makeThisValue = function(node) { |
MethodGenerator.prototype.visitLambdaExpression = function(node) { |
var name = (node.func.name != null) ? node.func.name.name : ""; |
var meth = this._makeLambdaMethod(name, node.func); |
- var lambdaGen = new MethodGenerator(meth, this); |
- if ($ne(name, "")) { |
- lambdaGen.get$_scope().create$3$isFinal(name, meth.get$functionType(), meth.definition.span, true); |
- lambdaGen._pushBlock$1(node); |
- } |
- lambdaGen.run$0(); |
- var w = new CodeWriter(); |
- meth.generator.writeDefinition(w, node); |
- return new Value(meth.get$functionType(), w.get$text(), node.span); |
+ return meth.get$methodData().createLambda(node, this); |
} |
MethodGenerator.prototype.visitCallExpression = function(node) { |
var target; |
@@ -4370,21 +4294,21 @@ MethodGenerator.prototype.visitCallExpression = function(node) { |
var varExpr = node.target; |
name = varExpr.name.name; |
target = this._scope.lookup(name); |
- if (target != null) { |
- return target.invoke$4(this, ":call", node, this._makeArgs(node.arguments)); |
+ if ($ne(target)) { |
+ return target.invoke(this, ":call", node, this._makeArgs(node.arguments)); |
} |
target = this._makeThisOrType(varExpr.span); |
- return target.invoke$4(this, name, node, this._makeArgs(node.arguments)); |
+ return target.invoke(this, name, node, this._makeArgs(node.arguments)); |
} |
else { |
target = node.target.visit(this); |
} |
- return target.invoke$4(this, name, position, this._makeArgs(node.arguments)); |
+ return target.invoke(this, name, position, this._makeArgs(node.arguments)); |
} |
MethodGenerator.prototype.visitIndexExpression = function(node) { |
var target = this.visitValue(node.target); |
var index = this.visitValue(node.index); |
- return target.invoke$4(this, ":index", node, new Arguments(null, [index])); |
+ return target.invoke(this, ":index", node, new Arguments(null, [index])); |
} |
MethodGenerator.prototype._expressionNeedsParens = function(e) { |
return ((e instanceof BinaryExpression) || (e instanceof ConditionalExpression) || (e instanceof PostfixExpression) || this._isUnaryIncrement(e)); |
@@ -4394,18 +4318,18 @@ MethodGenerator.prototype.visitBinaryExpression = function(node, isVoid) { |
if ($eq(kind, (35)) || $eq(kind, (34))) { |
var x = this.visitTypedValue(node.x, $globals.world.nonNullBool); |
var y = this.visitTypedValue(node.y, $globals.world.nonNullBool); |
- return x.binop$4(kind, y, this, node); |
+ return x.binop(kind, y, this, node); |
} |
else if ($eq(kind, (50)) || $eq(kind, (51))) { |
var x = this.visitValue(node.x); |
var y = this.visitValue(node.y); |
- return x.binop$4(kind, y, this, node); |
+ return x.binop(kind, y, this, node); |
} |
var assignKind = TokenKind.kindFromAssign(node.op.kind); |
if ($eq(assignKind, (-1))) { |
var x = this.visitValue(node.x); |
var y = this.visitValue(node.y); |
- return x.binop$4(kind, y, this, node); |
+ return x.binop(kind, y, this, node); |
} |
else if (($ne(assignKind, (0))) && this._expressionNeedsParens(node.y)) { |
return this._visitAssign(assignKind, node.x, new ParenExpression(node.y, node.y.span), node, isVoid ? (1) : (2)); |
@@ -4432,8 +4356,8 @@ MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, ret |
var name = xn.name.name; |
var x = this._scope.lookup(name); |
var y = this.visitValue(yn); |
- if (x != null) { |
- y = y.convertTo$2(this, x.get$staticType()); |
+ if ($ne(x)) { |
+ y = y.convertTo(this, x.get$staticType()); |
this._scope.inferAssign(name, Value.union(x, y)); |
if (x.get$isFinal()) { |
$globals.world.error(("final variable \"" + x.get$code() + "\" is not assignable"), position.span); |
@@ -4450,7 +4374,7 @@ MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, ret |
} |
else { |
var right = x; |
- y = right.binop$4(kind, y, this, position); |
+ y = right.binop(kind, y, this, position); |
if (returnKind == (3)) { |
var tmp = this.forceTemp(x); |
var ret = new Value(x.get$type(), ("(" + tmp.get$code() + " = " + x.get$code() + ", " + x.get$code() + " = " + y.get$code() + ", " + tmp.get$code() + ")"), position.span); |
@@ -4484,7 +4408,7 @@ MethodGenerator.prototype.visitUnaryExpression = function(node) { |
case (16): |
case (17): |
- if (value.get$type().get$isNum()) { |
+ if (value.get$type().get$isNum() && !value.get$isFinal() && (node.self instanceof VarExpression)) { |
return new Value(value.get$type(), ("" + node.op + value.get$code()), node.span); |
} |
else { |
@@ -4495,7 +4419,7 @@ MethodGenerator.prototype.visitUnaryExpression = function(node) { |
} |
} |
- return value.unop$3(node.op.kind, this, node); |
+ return value.unop(node.op.kind, this, node); |
} |
MethodGenerator.prototype.visitDeclaredIdentifier = function(node) { |
$globals.world.error("Expected expression", node.span); |
@@ -4505,7 +4429,7 @@ MethodGenerator.prototype.visitAwaitExpression = function(node) { |
} |
MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { |
var value = this.visitValue(node.body); |
- if (value.get$type().get$isNum() && !value.get$isFinal()) { |
+ if (value.get$type().get$isNum() && !value.get$isFinal() && (node.body instanceof VarExpression)) { |
return new Value(value.get$type(), ("" + value.get$code() + node.op), node.span); |
} |
var kind = ((16) == node.op.kind) ? (42) : (43); |
@@ -4519,23 +4443,23 @@ MethodGenerator.prototype.visitNewExpression = function(node) { |
if (node.name != null) { |
constructorName = node.name.name; |
} |
- if ($eq(constructorName, "") && !(typeRef instanceof GenericTypeReference) && typeRef.get$names() != null) { |
+ if ($eq(constructorName, "") && (typeRef instanceof NameTypeReference) && 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; |
+ constructorName = names.removeLast().get$name(); |
+ if (names.get$length() == (0)) names = null; |
typeRef = new NameTypeReference(typeRef.get$isFinal(), typeRef.get$name(), names, typeRef.get$span()); |
} |
- var type = this.method.resolveType$2(typeRef, true); |
+ var type = this.method.resolveType(typeRef, true, true); |
if (type.get$isTop()) { |
- type = type.get$library().findTypeByName$1(constructorName); |
+ type = type.get$library().findTypeByName(constructorName); |
constructorName = ""; |
} |
if ((type instanceof ParameterType)) { |
$globals.world.error("cannot instantiate a type parameter", node.span); |
return this._makeMissingValue(constructorName); |
} |
- var m = type.getConstructor$1(constructorName); |
- if (m == null) { |
+ var m = type.getConstructor(constructorName); |
+ if ($eq(m)) { |
var name = type.get$jsname(); |
if (type.get$isVar()) { |
name = typeRef.get$name().get$name(); |
@@ -4548,51 +4472,51 @@ MethodGenerator.prototype.visitNewExpression = function(node) { |
$globals.world.error("can't use const on a non-const constructor", node.span); |
} |
var $$list = node.arguments; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var arg = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var arg = $$i.next(); |
if (!this.visitValue(arg.get$value()).get$isConst()) { |
$globals.world.error("const constructor expects const arguments", arg.get$span()); |
} |
} |
} |
var target = new TypeValue(type, typeRef.get$span()); |
- return m.invoke$4(this, node, target, this._makeArgs(node.arguments)); |
+ return m.invoke(this, node, target, this._makeArgs(node.arguments)); |
} |
MethodGenerator.prototype.visitListExpression = function(node) { |
var argValues = []; |
var listType = $globals.world.listType; |
var type = $globals.world.varType; |
if (node.itemType != null) { |
- type = this.method.resolveType$2(node.itemType, true); |
+ type = this.method.resolveType(node.itemType, true, !node.isConst); |
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]); |
+ listType = listType.getOrMakeConcreteType([type]); |
} |
var $$list = node.values; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var item = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var item = $$i.next(); |
var arg = this.visitTypedValue(item, type); |
- argValues.add$1(arg); |
+ argValues.add(arg); |
if (node.isConst && !arg.get$isConst()) { |
$globals.world.error("const list can only contain const values", arg.get$span()); |
} |
} |
$globals.world.listFactoryType.markUsed(); |
var ret = new ListValue(argValues, node.isConst, listType, node.span); |
- if (ret.get$isConst()) return ret.getGlobalValue$0(); |
+ if (ret.get$isConst()) return ret.getGlobalValue(); |
return ret; |
} |
MethodGenerator.prototype.visitMapExpression = function(node) { |
if (node.items.get$length() == (0) && !node.isConst) { |
- return $globals.world.mapType.getConstructor("").invoke$4(this, node, new TypeValue($globals.world.mapType, node.span), Arguments.get$EMPTY()); |
+ return $globals.world.mapType.getConstructor("").invoke(this, node, new TypeValue($globals.world.mapType, node.span), Arguments.get$EMPTY()); |
} |
var values = []; |
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$2(node.keyType, true); |
+ keyType = this.method.resolveType(node.keyType, true, !node.isConst); |
if (!keyType.get$isString()) { |
$globals.world.error("the key type of a map literal must be \"String\"", keyType.get$span()); |
} |
@@ -4600,11 +4524,11 @@ MethodGenerator.prototype.visitMapExpression = function(node) { |
$globals.world.error("type parameter cannot be used in const map literals"); |
} |
} |
- valueType = this.method.resolveType$2(node.valueType, true); |
+ valueType = this.method.resolveType(node.valueType, true, !node.isConst); |
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]); |
+ mapType = mapType.getOrMakeConcreteType([keyType, valueType]); |
} |
for (var i = (0); |
i < node.items.get$length(); i += (2)) { |
@@ -4612,15 +4536,15 @@ MethodGenerator.prototype.visitMapExpression = function(node) { |
if (node.isConst && !key.get$isConst()) { |
$globals.world.error("const map can only contain const keys", key.get$span()); |
} |
- values.add$1(key); |
+ values.add(key); |
var value = this.visitTypedValue(node.items[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); |
+ values.add(value); |
} |
var ret = new MapValue(values, node.isConst, mapType, node.span); |
- if (ret.get$isConst()) return ret.getGlobalValue$0(); |
+ if (ret.get$isConst()) return ret.getGlobalValue(); |
return ret; |
} |
MethodGenerator.prototype.visitConditionalExpression = function(node) { |
@@ -4631,7 +4555,10 @@ MethodGenerator.prototype.visitConditionalExpression = function(node) { |
} |
MethodGenerator.prototype.visitIsExpression = function(node) { |
var value = this.visitValue(node.x); |
- var type = this.method.resolveType$2(node.type, false); |
+ var type = this.method.resolveType(node.type, true, true); |
+ if (type.get$isVar()) { |
+ return Value.comma(value, Value.fromBool(true, node.span)); |
+ } |
return value.instanceOf$4(this, type, node.span, node.isTrue); |
} |
MethodGenerator.prototype.visitParenExpression = function(node) { |
@@ -4641,13 +4568,13 @@ MethodGenerator.prototype.visitParenExpression = function(node) { |
} |
MethodGenerator.prototype.visitDotExpression = function(node) { |
var target = node.self.visit(this); |
- return target.get_$3(this, node.name.name, node.name); |
+ return target.get_(this, node.name.name, node.name); |
} |
MethodGenerator.prototype.visitVarExpression = function(node) { |
var name = node.name.name; |
var ret = this._scope.lookup(name); |
- if (ret != null) return ret; |
- return this._makeThisOrType(node.span).get_$3(this, name, node); |
+ if ($ne(ret)) return ret; |
+ return this._makeThisOrType(node.span).get_(this, name, node); |
} |
MethodGenerator.prototype._makeMissingValue = function(name) { |
return new Value($globals.world.varType, ("" + name + "()/*NotFound*/"), null); |
@@ -4676,58 +4603,30 @@ MethodGenerator.prototype._isUnaryIncrement = function(item) { |
MethodGenerator.prototype.visitStringInterpExpression = function(node) { |
var items = []; |
var $$list = node.pieces; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var item = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var item = $$i.next(); |
var val = this.visitValue(item); |
- val.invoke$4(this, "toString", item, Arguments.get$EMPTY()); |
+ val.invoke(this, "toString", item, Arguments.get$EMPTY()); |
var code = val.get$code(); |
if (this._expressionNeedsParens(item)) { |
code = ("(" + code + ")"); |
} |
- if ($eq(items.get$length(), (0)) || ($ne(code, "''") && $ne(code, "\"\""))) { |
- items.add$1(code); |
+ if (items.get$length() == (0) || ($ne(code, "''") && $ne(code, "\"\""))) { |
+ items.add(code); |
} |
} |
return new Value($globals.world.stringType, ("(" + Strings.join(items, " + ") + ")"), node.span); |
} |
-MethodGenerator.prototype._checkNonStatic$1 = MethodGenerator.prototype._checkNonStatic; |
MethodGenerator.prototype._pushBlock$1 = function($0) { |
return this._pushBlock($0, false); |
}; |
-MethodGenerator.prototype.evalBody$2 = MethodGenerator.prototype.evalBody; |
MethodGenerator.prototype.run$0 = MethodGenerator.prototype.run; |
-MethodGenerator.prototype.visitAssertStatement$1 = MethodGenerator.prototype.visitAssertStatement; |
MethodGenerator.prototype.visitBinaryExpression$1 = function($0) { |
return this.visitBinaryExpression($0, false); |
}; |
-MethodGenerator.prototype.visitBlockStatement$1 = MethodGenerator.prototype.visitBlockStatement; |
-MethodGenerator.prototype.visitBreakStatement$1 = MethodGenerator.prototype.visitBreakStatement; |
-MethodGenerator.prototype.visitContinueStatement$1 = MethodGenerator.prototype.visitContinueStatement; |
-MethodGenerator.prototype.visitDeclaredIdentifier$1 = MethodGenerator.prototype.visitDeclaredIdentifier; |
-MethodGenerator.prototype.visitDietStatement$1 = MethodGenerator.prototype.visitDietStatement; |
-MethodGenerator.prototype.visitDoStatement$1 = MethodGenerator.prototype.visitDoStatement; |
-MethodGenerator.prototype.visitEmptyStatement$1 = MethodGenerator.prototype.visitEmptyStatement; |
-MethodGenerator.prototype.visitExpressionStatement$1 = MethodGenerator.prototype.visitExpressionStatement; |
-MethodGenerator.prototype.visitForInStatement$1 = MethodGenerator.prototype.visitForInStatement; |
-MethodGenerator.prototype.visitForStatement$1 = MethodGenerator.prototype.visitForStatement; |
-MethodGenerator.prototype.visitFunctionDefinition$1 = MethodGenerator.prototype.visitFunctionDefinition; |
-MethodGenerator.prototype.visitIfStatement$1 = MethodGenerator.prototype.visitIfStatement; |
-MethodGenerator.prototype.visitIndexExpression$1 = MethodGenerator.prototype.visitIndexExpression; |
-MethodGenerator.prototype.visitLabeledStatement$1 = MethodGenerator.prototype.visitLabeledStatement; |
-MethodGenerator.prototype.visitLambdaExpression$1 = MethodGenerator.prototype.visitLambdaExpression; |
-MethodGenerator.prototype.visitLiteralExpression$1 = MethodGenerator.prototype.visitLiteralExpression; |
-MethodGenerator.prototype.visitMapExpression$1 = MethodGenerator.prototype.visitMapExpression; |
-MethodGenerator.prototype.visitNewExpression$1 = MethodGenerator.prototype.visitNewExpression; |
MethodGenerator.prototype.visitPostfixExpression$1 = function($0) { |
return this.visitPostfixExpression($0, false); |
}; |
-MethodGenerator.prototype.visitReturnStatement$1 = MethodGenerator.prototype.visitReturnStatement; |
-MethodGenerator.prototype.visitSwitchStatement$1 = MethodGenerator.prototype.visitSwitchStatement; |
-MethodGenerator.prototype.visitThrowStatement$1 = MethodGenerator.prototype.visitThrowStatement; |
-MethodGenerator.prototype.visitTryStatement$1 = MethodGenerator.prototype.visitTryStatement; |
-MethodGenerator.prototype.visitVariableDefinition$1 = MethodGenerator.prototype.visitVariableDefinition; |
-MethodGenerator.prototype.visitWhileStatement$1 = MethodGenerator.prototype.visitWhileStatement; |
-MethodGenerator.prototype.writeDefinition$2 = MethodGenerator.prototype.writeDefinition; |
// ********** Code for Arguments ************** |
function Arguments(nodes, values) { |
this.nodes = nodes; |
@@ -4737,7 +4636,7 @@ Arguments.Arguments$bare$factory = function(arity) { |
var values = []; |
for (var i = (0); |
i < arity; i++) { |
- values.add$1(new VariableValue($globals.world.varType, ("$" + i), null, false)); |
+ values.add(new VariableValue($globals.world.varType, ("$" + i), null, false)); |
} |
return new Arguments(null, values); |
} |
@@ -4757,7 +4656,7 @@ Arguments.prototype.get$length = function() { |
return this.values.get$length(); |
} |
Arguments.prototype.getName = function(i) { |
- return this.nodes[i].get$label().get$name(); |
+ return this.nodes[i].label.name; |
} |
Arguments.prototype.getIndexOfName = function(name) { |
for (var i = this.get$bareCount(); |
@@ -4770,7 +4669,7 @@ Arguments.prototype.getIndexOfName = function(name) { |
} |
Arguments.prototype.getValue = function(name) { |
var i = this.getIndexOfName(name); |
- return i >= (0) ? this.values[i] : null; |
+ return i >= (0) ? this.values.$index(i) : null; |
} |
Arguments.prototype.get$bareCount = function() { |
if (this._bareCount == null) { |
@@ -4778,7 +4677,7 @@ Arguments.prototype.get$bareCount = function() { |
if (this.nodes != null) { |
for (var i = (0); |
i < this.nodes.get$length(); i++) { |
- if (this.nodes[i].get$label() != null) { |
+ if (this.nodes[i].label != null) { |
this._bareCount = i; |
break; |
} |
@@ -4791,7 +4690,7 @@ Arguments.prototype.getCode = function() { |
var argsCode = []; |
for (var i = (0); |
i < this.get$length(); i++) { |
- argsCode.add$1(this.values[i].get$code()); |
+ argsCode.add(this.values.$index(i).get$code()); |
} |
Arguments.removeTrailingNulls(argsCode); |
return Strings.join(argsCode, ", "); |
@@ -4805,7 +4704,7 @@ Arguments.prototype.getNames = function() { |
var names = []; |
for (var i = this.get$bareCount(); |
i < this.get$length(); i++) { |
- names.add$1(this.getName(i)); |
+ names.add(this.getName(i)); |
} |
return names; |
} |
@@ -4813,16 +4712,25 @@ Arguments.prototype.toCallStubArgs = function() { |
var result = []; |
for (var i = (0); |
i < this.get$bareCount(); i++) { |
- result.add$1(new VariableValue($globals.world.varType, ("$" + i), null, false)); |
+ result.add(new VariableValue($globals.world.varType, ("$" + i), null, false)); |
} |
for (var i = this.get$bareCount(); |
i < this.get$length(); i++) { |
var name = this.getName(i); |
- if (name == null) name = ("$" + i); |
- result.add$1(new VariableValue($globals.world.varType, name, null, false)); |
+ if ($eq(name)) name = ("$" + i); |
+ result.add(new VariableValue($globals.world.varType, name, null, false)); |
} |
return new Arguments(this.nodes, result); |
} |
+Arguments.prototype.matches = function(other) { |
+ if (this.get$length() != other.get$length()) return false; |
+ if (this.get$bareCount() != other.get$bareCount()) return false; |
+ for (var i = (0); |
+ i < this.get$bareCount(); i++) { |
+ if ($ne(this.values.$index(i).get$type(), other.values.$index(i).get$type())) return false; |
+ } |
+ return true; |
+} |
// ********** Code for ReturnKind ************** |
function ReturnKind() {} |
// ********** Code for LibraryImport ************** |
@@ -4837,17 +4745,13 @@ LibraryImport.prototype.get$span = function() { return this.span; }; |
// ********** Code for Member ************** |
$inherits(Member, Element); |
function Member(name, declaringType) { |
- this.isGenerated = false; |
this.declaringType = declaringType; |
- this._provideFieldSyntax = false; |
this._providePropertySyntax = false; |
Element.call(this, name, declaringType); |
} |
Member.prototype.get$declaringType = function() { return this.declaringType; }; |
-Member.prototype.get$isGenerated = function() { return this.isGenerated; }; |
-Member.prototype.set$isGenerated = function(value) { return this.isGenerated = value; }; |
-Member.prototype.get$generator = function() { return this.generator; }; |
-Member.prototype.set$generator = function(value) { return this.generator = value; }; |
+Member.prototype.get$genericMember = function() { return this.genericMember; }; |
+Member.prototype.set$genericMember = function(value) { return this.genericMember = value; }; |
Member.prototype.get$library = function() { |
return this.declaringType.get$library(); |
} |
@@ -4884,21 +4788,12 @@ Member.prototype.get$isOperator = function() { |
Member.prototype.get$isCallMethod = function() { |
return this.name == ":call"; |
} |
-Member.prototype.get$requiresPropertySyntax = function() { |
- return false; |
-} |
-Member.prototype.get$requiresFieldSyntax = function() { |
- return false; |
-} |
Member.prototype.get$isNative = function() { |
return false; |
} |
Member.prototype.get$constructorName = function() { |
$globals.world.internalError("can not be a constructor", this.get$span()); |
} |
-Member.prototype.provideFieldSyntax = function() { |
- |
-} |
Member.prototype.providePropertySyntax = function() { |
} |
@@ -4932,30 +4827,38 @@ Member.prototype.get$preciseMemberSet = function() { |
} |
Member.prototype.get$potentialMemberSet = function() { |
if (this._potentialMemberSet == null) { |
- if (this.declaringType.get$isObject()) { |
- this._potentialMemberSet = $globals.world._members.$index(this.name); |
+ if (this.name == ":call") { |
+ this._potentialMemberSet = this.get$preciseMemberSet(); |
return this._potentialMemberSet; |
} |
- var mems = new HashSetImplementation(); |
- if (this.declaringType.get$isClass()) mems.add$1(this); |
- var $$list = this.declaringType.get$subtypes(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var subtype = $$i.next$0(); |
+ var mems = new HashSetImplementation_Member(); |
+ if (this.declaringType.get$isClass()) mems.add(this); |
+ var $$list = this.declaringType.get$genericType().get$subtypes(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var subtype = $$i.next(); |
if (!subtype.get$isClass()) continue; |
var mem = subtype.get$members().$index(this.name); |
if (mem != null) { |
- mems.add$1(mem); |
+ if (mem.isDefinedOn(this.declaringType)) { |
+ mems.add(mem); |
+ } |
} |
else if (!this.declaringType.get$isClass()) { |
- mem = subtype.getMember$1(this.name); |
- if (mem != null) { |
- mems.add$1(mem); |
+ mem = subtype.getMember(this.name); |
+ if (mem != null && mem.isDefinedOn(this.declaringType)) { |
+ mems.add(mem); |
} |
} |
} |
- if ($ne(mems.get$length(), (0))) { |
- for (var $$i = mems.iterator$0(); $$i.hasNext$0(); ) { |
- var mem = $$i.next$0(); |
+ if (mems.get$length() != (0)) { |
+ for (var $$i = mems.iterator(); $$i.hasNext(); ) { |
+ var mem = $$i.next(); |
+ if ($ne(this.declaringType.get$genericType(), this.declaringType) && mem.get$genericMember() != null && mems.contains$1(mem.get$genericMember())) { |
+ mems.remove$1(mem.get$genericMember()); |
+ } |
+ } |
+ for (var $$i = mems.iterator(); $$i.hasNext(); ) { |
+ var mem = $$i.next(); |
if (this._potentialMemberSet == null) { |
this._potentialMemberSet = new MemberSet(mem, false); |
} |
@@ -4967,12 +4870,43 @@ Member.prototype.get$potentialMemberSet = function() { |
} |
return this._potentialMemberSet; |
} |
+Member.prototype.isDefinedOn = function(type) { |
+ if (type.get$isClass()) { |
+ if (this.declaringType.isSubtypeOf(type)) { |
+ return true; |
+ } |
+ else if (type.isSubtypeOf(this.declaringType)) { |
+ return $eq(type.getMember(this.name), this); |
+ } |
+ else { |
+ return false; |
+ } |
+ } |
+ else { |
+ if (this.declaringType.isSubtypeOf(type)) { |
+ return true; |
+ } |
+ else { |
+ var $$list = this.declaringType.get$subtypes(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var t = $$i.next(); |
+ if (t.isSubtypeOf(type) && $eq(t.getMember(this.name), this)) { |
+ return true; |
+ } |
+ } |
+ return false; |
+ } |
+ } |
+} |
Member.prototype.canInvoke = function(context, args) { |
- return this.get$canGet() && new Value(this.get$returnType(), null, null).canInvoke(context, ":call", args); |
+ if (this.get$canGet() && (this.get$isField() || this.get$isProperty())) { |
+ return this.get$returnType().get$isFunction() || this.get$returnType().get$isVar() || this.get$returnType().getCallMethod() != null; |
+ } |
+ return false; |
} |
-Member.prototype.invoke = function(context, node, target, args, isDynamic) { |
- var newTarget = this._get(context, node, target, isDynamic); |
- return newTarget.invoke$5(context, ":call", node, args, isDynamic); |
+Member.prototype.invoke = function(context, node, target, args) { |
+ var newTarget = this._get(context, node, target); |
+ return newTarget.invoke(context, ":call", node, args); |
} |
Member.prototype.override = function(other) { |
if (this.get$isStatic()) { |
@@ -4986,7 +4920,7 @@ Member.prototype.override = function(other) { |
return true; |
} |
Member.prototype.get$generatedFactoryName = function() { |
- var prefix = ("" + this.declaringType.get$jsname() + "." + this.get$constructorName() + "$"); |
+ var prefix = ("" + this.declaringType.get$genericType().get$jsname() + "." + this.get$constructorName() + "$"); |
if (this.name == "") { |
return ("" + prefix + "factory"); |
} |
@@ -4997,26 +4931,18 @@ Member.prototype.get$generatedFactoryName = function() { |
Member.prototype.hashCode = function() { |
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 $bit_xor(($shl(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()); |
} |
-Member.prototype._get$3 = Member.prototype._get; |
-Member.prototype._get$3$isDynamic = Member.prototype._get; |
-Member.prototype._get$4 = Member.prototype._get; |
-Member.prototype._set$4$isDynamic = Member.prototype._set; |
-Member.prototype._set$5 = Member.prototype._set; |
-Member.prototype.canInvoke$2 = Member.prototype.canInvoke; |
-Member.prototype.computeValue$0 = Member.prototype.computeValue; |
-Member.prototype.hashCode$0 = Member.prototype.hashCode; |
-Member.prototype.invoke$4 = function($0, $1, $2, $3) { |
- return this.invoke($0, $1, $2, $3, false); |
-}; |
-Member.prototype.invoke$4$isDynamic = Member.prototype.invoke; |
-Member.prototype.invoke$5 = Member.prototype.invoke; |
-Member.prototype.provideFieldSyntax$0 = Member.prototype.provideFieldSyntax; |
-Member.prototype.providePropertySyntax$0 = Member.prototype.providePropertySyntax; |
+Member.prototype.resolveType = function(node, typeErrors, allowTypeParams) { |
+ allowTypeParams = allowTypeParams && !(this.get$isStatic() && !this.get$isFactory()); |
+ return Element.prototype.resolveType.call(this, node, typeErrors, allowTypeParams); |
+} |
+Member.prototype.makeConcrete = function(concreteType) { |
+ $globals.world.internalError("can not make this concrete", this.get$span()); |
+} |
// ********** Code for AmbiguousMember ************** |
$inherits(AmbiguousMember, Member); |
function AmbiguousMember(name, members) { |
@@ -5046,8 +4972,6 @@ Library.prototype.get$imports = function() { return this.imports; }; |
Library.prototype.set$imports = function(value) { return this.imports = value; }; |
Library.prototype.get$_privateMembers = function() { return this._privateMembers; }; |
Library.prototype.set$_privateMembers = function(value) { return this._privateMembers = value; }; |
-Library.prototype.get$topType = function() { return this.topType; }; |
-Library.prototype.set$topType = function(value) { return this.topType = value; }; |
Library.prototype.get$enclosingElement = function() { |
return null; |
} |
@@ -5102,11 +5026,11 @@ Library.prototype._addMember = function(member) { |
return; |
} |
var mset = this._privateMembers.$index(member.name); |
- if (mset == null) { |
+ if ($eq(mset)) { |
var $$list = $globals.world.libraries.getValues(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var lib = $$i.next$0(); |
- if (lib.get$_privateMembers().containsKey$1(member.get$jsname())) { |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var lib = $$i.next(); |
+ if (lib.get$_privateMembers().containsKey(member.get$jsname())) { |
member._jsname = ("_" + this.get$jsname() + member.get$jsname()); |
break; |
} |
@@ -5115,28 +5039,29 @@ Library.prototype._addMember = function(member) { |
this._privateMembers.$setindex(member.name, mset); |
} |
else { |
- mset.get$members().add$1(member); |
+ mset.get$members().add(member); |
} |
} |
else { |
$globals.world._addMember(member); |
} |
} |
-Library.prototype.getOrAddFunctionType = function(enclosingElement, name, func) { |
+Library.prototype.getOrAddFunctionType = function(enclosingElement, name, func, data) { |
var def = new FunctionTypeDefinition(func, null, func.span); |
var type = new DefinedType(name, this, def, false); |
- type.addMethod$2(":call", func); |
+ type.addMethod(":call", func); |
var m = type.get$members().$index(":call"); |
m.set$enclosingElement(enclosingElement); |
- m.resolve$0(); |
+ m.resolve(); |
+ m.set$_methodData(data); |
type.set$interfaces([$globals.world.functionType]); |
return type; |
} |
Library.prototype.addType = function(name, definition, isClass) { |
if (this.types.containsKey(name)) { |
var existingType = this.types.$index(name); |
- if ((this.get$isCore() || this.get$isCoreImpl()) && existingType.get$definition() == null) { |
- existingType.setDefinition$1(definition); |
+ if ((this.get$isCore() || this.get$isCoreImpl()) && $eq(existingType.get$definition())) { |
+ existingType.setDefinition(definition); |
} |
else { |
$globals.world.warning(("duplicate definition of " + name), definition.span, existingType.get$span()); |
@@ -5157,24 +5082,24 @@ Library.prototype.findType = function(type) { |
if (!result.get$isTop()) { |
return null; |
} |
- return result.get$library().findTypeByName(type.names[(0)].get$name()); |
+ return result.get$library().findTypeByName(type.names[(0)].name); |
} |
return result; |
} |
Library.prototype.findTypeByName = function(name) { |
var ret = this.types.$index(name); |
var $$list = this.imports; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var imported = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var imported = $$i.next(); |
var newRet = null; |
if (imported.get$prefix() == null) { |
- newRet = imported.get$library().get$types().$index(name); |
+ newRet = imported.get$library().types.$index(name); |
} |
- else if ($eq(imported.get$prefix(), name)) { |
- newRet = imported.get$library().get$topType(); |
+ else if (imported.get$prefix() == name) { |
+ newRet = imported.get$library().topType; |
} |
- if (newRet != null) { |
- if (ret != null && $ne(ret, newRet)) { |
+ if ($ne(newRet)) { |
+ if ($ne(ret) && $ne(ret, newRet)) { |
$globals.world.error(("conflicting types for \"" + name + "\""), ret.get$span(), newRet.get$span()); |
} |
else { |
@@ -5184,22 +5109,21 @@ Library.prototype.findTypeByName = function(name) { |
} |
return ret; |
} |
-Library.prototype.resolveType = function(node, typeErrors) { |
+Library.prototype.resolveType = function(node, typeErrors, allowTypeParams) { |
if (node == null) return $globals.world.varType; |
- if (node.type != null) return node.type; |
- node.type = this.findType(node); |
- if (node.type == null) { |
+ var ret = this.findType(node); |
+ if ($eq(ret)) { |
var message = ("cannot find type " + Library._getDottedName(node)); |
if (typeErrors) { |
$globals.world.error(message, node.span); |
- node.type = $globals.world.objectType; |
+ return $globals.world.objectType; |
} |
else { |
$globals.world.warning(message, node.span); |
- node.type = $globals.world.varType; |
+ return $globals.world.varType; |
} |
} |
- return node.type; |
+ return ret; |
} |
Library._getDottedName = function(type) { |
if (type.names != null) { |
@@ -5207,7 +5131,7 @@ Library._getDottedName = function(type) { |
return n.get$name(); |
}) |
); |
- return type.name.name + "." + Strings.join(names, "."); |
+ return $add($add(type.name.name, "."), Strings.join(names, ".")); |
} |
else { |
return type.name.name; |
@@ -5220,19 +5144,19 @@ Library.prototype.resolve = function() { |
if (this.name == null) { |
this.name = this.baseSource.filename; |
var index = this.name.lastIndexOf("/", this.name.length); |
- if (index >= (0)) { |
+ if ($gte(index, (0))) { |
this.name = this.name.substring($add(index, (1))); |
} |
index = this.name.indexOf("."); |
- if (index > (0)) { |
+ if ($gt(index, (0))) { |
this.name = this.name.substring((0), index); |
} |
} |
this._jsname = this.name.replaceAll(".", "_").replaceAll(":", "_").replaceAll(" ", "_"); |
var $$list = this.types.getValues(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var type = $$i.next$0(); |
- type.resolve$0(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var type = $$i.next(); |
+ type.resolve(); |
} |
} |
Library.prototype._addTopName = function(name, member, localSpan) { |
@@ -5242,7 +5166,7 @@ Library.prototype._addTopName = function(name, member, localSpan) { |
} |
else { |
if ((existing instanceof AmbiguousMember)) { |
- existing.get$members().add$1(member); |
+ existing.get$members().add(member); |
} |
else { |
var newMember = new AmbiguousMember(name, [existing, member]); |
@@ -5253,14 +5177,14 @@ Library.prototype._addTopName = function(name, member, localSpan) { |
} |
Library.prototype._addTopNames = function(lib) { |
var $$list = lib.topType.members.getValues(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var member = $$i.next$0(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var member = $$i.next(); |
if (member.get$isPrivate() && $ne(lib, this)) continue; |
this._addTopName(member.get$name(), member); |
} |
var $$list = lib.types.getValues(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var type = $$i.next$0(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var type = $$i.next(); |
if (!type.get$isTop()) { |
if ($ne(lib, this) && type.get$typeMember().get$isPrivate()) continue; |
this._addTopName(type.get$name(), type.get$typeMember()); |
@@ -5271,19 +5195,19 @@ Library.prototype.postResolveChecks = function() { |
this._topNames = new HashMapImplementation(); |
this._addTopNames(this); |
var $$list = this.imports; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var imported = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var imported = $$i.next(); |
if (imported.get$prefix() == null) { |
this._addTopNames(imported.get$library()); |
} |
else { |
- this._addTopName(imported.get$prefix(), imported.get$library().get$topType().get$typeMember(), imported.get$span()); |
+ this._addTopName(imported.get$prefix(), imported.get$library().topType.get$typeMember(), imported.get$span()); |
} |
} |
} |
Library.prototype.visitSources = function() { |
var visitor = new _LibraryVisitor(this); |
- visitor.addSource$1(this.baseSource); |
+ visitor.addSource(this.baseSource); |
} |
Library.prototype.toString = function() { |
return this.baseSource.filename; |
@@ -5292,16 +5216,9 @@ Library.prototype.hashCode = function() { |
return this.baseSource.filename.hashCode(); |
} |
Library.prototype.$eq = function(other) { |
- return (other instanceof Library) && $eq(other.get$baseSource().get$filename(), this.baseSource.filename); |
-} |
-Library.prototype.findTypeByName$1 = Library.prototype.findTypeByName; |
-Library.prototype.hashCode$0 = Library.prototype.hashCode; |
-Library.prototype.lookup$2 = Library.prototype.lookup; |
-Library.prototype.postResolveChecks$0 = Library.prototype.postResolveChecks; |
-Library.prototype.resolve$0 = Library.prototype.resolve; |
-Library.prototype.resolveType$2 = Library.prototype.resolveType; |
+ return (other instanceof Library) && other.get$baseSource().filename == this.baseSource.filename; |
+} |
Library.prototype.toString$0 = Library.prototype.toString; |
-Library.prototype.visitSources$0 = Library.prototype.visitSources; |
// ********** Code for _LibraryVisitor ************** |
function _LibraryVisitor(library) { |
this.library = library; |
@@ -5322,7 +5239,7 @@ _LibraryVisitor.prototype.addSourceFromName = function(name, span) { |
return; |
} |
else if (this.sources.some((function (s) { |
- return $eq(s.get$filename(), filename); |
+ return s.get$filename() == filename; |
}) |
)) { |
$globals.world.error(("file \"" + filename + "\" has already been sourced"), span); |
@@ -5334,7 +5251,7 @@ _LibraryVisitor.prototype.addSourceFromName = function(name, span) { |
_LibraryVisitor.prototype.addSource = function(source) { |
var $this = this; // closure support |
if (this.library.sources.some((function (s) { |
- return $eq(s.get$filename(), source.filename); |
+ return s.get$filename() == source.filename; |
}) |
)) { |
$globals.world.error(("duplicate source file \"" + source.filename + "\"")); |
@@ -5342,17 +5259,17 @@ _LibraryVisitor.prototype.addSource = function(source) { |
} |
this.library.sources.add(source); |
var parser = new Parser(source, $globals.options.dietParse, false, false, (0)); |
- var unit = parser.compilationUnit$0(); |
- unit.forEach$1((function (def) { |
- return def.visit$1($this); |
+ var unit = parser.compilationUnit(); |
+ unit.forEach((function (def) { |
+ return def.visit($this); |
}) |
); |
this.isTop = false; |
var newSources = this.sources; |
this.sources = []; |
- for (var $$i = newSources.iterator$0(); $$i.hasNext$0(); ) { |
- var source0 = $$i.next$0(); |
- this.addSource(source0); |
+ for (var $$i = newSources.iterator(); $$i.hasNext(); ) { |
+ var newSource = $$i.next(); |
+ this.addSource(newSource); |
} |
} |
_LibraryVisitor.prototype.visitDirectiveDefinition = function(node) { |
@@ -5384,10 +5301,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) { |
- $globals.world.error("expected at most one \"name\" argument and one optional \"prefix\"" + (" but found " + node.arguments.get$length()), node.span); |
+ if (node.arguments.get$length() > (2) || node.arguments.get$length() == (2) && $eq(prefix)) { |
+ $globals.world.error($add("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 ($ne(prefix) && $gte(prefix.indexOf$1("."), (0))) { |
$globals.world.error("library prefix canot contain \".\"", node.span); |
} |
else if (this.seenSource || this.seenResource) { |
@@ -5396,7 +5313,7 @@ _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) { |
if ($eq(prefix, "")) prefix = null; |
var filename = this.library.makeFullPath(name); |
if (this.library.imports.some((function (li) { |
- return $eq(li.get$library().get$baseSource(), filename); |
+ return $eq(li.get$library().baseSource, filename); |
}) |
)) { |
$globals.world.error(("duplicate import of \"" + name + "\""), node.span); |
@@ -5450,18 +5367,18 @@ _LibraryVisitor.prototype.getFirstStringArg = function(node) { |
return this._parseStringArgument(arg); |
} |
_LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) { |
- var args = node.arguments.filter$1((function (a) { |
- return a.get$label() != null && $eq(a.get$label().get$name(), argName); |
+ var args = node.arguments.filter((function (a) { |
+ return a.get$label() != null && a.get$label().name == argName; |
}) |
); |
- if ($eq(args.get$length(), (0))) { |
+ if (args.get$length() == (0)) { |
return null; |
} |
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(); ) { |
- var arg = $$i.next$0(); |
+ for (var $$i = args.iterator(); $$i.hasNext(); ) { |
+ var arg = $$i.next(); |
return this._parseStringArgument(arg); |
} |
} |
@@ -5476,9 +5393,9 @@ _LibraryVisitor.prototype.visitTypeDefinition = function(node) { |
var oldType = this.currentType; |
this.currentType = this.library.addType(node.name.name, node, node.isClass); |
var $$list = node.body; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var member = $$list[$$i]; |
- member.visit$1(this); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var member = $$i.next(); |
+ member.visit(this); |
} |
this.currentType = oldType; |
} |
@@ -5490,11 +5407,8 @@ _LibraryVisitor.prototype.visitFunctionDefinition = function(node) { |
} |
_LibraryVisitor.prototype.visitFunctionTypeDefinition = function(node) { |
var type = this.library.addType(node.func.name.name, node, false); |
- type.addMethod$2(":call", node.func); |
+ type.addMethod(":call", node.func); |
} |
-_LibraryVisitor.prototype.addSource$1 = _LibraryVisitor.prototype.addSource; |
-_LibraryVisitor.prototype.visitFunctionDefinition$1 = _LibraryVisitor.prototype.visitFunctionDefinition; |
-_LibraryVisitor.prototype.visitVariableDefinition$1 = _LibraryVisitor.prototype.visitVariableDefinition; |
// ********** Code for Parameter ************** |
function Parameter(definition, method) { |
this.method = method; |
@@ -5519,12 +5433,12 @@ Parameter.prototype.resolve = function() { |
this.name = this.name.substring((5)); |
this.isInitializer = true; |
} |
- this.type = this.method.resolveType$2(this.definition.type, false); |
+ this.type = this.method.resolveType(this.definition.type, false, true); |
if (this.definition.value != null) { |
if (!this.get$hasDefaultValue()) return; |
if (this.method.name == ":call") { |
var methodDef = this.method.get$definition(); |
- if (methodDef.get$body() == null && !this.method.get$isNative()) { |
+ if ($eq(methodDef.get$body()) && !this.method.get$isNative()) { |
$globals.world.error("default value not allowed on function type", this.definition.span); |
} |
} |
@@ -5545,14 +5459,7 @@ Parameter.prototype.genValue = function(method, context) { |
if (!this.value.get$isConst()) { |
$globals.world.error("default parameter values must be constant", this.value.span); |
} |
- this.value = this.value.convertTo(context, this.type, false); |
-} |
-Parameter.prototype.copyWithNewType = function(newMethod, newType) { |
- var ret = new Parameter(this.definition, newMethod); |
- ret.set$type(newType); |
- ret.set$name(this.name); |
- ret.set$isInitializer(this.isInitializer); |
- return ret; |
+ this.value = this.value.convertTo(context, this.type); |
} |
Parameter.prototype.get$isOptional = function() { |
return this.definition != null && this.definition.value != null; |
@@ -5560,9 +5467,6 @@ Parameter.prototype.get$isOptional = function() { |
Parameter.prototype.get$hasDefaultValue = function() { |
return this.definition.value.span.start != this.definition.span.start; |
} |
-Parameter.prototype.copyWithNewType$2 = Parameter.prototype.copyWithNewType; |
-Parameter.prototype.genValue$2 = Parameter.prototype.genValue; |
-Parameter.prototype.resolve$0 = Parameter.prototype.resolve; |
// ********** Code for TypeMember ************** |
$inherits(TypeMember, Member); |
function TypeMember(type) { |
@@ -5588,31 +5492,15 @@ TypeMember.prototype.get$canGet = function() { |
TypeMember.prototype.get$canSet = function() { |
return false; |
} |
-TypeMember.prototype.get$requiresFieldSyntax = function() { |
- return true; |
-} |
-TypeMember.prototype._get = function(context, node, target, isDynamic) { |
+TypeMember.prototype._get = function(context, node, target) { |
return new TypeValue(this.type, node.span); |
} |
-TypeMember.prototype._set = function(context, node, target, value, isDynamic) { |
+TypeMember.prototype._set = function(context, node, target, value) { |
$globals.world.error("cannot set type", node.span); |
} |
-TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) { |
+TypeMember.prototype.invoke = function(context, node, target, args) { |
$globals.world.error("cannot invoke type", node.span); |
} |
-TypeMember.prototype._get$3 = function($0, $1, $2) { |
- return this._get($0, $1, $2, false); |
-}; |
-TypeMember.prototype._get$3$isDynamic = TypeMember.prototype._get; |
-TypeMember.prototype._get$4 = TypeMember.prototype._get; |
-TypeMember.prototype._set$4$isDynamic = TypeMember.prototype._set; |
-TypeMember.prototype._set$5 = TypeMember.prototype._set; |
-TypeMember.prototype.canInvoke$2 = TypeMember.prototype.canInvoke; |
-TypeMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
- return this.invoke($0, $1, $2, $3, false); |
-}; |
-TypeMember.prototype.invoke$4$isDynamic = TypeMember.prototype.invoke; |
-TypeMember.prototype.invoke$5 = TypeMember.prototype.invoke; |
// ********** Code for FieldMember ************** |
$inherits(FieldMember, Member); |
function FieldMember(name, declaringType, definition, value) { |
@@ -5642,11 +5530,17 @@ FieldMember.prototype.override = function(other) { |
return false; |
} |
} |
-FieldMember.prototype.provideFieldSyntax = function() { |
- |
-} |
FieldMember.prototype.providePropertySyntax = function() { |
this._providePropertySyntax = true; |
+ if (this.genericMember != null) { |
+ this.genericMember.providePropertySyntax(); |
+ } |
+} |
+FieldMember.prototype.makeConcrete = function(concreteType) { |
+ var ret = new FieldMember(this.name, concreteType, this.definition, this.value); |
+ ret.set$genericMember(this); |
+ ret.set$_jsname(this._jsname); |
+ return ret; |
} |
FieldMember.prototype.get$span = function() { |
return this.definition == null ? null : this.definition.span; |
@@ -5668,15 +5562,15 @@ FieldMember.prototype.resolve = function() { |
this.isFinal = false; |
if (this.definition.modifiers != null) { |
var $$list = this.definition.modifiers; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var mod = $$list[$$i]; |
- if ($eq(mod.get$kind(), (85))) { |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var mod = $$i.next(); |
+ if (mod.get$kind() == (85)) { |
if (this.isStatic) { |
$globals.world.error("duplicate static modifier", mod.get$span()); |
} |
this.isStatic = true; |
} |
- else if ($eq(mod.get$kind(), (99))) { |
+ else if (mod.get$kind() == (99)) { |
if (this.isFinal) { |
$globals.world.error("duplicate final modifier", mod.get$span()); |
} |
@@ -5687,14 +5581,11 @@ FieldMember.prototype.resolve = function() { |
} |
} |
} |
- this.type = this.resolveType$2(this.definition.type, false); |
- if (this.isStatic && !this.get$isFactory() && this.type.get$hasTypeParams()) { |
- $globals.world.error("using type parameter in static context", this.definition.type.span); |
- } |
+ this.type = this.resolveType(this.definition.type, false, true); |
if (this.isStatic && this.isFinal && this.value == null) { |
$globals.world.error("static final field is missing initializer", this.get$span()); |
} |
- this.get$library()._addMember(this); |
+ if (this.declaringType.get$isClass()) this.get$library()._addMember(this); |
} |
FieldMember.prototype.computeValue = function() { |
if (this.value == null) return null; |
@@ -5728,13 +5619,16 @@ FieldMember.prototype.computeValue = function() { |
} |
return this._computedValue; |
} |
-FieldMember.prototype._get = function(context, node, target, isDynamic) { |
+FieldMember.prototype._get = function(context, node, target) { |
+ if (!context.get$needsCode()) { |
+ return new PureStaticValue(this.type, node.span, this.isStatic && this.isFinal, false); |
+ } |
if (this.isNative && this.get$returnType() != null) { |
this.get$returnType().markUsed(); |
if ((this.get$returnType() instanceof DefinedType)) { |
var defaultType = this.get$returnType().get$genericType().defaultType; |
- if (defaultType != null && defaultType.get$isNative()) { |
- defaultType.markUsed$0(); |
+ if ($ne(defaultType) && defaultType.get$isNative()) { |
+ defaultType.markUsed(); |
} |
} |
} |
@@ -5765,22 +5659,14 @@ FieldMember.prototype._get = function(context, node, target, isDynamic) { |
} |
return new Value(this.type, ("" + target.get$code() + "." + this.get$jsname()), node.span); |
} |
-FieldMember.prototype._set = function(context, node, target, value, isDynamic) { |
- var lhs = this._get(context, node, target, isDynamic); |
- value = value.convertTo(context, this.type, isDynamic); |
+FieldMember.prototype._set = function(context, node, target, value) { |
+ if (!context.get$needsCode()) { |
+ return new PureStaticValue(this.type, node.span, false, false); |
+ } |
+ var lhs = this._get(context, node, target); |
+ value = value.convertTo(context, this.type); |
return new Value(this.type, ("" + lhs.get$code() + " = " + value.get$code()), node.span); |
} |
-FieldMember.prototype._get$3 = function($0, $1, $2) { |
- return this._get($0, $1, $2, false); |
-}; |
-FieldMember.prototype._get$3$isDynamic = FieldMember.prototype._get; |
-FieldMember.prototype._get$4 = FieldMember.prototype._get; |
-FieldMember.prototype._set$4$isDynamic = FieldMember.prototype._set; |
-FieldMember.prototype._set$5 = FieldMember.prototype._set; |
-FieldMember.prototype.computeValue$0 = FieldMember.prototype.computeValue; |
-FieldMember.prototype.provideFieldSyntax$0 = FieldMember.prototype.provideFieldSyntax; |
-FieldMember.prototype.providePropertySyntax$0 = FieldMember.prototype.providePropertySyntax; |
-FieldMember.prototype.resolve$0 = FieldMember.prototype.resolve; |
// ********** Code for PropertyMember ************** |
$inherits(PropertyMember, Member); |
function PropertyMember(name, declaringType) { |
@@ -5799,16 +5685,8 @@ PropertyMember.prototype.get$canGet = function() { |
PropertyMember.prototype.get$canSet = function() { |
return this.setter != null; |
} |
-PropertyMember.prototype.get$requiresPropertySyntax = function() { |
- return this.declaringType.get$isClass(); |
-} |
-PropertyMember.prototype.provideFieldSyntax = function() { |
- this._provideFieldSyntax = true; |
-} |
-PropertyMember.prototype.providePropertySyntax = function() { |
- if (this._overriddenField != null && this._overriddenField.get$isNative()) { |
- this.provideFieldSyntax(); |
- } |
+PropertyMember.prototype.get$needsFieldSyntax = function() { |
+ return this._overriddenField != null && this._overriddenField.get$isNative(); |
} |
PropertyMember.prototype.get$isStatic = function() { |
return this.getter == null ? this.setter.isStatic : this.getter.isStatic; |
@@ -5819,6 +5697,13 @@ PropertyMember.prototype.get$isProperty = function() { |
PropertyMember.prototype.get$returnType = function() { |
return this.getter == null ? this.setter.returnType : this.getter.returnType; |
} |
+PropertyMember.prototype.makeConcrete = function(concreteType) { |
+ var ret = new PropertyMember(this.name, concreteType); |
+ if (this.getter != null) ret.set$getter(this.getter.makeConcrete(concreteType)); |
+ if (this.setter != null) ret.set$setter(this.setter.makeConcrete(concreteType)); |
+ ret.set$_jsname(this._jsname); |
+ return ret; |
+} |
PropertyMember.prototype.override = function(other) { |
if (!Member.prototype.override.call(this, other)) return false; |
if (other.get$isProperty() || other.get$isField()) { |
@@ -5831,35 +5716,28 @@ PropertyMember.prototype.override = function(other) { |
return false; |
} |
} |
-PropertyMember.prototype._get = function(context, node, target, isDynamic) { |
+PropertyMember.prototype._get = function(context, node, target) { |
if (this.getter == null) { |
if (this._overriddenField != null) { |
- return this._overriddenField._get(context, node, target, isDynamic); |
+ return this._overriddenField._get(context, node, target); |
} |
return target.invokeNoSuchMethod(context, ("get:" + this.name), node); |
} |
- return this.getter.invoke(context, node, target, Arguments.get$EMPTY(), false); |
+ return this.getter.invoke(context, node, target, Arguments.get$EMPTY()); |
} |
-PropertyMember.prototype._set = function(context, node, target, value, isDynamic) { |
+PropertyMember.prototype._set = function(context, node, target, value) { |
if (this.setter == null) { |
if (this._overriddenField != null) { |
- return this._overriddenField._set(context, node, target, value, isDynamic); |
+ return this._overriddenField._set(context, node, target, value); |
} |
return target.invokeNoSuchMethod(context, ("set:" + this.name), node, new Arguments(null, [value])); |
} |
- return this.setter.invoke(context, node, target, new Arguments(null, [value]), isDynamic); |
+ return this.setter.invoke(context, node, target, new Arguments(null, [value])); |
} |
PropertyMember.prototype.addFromParent = function(parentMember) { |
- var parent; |
- if ((parentMember instanceof ConcreteMember)) { |
- var c = parentMember; |
- parent = c.baseMember; |
- } |
- else { |
- parent = parentMember; |
- } |
- if (this.getter == null) this.getter = parent.getter; |
- if (this.setter == null) this.setter = parent.setter; |
+ var parent = parentMember; |
+ if (this.getter == null) this.getter = parent.get$getter(); |
+ if (this.setter == null) this.setter = parent.get$setter(); |
} |
PropertyMember.prototype.resolve = function() { |
if (this.getter != null) { |
@@ -5880,160 +5758,8 @@ PropertyMember.prototype.resolve = function() { |
$globals.world.warning("setter methods should be void", this.setter.definition.returnType.span); |
} |
} |
- this.get$library()._addMember(this); |
-} |
-PropertyMember.prototype._get$3 = function($0, $1, $2) { |
- return this._get($0, $1, $2, false); |
-}; |
-PropertyMember.prototype._get$3$isDynamic = PropertyMember.prototype._get; |
-PropertyMember.prototype._get$4 = PropertyMember.prototype._get; |
-PropertyMember.prototype._set$4$isDynamic = PropertyMember.prototype._set; |
-PropertyMember.prototype._set$5 = PropertyMember.prototype._set; |
-PropertyMember.prototype.provideFieldSyntax$0 = PropertyMember.prototype.provideFieldSyntax; |
-PropertyMember.prototype.providePropertySyntax$0 = PropertyMember.prototype.providePropertySyntax; |
-PropertyMember.prototype.resolve$0 = PropertyMember.prototype.resolve; |
-// ********** Code for ConcreteMember ************** |
-$inherits(ConcreteMember, Member); |
-function ConcreteMember(name, declaringType, baseMember) { |
- this.baseMember = baseMember; |
- Member.call(this, name, declaringType); |
- this.parameters = []; |
- this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaringType); |
- var $$list = this.baseMember.get$parameters(); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var p = $$list[$$i]; |
- var newType = p.get$type().resolveTypeParams$1(declaringType); |
- if ($ne(newType, p.get$type())) { |
- this.parameters.add(p.copyWithNewType$2(this, newType)); |
- } |
- else { |
- this.parameters.add(p); |
- } |
- } |
-} |
-ConcreteMember.prototype.get$returnType = function() { return this.returnType; }; |
-ConcreteMember.prototype.set$returnType = function(value) { return this.returnType = value; }; |
-ConcreteMember.prototype.get$parameters = function() { return this.parameters; }; |
-ConcreteMember.prototype.set$parameters = function(value) { return this.parameters = value; }; |
-ConcreteMember.prototype.get$span = function() { |
- return this.baseMember.get$span(); |
-} |
-ConcreteMember.prototype.get$isStatic = function() { |
- return this.baseMember.get$isStatic(); |
-} |
-ConcreteMember.prototype.get$isAbstract = function() { |
- return this.baseMember.get$isAbstract(); |
-} |
-ConcreteMember.prototype.get$isConst = function() { |
- return this.baseMember.get$isConst(); |
-} |
-ConcreteMember.prototype.get$isFactory = function() { |
- return this.baseMember.get$isFactory(); |
-} |
-ConcreteMember.prototype.get$isFinal = function() { |
- return this.baseMember.get$isFinal(); |
-} |
-ConcreteMember.prototype.get$isNative = function() { |
- return this.baseMember.get$isNative(); |
-} |
-ConcreteMember.prototype.get$jsname = function() { |
- return this.baseMember.get$jsname(); |
-} |
-ConcreteMember.prototype.get$canGet = function() { |
- return this.baseMember.get$canGet(); |
-} |
-ConcreteMember.prototype.get$canSet = function() { |
- return this.baseMember.get$canSet(); |
-} |
-ConcreteMember.prototype.canInvoke = function(context, args) { |
- return this.baseMember.canInvoke(context, args); |
-} |
-ConcreteMember.prototype.get$isField = function() { |
- return this.baseMember.get$isField(); |
-} |
-ConcreteMember.prototype.get$isMethod = function() { |
- return this.baseMember.get$isMethod(); |
-} |
-ConcreteMember.prototype.get$isProperty = function() { |
- return this.baseMember.get$isProperty(); |
-} |
-ConcreteMember.prototype.get$requiresPropertySyntax = function() { |
- return this.baseMember.get$requiresPropertySyntax(); |
-} |
-ConcreteMember.prototype.get$requiresFieldSyntax = function() { |
- return this.baseMember.get$requiresFieldSyntax(); |
-} |
-ConcreteMember.prototype.provideFieldSyntax = function() { |
- return this.baseMember.provideFieldSyntax(); |
-} |
-ConcreteMember.prototype.providePropertySyntax = function() { |
- return this.baseMember.providePropertySyntax(); |
-} |
-ConcreteMember.prototype.get$isConstructor = function() { |
- return this.name == this.declaringType.name; |
-} |
-ConcreteMember.prototype.get$constructorName = function() { |
- return this.baseMember.get$constructorName(); |
-} |
-ConcreteMember.prototype.get$definition = function() { |
- return this.baseMember.get$definition(); |
-} |
-ConcreteMember.prototype.get$initDelegate = function() { |
- return this.baseMember.get$initDelegate(); |
-} |
-ConcreteMember.prototype.set$initDelegate = function(ctor) { |
- this.baseMember.set$initDelegate(ctor); |
-} |
-ConcreteMember.prototype.resolveType = function(node, isRequired) { |
- var type = this.baseMember.resolveType$2(node, isRequired); |
- return type.resolveTypeParams$1(this.declaringType); |
-} |
-ConcreteMember.prototype.computeValue = function() { |
- return this.baseMember.computeValue(); |
-} |
-ConcreteMember.prototype.override = function(other) { |
- return this.baseMember.override(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.get$code(), node.span); |
-} |
-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.get$code(), node.span); |
-} |
-ConcreteMember.prototype._evalConstConstructor = function(newObject, args) { |
- return this.baseMember.get$dynamic()._evalConstConstructor$2(newObject, args); |
-} |
-ConcreteMember.prototype.invoke = function(context, node, target, args, isDynamic) { |
- var ret = this.baseMember.invoke(context, node, target, args, isDynamic); |
- var code = ret.get$code(); |
- if (this.get$isConstructor()) { |
- code = code.replaceFirst$2(this.declaringType.get$genericType().get$jsname(), this.declaringType.get$jsname()); |
- } |
- if ((this.baseMember instanceof MethodMember)) { |
- this.declaringType.genMethod(this); |
- } |
- return new Value(this.get$inferredResult(), code, node.span); |
+ if (this.declaringType.get$isClass()) this.get$library()._addMember(this); |
} |
-ConcreteMember.prototype._evalConstConstructor$2 = ConcreteMember.prototype._evalConstConstructor; |
-ConcreteMember.prototype._get$3 = function($0, $1, $2) { |
- return this._get($0, $1, $2, false); |
-}; |
-ConcreteMember.prototype._get$3$isDynamic = ConcreteMember.prototype._get; |
-ConcreteMember.prototype._get$4 = ConcreteMember.prototype._get; |
-ConcreteMember.prototype._set$4$isDynamic = ConcreteMember.prototype._set; |
-ConcreteMember.prototype._set$5 = ConcreteMember.prototype._set; |
-ConcreteMember.prototype.canInvoke$2 = ConcreteMember.prototype.canInvoke; |
-ConcreteMember.prototype.computeValue$0 = ConcreteMember.prototype.computeValue; |
-ConcreteMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
- return this.invoke($0, $1, $2, $3, false); |
-}; |
-ConcreteMember.prototype.invoke$4$isDynamic = ConcreteMember.prototype.invoke; |
-ConcreteMember.prototype.invoke$5 = ConcreteMember.prototype.invoke; |
-ConcreteMember.prototype.provideFieldSyntax$0 = ConcreteMember.prototype.provideFieldSyntax; |
-ConcreteMember.prototype.providePropertySyntax$0 = ConcreteMember.prototype.providePropertySyntax; |
-ConcreteMember.prototype.resolveType$2 = ConcreteMember.prototype.resolveType; |
// ********** Code for MethodMember ************** |
$inherits(MethodMember, Member); |
function MethodMember(name, declaringType, definition) { |
@@ -6052,6 +5778,8 @@ MethodMember.prototype.get$returnType = function() { return this.returnType; }; |
MethodMember.prototype.set$returnType = function(value) { return this.returnType = value; }; |
MethodMember.prototype.get$parameters = function() { return this.parameters; }; |
MethodMember.prototype.set$parameters = function(value) { return this.parameters = value; }; |
+MethodMember.prototype.get$_methodData = function() { return this._methodData; }; |
+MethodMember.prototype.set$_methodData = function(value) { return this._methodData = value; }; |
MethodMember.prototype.get$isStatic = function() { return this.isStatic; }; |
MethodMember.prototype.set$isStatic = function(value) { return this.isStatic = value; }; |
MethodMember.prototype.get$isAbstract = function() { return this.isAbstract; }; |
@@ -6064,6 +5792,20 @@ MethodMember.prototype.get$isLambda = function() { return this.isLambda; }; |
MethodMember.prototype.set$isLambda = function(value) { return this.isLambda = value; }; |
MethodMember.prototype.get$initDelegate = function() { return this.initDelegate; }; |
MethodMember.prototype.set$initDelegate = function(value) { return this.initDelegate = value; }; |
+MethodMember.prototype.makeConcrete = function(concreteType) { |
+ var _name = this.get$isConstructor() ? concreteType.name : this.name; |
+ var ret = new MethodMember(_name, concreteType, this.definition); |
+ ret.set$genericMember(this); |
+ ret.set$_jsname(this._jsname); |
+ return ret; |
+} |
+MethodMember.prototype.get$methodData = function() { |
+ if (this.genericMember != null) return this.genericMember.get$dynamic().get$methodData(); |
+ if (this._methodData == null) { |
+ this._methodData = new MethodData(this); |
+ } |
+ return this._methodData; |
+} |
MethodMember.prototype.get$isConstructor = function() { |
return this.name == this.declaringType.name; |
} |
@@ -6079,29 +5821,26 @@ MethodMember.prototype.get$canGet = function() { |
MethodMember.prototype.get$canSet = function() { |
return false; |
} |
-MethodMember.prototype.get$requiresPropertySyntax = function() { |
- return true; |
-} |
MethodMember.prototype.get$span = function() { |
return this.definition == null ? null : this.definition.span; |
} |
MethodMember.prototype.get$constructorName = function() { |
var returnType = this.definition.returnType; |
- if (returnType == null) return ""; |
+ if ($eq(returnType)) return ""; |
if ((returnType instanceof GenericTypeReference)) { |
return ""; |
} |
if (returnType.get$names() != null) { |
- return returnType.get$names().$index((0)).get$name(); |
+ return returnType.get$names()[(0)].name; |
} |
- else if (returnType.get$name() != null) { |
+ else if ($ne(returnType.get$name())) { |
return returnType.get$name().get$name(); |
} |
$globals.world.internalError("no valid constructor name", this.definition.span); |
} |
MethodMember.prototype.get$functionType = function() { |
if (this._functionType == null) { |
- this._functionType = this.get$library().getOrAddFunctionType(this.declaringType, this.name, this.definition); |
+ this._functionType = this.get$library().getOrAddFunctionType(this.declaringType, this.name, this.definition, this.get$methodData()); |
if (this.parameters == null) { |
this.resolve(); |
} |
@@ -6145,16 +5884,16 @@ MethodMember.prototype.indexOfParameter = function(name) { |
} |
return (-1); |
} |
-MethodMember.prototype.provideFieldSyntax = function() { |
- this._provideFieldSyntax = true; |
-} |
MethodMember.prototype.providePropertySyntax = function() { |
this._providePropertySyntax = true; |
} |
-MethodMember.prototype._set = function(context, node, target, value, isDynamic) { |
+MethodMember.prototype._set = function(context, node, target, value) { |
$globals.world.error("cannot set method", node.span); |
} |
-MethodMember.prototype._get = function(context, node, target, isDynamic) { |
+MethodMember.prototype._get = function(context, node, target) { |
+ if (!context.get$needsCode()) { |
+ return new PureStaticValue(this.get$functionType(), node.span, false, false); |
+ } |
this.declaringType.genMethod(this); |
this._provideOptionalParamInfo = true; |
if (this.isStatic) { |
@@ -6172,7 +5911,7 @@ MethodMember.prototype.namesInHomePositions = function(args) { |
if (i >= this.parameters.get$length()) { |
return false; |
} |
- if (args.getName(i) != this.parameters[i].get$name()) { |
+ if (args.getName(i) != this.parameters[i].name) { |
return false; |
} |
} |
@@ -6183,9 +5922,9 @@ MethodMember.prototype.namesInOrder = function(args) { |
var lastParameter = null; |
for (var i = args.get$bareCount(); |
i < this.parameters.get$length(); i++) { |
- var p = args.getIndexOfName(this.parameters[i].get$name()); |
- if (p >= (0) && args.values[p].get$needsTemp()) { |
- if (lastParameter != null && lastParameter > p) { |
+ var p = args.getIndexOfName(this.parameters[i].name); |
+ if ($gte(p, (0)) && args.values.$index(p).get$needsTemp()) { |
+ if (lastParameter != null && $gt(lastParameter, p)) { |
return false; |
} |
lastParameter = p; |
@@ -6197,17 +5936,16 @@ MethodMember.prototype.needsArgumentConversion = function(args) { |
var bareCount = args.get$bareCount(); |
for (var i = (0); |
i < bareCount; i++) { |
- var arg = args.values[i]; |
- if (arg.needsConversion$1(this.parameters[i].get$type())) { |
+ var arg = args.values.$index(i); |
+ if (arg.needsConversion(this.parameters[i].type)) { |
return true; |
} |
} |
if (bareCount < this.parameters.get$length()) { |
- this.genParameterValues(); |
for (var i = bareCount; |
i < this.parameters.get$length(); i++) { |
- var arg = args.getValue(this.parameters[i].get$name()); |
- if (arg != null && arg.needsConversion$1(this.parameters[i].get$type())) { |
+ var arg = args.getValue(this.parameters[i].name); |
+ if ($ne(arg) && arg.needsConversion(this.parameters[i].type)) { |
return true; |
} |
} |
@@ -6215,7 +5953,7 @@ MethodMember.prototype.needsArgumentConversion = function(args) { |
return false; |
} |
MethodMember._argCountMsg = function(actual, expected, atLeast) { |
- return "wrong number of positional arguments, expected " + ("" + (atLeast ? "at least " : "") + expected + " but found " + actual); |
+ return $add("wrong number of positional arguments, expected ", ("" + (atLeast ? "at least " : "") + expected + " but found " + actual)); |
} |
MethodMember.prototype._argError = function(context, node, target, args, msg, argIndex) { |
var span; |
@@ -6223,7 +5961,7 @@ MethodMember.prototype._argError = function(context, node, target, args, msg, ar |
span = node.span; |
} |
else { |
- span = args.nodes[argIndex].get$span(); |
+ span = args.nodes[argIndex].span; |
} |
if (this.isStatic || this.get$isConstructor()) { |
$globals.world.error(msg, span); |
@@ -6233,17 +5971,16 @@ MethodMember.prototype._argError = function(context, node, target, args, msg, ar |
} |
return target.invokeNoSuchMethod(context, this.name, node, args); |
} |
-MethodMember.prototype.genParameterValues = function() { |
+MethodMember.prototype.genParameterValues = function(context) { |
var $$list = this.parameters; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var p = $$list[$$i]; |
- p.genValue$2(this, this.generator); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var p = $$i.next(); |
+ p.genValue(this, context); |
} |
} |
-MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) { |
- if (this.parameters == null) { |
- $globals.world.info(("surprised to need to resolve: " + this.declaringType.name + "." + this.name)); |
- this.resolve(); |
+MethodMember.prototype.invoke = function(context, node, target, args) { |
+ if (!context.get$needsCode()) { |
+ return new PureStaticValue(this.returnType, node.span, false, false); |
} |
this.declaringType.genMethod(this); |
if (this.isStatic || this.isFactory) { |
@@ -6255,51 +5992,51 @@ MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) |
} |
var argsCode = []; |
if (!target.get$isType() && (this.get$isConstructor() || target.get$isSuper())) { |
- argsCode.add$1("this"); |
+ argsCode.add("this"); |
} |
var bareCount = args.get$bareCount(); |
for (var i = (0); |
i < bareCount; i++) { |
- var arg = args.values[i]; |
+ var arg = args.values.$index(i); |
if (i >= this.parameters.get$length()) { |
var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.get$length(), false); |
return this._argError(context, node, target, args, msg, i); |
} |
- arg = arg.convertTo$3(context, this.parameters[i].get$type(), isDynamic); |
- argsCode.add$1(arg.get$code()); |
+ arg = arg.convertTo(context, this.parameters[i].type); |
+ argsCode.add(arg.get$code()); |
} |
var namedArgsUsed = (0); |
if (bareCount < this.parameters.get$length()) { |
- this.genParameterValues(); |
+ this.genParameterValues(context); |
for (var i = bareCount; |
i < this.parameters.get$length(); i++) { |
- var arg = args.getValue(this.parameters[i].get$name()); |
- if (arg == null) { |
- arg = this.parameters[i].get$value(); |
+ var arg = args.getValue(this.parameters[i].name); |
+ if ($eq(arg)) { |
+ arg = this.parameters[i].value; |
} |
else { |
- arg = arg.convertTo$3(context, this.parameters[i].get$type(), isDynamic); |
+ arg = arg.convertTo(context, this.parameters[i].type); |
namedArgsUsed++; |
} |
- if (arg == null || !this.parameters[i].get$isOptional()) { |
+ if ($eq(arg) || !this.parameters[i].get$isOptional()) { |
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(arg.get$code()); |
+ argsCode.add(arg.get$code()); |
} |
} |
Arguments.removeTrailingNulls(argsCode); |
} |
if (namedArgsUsed < args.get$nameCount()) { |
- var seen = new HashSetImplementation(); |
+ var seen = new HashSetImplementation_dart_core_String(); |
for (var i = bareCount; |
i < args.get$length(); i++) { |
var name = args.getName(i); |
if (seen.contains$1(name)) { |
return this._argError(context, node, target, args, ("duplicate argument \"" + name + "\""), i); |
} |
- seen.add$1(name); |
+ seen.add(name); |
var p = this.indexOfParameter(name); |
if (p < (0)) { |
return this._argError(context, node, target, args, ("method does not have optional parameter \"" + name + "\""), i); |
@@ -6318,7 +6055,7 @@ MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) |
return new Value(this.get$inferredResult(), ("" + this.declaringType.get$jsname() + ".prototype." + this.get$jsname() + ".call(" + argsString + ")"), node.span); |
} |
if (this.get$isOperator()) { |
- return this._invokeBuiltin(context, node, target, args, argsCode, isDynamic); |
+ return this._invokeBuiltin(context, node, target, args, argsCode); |
} |
if (this.isFactory) { |
return new Value(target.get$type(), ("" + this.get$generatedFactoryName() + "(" + argsString + ")"), node != null ? node.span : null); |
@@ -6352,7 +6089,7 @@ MethodMember.prototype._invokeConstructor = function(context, node, target, args |
} |
var newType = this.declaringType; |
var newObject = new ObjectValue(true, newType, span); |
- newObject.initFields$0(); |
+ newObject.initFields(); |
this._evalConstConstructor(newObject, args); |
return $globals.world.gen.globalForConst(newObject, [args.values]); |
} |
@@ -6364,48 +6101,55 @@ MethodMember.prototype._invokeConstructor = function(context, node, target, args |
} |
MethodMember.prototype._evalConstConstructor = function(newObject, args) { |
this.declaringType.markUsed(); |
- var generator = new MethodGenerator(this, null); |
- generator.evalBody$2(newObject, args); |
+ this.get$methodData().eval(this, newObject, args); |
} |
-MethodMember.prototype._invokeBuiltin = function(context, node, target, args, argsCode, isDynamic) { |
- if (this.declaringType.get$isNum()) { |
- var code; |
- if (this.name == ":negate") { |
- code = ("-" + target.get$code()); |
- } |
- else if (this.name == ":bit_not") { |
- code = ("~" + target.get$code()); |
+MethodMember.prototype._invokeBuiltin = function(context, node, target, args, argsCode) { |
+ if (target.get$type().get$isNum()) { |
+ var code = null; |
+ if (args.get$length() == (0)) { |
+ if (this.name == ":negate") { |
+ code = ("-" + target.get$code()); |
+ } |
+ else if (this.name == ":bit_not") { |
+ code = ("~" + target.get$code()); |
+ } |
} |
- else if (this.name == ":truncdiv" || this.name == ":mod") { |
- $globals.world.gen.corejs.useOperator(this.name); |
- code = ("" + this.get$jsname() + "(" + target.get$code() + ", " + argsCode.$index((0)) + ")"); |
+ else if (args.get$length() == (1) && args.values.$index((0)).get$type().get$isNum()) { |
+ if (this.name == ":truncdiv" || this.name == ":mod") { |
+ $globals.world.gen.corejs.useOperator(this.name); |
+ code = ("" + this.get$jsname() + "(" + target.get$code() + ", " + argsCode.$index((0)) + ")"); |
+ } |
+ else { |
+ var op = TokenKind.rawOperatorFromMethod(this.name); |
+ code = ("" + target.get$code() + " " + op + " " + argsCode.$index((0))); |
+ } |
} |
- else { |
- var op = TokenKind.rawOperatorFromMethod(this.name); |
- code = ("" + target.get$code() + " " + op + " " + argsCode.$index((0))); |
+ if (code != null) { |
+ return new Value(this.get$inferredResult(), code, node.span); |
} |
- return new Value(this.get$inferredResult(), code, node.span); |
} |
- else if (this.declaringType.get$isString()) { |
- if (this.name == ":index") { |
+ else if (target.get$type().get$isString()) { |
+ if (this.name == ":index" && args.values.$index((0)).get$type().get$isNum()) { |
return new Value(this.declaringType, ("" + target.get$code() + "[" + argsCode.$index((0)) + "]"), node.span); |
} |
- else if (this.name == ":add") { |
+ else if (this.name == ":add" && args.values.$index((0)).get$type().get$isNum()) { |
return new Value(this.declaringType, ("" + target.get$code() + " + " + argsCode.$index((0))), node.span); |
} |
} |
else if (this.declaringType.get$isNative()) { |
- if (this.name == ":index") { |
- return new Value(this.returnType, ("" + target.get$code() + "[" + argsCode.$index((0)) + "]"), node.span); |
- } |
- else if (this.name == ":setindex") { |
- return new Value(this.returnType, ("" + target.get$code() + "[" + argsCode.$index((0)) + "] = " + argsCode.$index((1))), node.span); |
+ if (args.get$length() > (0) && args.values.$index((0)).get$type().get$isNum()) { |
+ if (this.name == ":index") { |
+ return new Value(this.returnType, ("" + target.get$code() + "[" + argsCode.$index((0)) + "]"), node.span); |
+ } |
+ else if (this.name == ":setindex") { |
+ return new Value(this.returnType, ("" + target.get$code() + "[" + argsCode.$index((0)) + "] = " + argsCode.$index((1))), node.span); |
+ } |
} |
} |
if (this.name == ":eq" || this.name == ":ne") { |
var op = this.name == ":eq" ? "==" : "!="; |
if (this.name == ":ne") { |
- target.invoke(context, ":eq", node, args, isDynamic); |
+ target.invoke(context, ":eq", node, args); |
} |
if ($eq(argsCode.$index((0)), "null")) { |
return new Value(this.get$inferredResult(), ("" + target.get$code() + " " + op + " null"), node.span); |
@@ -6426,6 +6170,11 @@ MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar |
else if (this.name == ":setindex") { |
$globals.world.gen.corejs.useSetIndex = true; |
} |
+ else { |
+ $globals.world.gen.corejs.useOperator(this.name); |
+ var argsString = argsCode.get$length() == (0) ? "" : (", " + argsCode.$index((0))); |
+ return new Value(this.returnType, ("" + this.get$jsname() + "(" + target.get$code() + argsString + ")"), node.span); |
+ } |
var argsString = Strings.join(argsCode, ", "); |
return new Value(this.get$inferredResult(), ("" + target.get$code() + "." + this.get$jsname() + "(" + argsString + ")"), node.span); |
} |
@@ -6436,15 +6185,15 @@ MethodMember.prototype.resolve = function() { |
this.isAbstract = !this.declaringType.get$isClass(); |
if (this.definition.modifiers != null) { |
var $$list = this.definition.modifiers; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var mod = $$list[$$i]; |
- if ($eq(mod.get$kind(), (85))) { |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var mod = $$i.next(); |
+ if (mod.get$kind() == (85)) { |
if (this.isStatic) { |
$globals.world.error("duplicate static modifier", mod.get$span()); |
} |
this.isStatic = true; |
} |
- else if (this.get$isConstructor() && $eq(mod.get$kind(), (92))) { |
+ else if (this.get$isConstructor() && mod.get$kind() == (92)) { |
if (this.isConst) { |
$globals.world.error("duplicate const modifier", mod.get$span()); |
} |
@@ -6453,7 +6202,7 @@ MethodMember.prototype.resolve = function() { |
} |
this.isConst = true; |
} |
- else if ($eq(mod.get$kind(), (74))) { |
+ else if (mod.get$kind() == (74)) { |
if (this.isFactory) { |
$globals.world.error("duplicate factory modifier", mod.get$span()); |
} |
@@ -6465,7 +6214,7 @@ MethodMember.prototype.resolve = function() { |
} |
this.isFactory = true; |
} |
- else if ($eq(mod.get$kind(), (71))) { |
+ else if (mod.get$kind() == (71)) { |
if (this.isAbstract) { |
if (this.declaringType.get$isClass()) { |
$globals.world.error("duplicate abstract modifier", mod.get$span()); |
@@ -6504,55 +6253,59 @@ MethodMember.prototype.resolve = function() { |
this.returnType = this.declaringType; |
} |
else { |
- this.returnType = this.resolveType(this.definition.returnType, false, true); |
+ if ((this.definition.returnType instanceof SimpleTypeReference) && $eq(this.definition.returnType.get$dynamic().get$type(), $globals.world.voidType)) { |
+ this.returnType = $globals.world.voidType; |
+ } |
+ else { |
+ this.returnType = this.resolveType(this.definition.returnType, false, !this.isStatic); |
+ } |
} |
this.parameters = []; |
var $$list = this.definition.formals; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var formal = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var formal = $$i.next(); |
var param = new Parameter(formal, this); |
- param.resolve$0(); |
+ param.resolve(); |
this.parameters.add(param); |
} |
- if (!this.isLambda) { |
+ if (!this.isLambda && this.declaringType.get$isClass()) { |
this.get$library()._addMember(this); |
} |
} |
-MethodMember.prototype.resolveType = function(node, typeErrors, allowVoid) { |
- var t = Element.prototype.resolveType.call(this, node, typeErrors); |
- if (this.isStatic && !this.isFactory && (t instanceof ParameterType)) { |
- $globals.world.error("using type parameter in static context.", node.span); |
- } |
- if (!allowVoid && t.get$isVoid()) { |
- $globals.world.error("\"void\" only allowed as return type", node.span); |
+// ********** Code for FactoryMap ************** |
+function FactoryMap() { |
+ this.factories = new HashMapImplementation(); |
+} |
+FactoryMap.prototype.get$factories = function() { return this.factories; }; |
+FactoryMap.prototype.set$factories = function(value) { return this.factories = value; }; |
+FactoryMap.prototype.getFactoriesFor = function(typeName) { |
+ var ret = this.factories.$index(typeName); |
+ if ($eq(ret)) { |
+ ret = new HashMapImplementation(); |
+ this.factories.$setindex(typeName, ret); |
} |
- return t; |
+ return ret; |
+} |
+FactoryMap.prototype.addFactory = function(typeName, name, member) { |
+ this.getFactoriesFor(typeName).$setindex(name, member); |
+} |
+FactoryMap.prototype.getFactory = function(typeName, name) { |
+ return this.getFactoriesFor(typeName).$index(name); |
+} |
+FactoryMap.prototype.forEach = function(f) { |
+ this.factories.forEach((function (_, constructors) { |
+ constructors.forEach((function (_, member) { |
+ f(member); |
+ }) |
+ ); |
+ }) |
+ ); |
} |
-MethodMember.prototype._evalConstConstructor$2 = MethodMember.prototype._evalConstConstructor; |
-MethodMember.prototype._get$3 = function($0, $1, $2) { |
- return this._get($0, $1, $2, false); |
-}; |
-MethodMember.prototype._get$3$isDynamic = MethodMember.prototype._get; |
-MethodMember.prototype._get$4 = MethodMember.prototype._get; |
-MethodMember.prototype._set$4$isDynamic = MethodMember.prototype._set; |
-MethodMember.prototype._set$5 = MethodMember.prototype._set; |
-MethodMember.prototype.canInvoke$2 = MethodMember.prototype.canInvoke; |
-MethodMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
- return this.invoke($0, $1, $2, $3, false); |
-}; |
-MethodMember.prototype.invoke$4$isDynamic = MethodMember.prototype.invoke; |
-MethodMember.prototype.invoke$5 = MethodMember.prototype.invoke; |
-MethodMember.prototype.namesInOrder$1 = MethodMember.prototype.namesInOrder; |
-MethodMember.prototype.provideFieldSyntax$0 = MethodMember.prototype.provideFieldSyntax; |
-MethodMember.prototype.providePropertySyntax$0 = MethodMember.prototype.providePropertySyntax; |
-MethodMember.prototype.resolve$0 = MethodMember.prototype.resolve; |
-MethodMember.prototype.resolveType$2 = function($0, $1) { |
- return this.resolveType($0, $1, false); |
-}; |
// ********** Code for MemberSet ************** |
function MemberSet(member, isVar) { |
this.jsname = member.get$jsname(); |
this.name = member.name; |
+ this._preparedForSet = false; |
this.isVar = isVar; |
this.members = [member]; |
} |
@@ -6564,172 +6317,109 @@ MemberSet.prototype.toString = function() { |
return ("" + this.name + ":" + this.members.get$length()); |
} |
MemberSet.prototype.add = function(member) { |
- return this.members.add(member); |
-} |
-MemberSet.prototype.get$isStatic = function() { |
- return this.members.get$length() == (1) && this.members[(0)].get$isStatic(); |
+ this.members.add(member); |
} |
MemberSet.prototype.get$isOperator = function() { |
return this.members[(0)].get$isOperator(); |
} |
-MemberSet.prototype.canInvoke = function(context, args) { |
- return this.members.some((function (m) { |
- return m.canInvoke$2(context, args); |
- }) |
- ); |
-} |
-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.get$code() + "." + this.jsname + "() /*no applicable " + action + "*/"), node.span); |
-} |
MemberSet.prototype.get$treatAsField = function() { |
if (this._treatAsField == null) { |
- this._treatAsField = !this.isVar && (this.members.some((function (m) { |
- return m.get$requiresFieldSyntax(); |
- }) |
- ) || this.members.every((function (m) { |
- return !m.get$requiresPropertySyntax(); |
+ this._treatAsField = !this.isVar && this.members.every((function (m) { |
+ return m.get$isField(); |
}) |
- )); |
- var $$list = this.members; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var member = $$list[$$i]; |
- if (this._treatAsField) { |
- member.provideFieldSyntax$0(); |
- } |
- else { |
- member.providePropertySyntax$0(); |
- } |
- } |
+ ); |
} |
return this._treatAsField; |
} |
-MemberSet.prototype._get = function(context, node, target, isDynamic) { |
- var returnValue; |
+MemberSet.unionTypes = function(t1, t2) { |
+ if (t1 == null) return t2; |
+ if (t2 == null) return t1; |
+ return Type.union(t1, t2); |
+} |
+MemberSet.prototype._get = function(context, node, target) { |
if (this.members.get$length() == (1) && !this.isVar) { |
- return this.members[(0)]._get$4(context, node, target, isDynamic); |
- } |
- var targets = this.members.filter$1((function (m) { |
- return m.get$canGet(); |
- }) |
- ); |
- if (this.isVar) { |
- targets.forEach$1((function (m) { |
- return m._get$3$isDynamic(context, node, target, true); |
- }) |
- ); |
- returnValue = new Value(this._foldTypes(targets), null, node.span); |
+ return this.members[(0)]._get(context, node, target); |
} |
- else { |
- if (this.members.get$length() == (1)) { |
- return this.members[(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(); |
- var value = member._get$3$isDynamic(context, node, target, true); |
- returnValue = this._tryUnion(returnValue, value, node); |
+ if (this._returnTypeForGet == null) { |
+ var $$list = this.members; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var member = $$i.next(); |
+ if (!member.get$canGet()) continue; |
+ if (!this.get$treatAsField()) member.providePropertySyntax(); |
+ var r = member._get(context, node, target); |
+ this._returnTypeForGet = MemberSet.unionTypes(this._returnTypeForGet, r.get$type()); |
} |
- if (returnValue == null) { |
- return this._makeError(node, target, "getter"); |
+ if (this._returnTypeForGet == null) { |
+ $globals.world.error(("no valid getters for \"" + this.name + "\""), node.span); |
} |
} |
- if (returnValue.get$code() == null) { |
- if (this.get$treatAsField()) { |
- return new Value(returnValue.get$type(), ("" + target.get$code() + "." + this.jsname), node.span); |
- } |
- else { |
- return new Value(returnValue.get$type(), ("" + target.get$code() + ".get$" + this.jsname + "()"), node.span); |
- } |
+ if (this._treatAsField) { |
+ return new Value(this._returnTypeForGet, ("" + target.get$code() + "." + this.jsname), node.span); |
+ } |
+ else { |
+ return new Value(this._returnTypeForGet, ("" + target.get$code() + ".get$" + this.jsname + "()"), node.span); |
} |
- return returnValue; |
} |
-MemberSet.prototype._set = function(context, node, target, value, isDynamic) { |
+MemberSet.prototype._set = function(context, node, target, value) { |
if (this.members.get$length() == (1) && !this.isVar) { |
- return this.members[(0)]._set$5(context, node, target, value, isDynamic); |
- } |
- var returnValue; |
- var targets = this.members.filter$1((function (m) { |
- return m.get$canSet(); |
- }) |
- ); |
- if (this.isVar) { |
- targets.forEach$1((function (m) { |
- return m._set$4$isDynamic(context, node, target, value, true); |
- }) |
- ); |
- returnValue = new Value(this._foldTypes(targets), null, node.span); |
+ return this.members[(0)]._set(context, node, target, value); |
} |
- else { |
- if (this.members.get$length() == (1)) { |
- return this.members[(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(); |
- var res = member._set$4$isDynamic(context, node, target, value, true); |
- returnValue = this._tryUnion(returnValue, res, node); |
- } |
- if (returnValue == null) { |
- return this._makeError(node, target, "setter"); |
+ if (!this._preparedForSet) { |
+ this._preparedForSet = true; |
+ var $$list = this.members; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var member = $$i.next(); |
+ if (!member.get$canSet()) continue; |
+ if (!this.get$treatAsField()) member.providePropertySyntax(); |
+ var r = member._set(context, node, target, value); |
} |
} |
- if (returnValue.get$code() == null) { |
- if (this.get$treatAsField()) { |
- return new Value(returnValue.get$type(), ("" + target.get$code() + "." + this.jsname + " = " + value.get$code()), node.span); |
- } |
- else { |
- return new Value(returnValue.get$type(), ("" + target.get$code() + ".set$" + this.jsname + "(" + value.get$code() + ")"), node.span); |
- } |
+ if (this.get$treatAsField()) { |
+ return new Value(value.get$type(), ("" + target.get$code() + "." + this.jsname + " = " + value.get$code()), node.span); |
} |
- return returnValue; |
-} |
-MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) { |
- if (this.isVar && !this.get$isOperator()) { |
- return this.invokeOnVar(context, node, target, args); |
+ else { |
+ return new Value(value.get$type(), ("" + target.get$code() + ".set$" + this.jsname + "(" + value.get$code() + ")"), node.span); |
} |
+} |
+MemberSet.prototype.invoke = function(context, node, target, args) { |
if (this.members.get$length() == (1) && !this.isVar) { |
- return this.members[(0)].invoke$5(context, node, target, args, isDynamic); |
+ return this.members[(0)].invoke(context, node, target, args); |
} |
- var targets = this.members.filter$1((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); |
+ var invokeKey = null; |
+ if (this._invokes == null) { |
+ this._invokes = []; |
+ invokeKey = null; |
} |
- var returnValue = null; |
- if (targets.get$length() < (1000)) { |
- for (var $$i = targets.iterator$0(); $$i.hasNext$0(); ) { |
- var member = $$i.next$0(); |
- var res = member.invoke$4$isDynamic(context, node, target, args, true); |
- returnValue = this._tryUnion(returnValue, res, node); |
- } |
- if (returnValue == null) { |
- return this._makeError(node, target, "method"); |
+ else { |
+ var $$list = this._invokes; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var ik = $$i.next(); |
+ if (ik.matches(args)) { |
+ invokeKey = ik; |
+ break; |
+ } |
} |
} |
- else { |
- returnValue = new Value($globals.world.varType, null, node.span); |
+ if ($eq(invokeKey)) { |
+ invokeKey = new InvokeKey(args); |
+ this._invokes.add(invokeKey); |
+ invokeKey.addMembers(this.members, context, target, args); |
} |
- if (returnValue.get$code() == null) { |
+ if (invokeKey.get$needsVarCall() || this.get$isOperator()) { |
if (this.name == ":call") { |
return target._varCall(context, node, args); |
} |
else if (this.get$isOperator()) { |
- return this.invokeSpecial(target, args, returnValue.get$type()); |
+ return this.invokeSpecial(target, args, invokeKey.get$returnType()); |
} |
else { |
return this.invokeOnVar(context, node, target, args); |
} |
} |
- return returnValue; |
+ else { |
+ var code = ("" + target.get$code() + "." + this.jsname + "(" + args.getCode() + ")"); |
+ return new Value(invokeKey.get$returnType(), code, node.span); |
+ } |
} |
MemberSet.prototype.invokeSpecial = function(target, args, returnType) { |
var argsString = args.getCode(); |
@@ -6749,27 +6439,10 @@ MemberSet.prototype.invokeSpecial = function(target, args, returnType) { |
} |
} |
MemberSet.prototype.invokeOnVar = function(context, node, target, args) { |
- context.counters.dynamicMethodCalls++; |
+ var $0; |
+ ($0 = context.get$counters()).dynamicMethodCalls = $0.dynamicMethodCalls + (1); |
var member = this.getVarMember(context, node, args); |
- return member.invoke$4(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.get$code() == y.get$code()) { |
- if ($eq(type, x.get$type())) { |
- return x; |
- } |
- else if (x.get$isConst() || y.get$isConst()) { |
- $globals.world.internalError("unexpected: union of const values "); |
- } |
- else { |
- return Value.union(x, y); |
- } |
- } |
- else { |
- return new Value(type, null, node.span); |
- } |
+ return member.invoke(context, node, target, args); |
} |
MemberSet.prototype.getVarMember = function(context, node, args) { |
if ($globals.world.objectType.varStubs == null) { |
@@ -6777,10 +6450,10 @@ MemberSet.prototype.getVarMember = function(context, node, args) { |
} |
var stubName = _getCallStubName(this.name, args); |
var stub = $globals.world.objectType.varStubs.$index(stubName); |
- if (stub == null) { |
+ if ($eq(stub)) { |
var mset = context.findMembers(this.name).members; |
- var targets = mset.filter$1((function (m) { |
- return m.canInvoke$2(context, args); |
+ var targets = mset.filter((function (m) { |
+ return m.canInvoke(context, args); |
}) |
); |
stub = new VarMethodSet(this.name, stubName, targets, args, this._foldTypes(targets)); |
@@ -6794,52 +6467,163 @@ MemberSet.prototype._foldTypes = function(targets) { |
}) |
), Type.union, $globals.world.varType); |
} |
-MemberSet.prototype._get$3 = function($0, $1, $2) { |
- return this._get($0, $1, $2, false); |
-}; |
-MemberSet.prototype._get$3$isDynamic = MemberSet.prototype._get; |
-MemberSet.prototype._get$4 = MemberSet.prototype._get; |
-MemberSet.prototype._set$4$isDynamic = MemberSet.prototype._set; |
-MemberSet.prototype._set$5 = MemberSet.prototype._set; |
-MemberSet.prototype.add$1 = MemberSet.prototype.add; |
-MemberSet.prototype.canInvoke$2 = MemberSet.prototype.canInvoke; |
-MemberSet.prototype.invoke$4 = function($0, $1, $2, $3) { |
- return this.invoke($0, $1, $2, $3, false); |
-}; |
-MemberSet.prototype.invoke$4$isDynamic = MemberSet.prototype.invoke; |
-MemberSet.prototype.invoke$5 = MemberSet.prototype.invoke; |
MemberSet.prototype.toString$0 = MemberSet.prototype.toString; |
-// ********** Code for FactoryMap ************** |
-function FactoryMap() { |
- this.factories = new HashMapImplementation(); |
+// ********** Code for InvokeKey ************** |
+function InvokeKey(args) { |
+ this.needsVarCall = false; |
+ this.bareArgs = args.get$bareCount(); |
+ if (this.bareArgs != args.get$length()) { |
+ this.namedArgs = args.getNames(); |
+ } |
+} |
+InvokeKey.prototype.get$returnType = function() { return this.returnType; }; |
+InvokeKey.prototype.set$returnType = function(value) { return this.returnType = value; }; |
+InvokeKey.prototype.get$needsVarCall = function() { return this.needsVarCall; }; |
+InvokeKey.prototype.set$needsVarCall = function(value) { return this.needsVarCall = value; }; |
+InvokeKey.prototype.matches = function(args) { |
+ if (this.namedArgs == null) { |
+ if (this.bareArgs != args.get$length()) return false; |
+ } |
+ else { |
+ if (this.bareArgs + this.namedArgs.get$length() != args.get$length()) return false; |
+ } |
+ if (this.bareArgs != args.get$bareCount()) return false; |
+ if (this.namedArgs == null) return true; |
+ for (var i = (0); |
+ i < this.namedArgs.get$length(); i++) { |
+ if (this.namedArgs[i] != args.getName(this.bareArgs + i)) return false; |
+ } |
+ return true; |
} |
-FactoryMap.prototype.getFactoriesFor = function(typeName) { |
- var ret = this.factories.$index(typeName); |
- if (ret == null) { |
- ret = new HashMapImplementation(); |
- this.factories.$setindex(typeName, ret); |
+InvokeKey.prototype.addMembers = function(members, context, target, args) { |
+ for (var $$i = members.iterator(); $$i.hasNext(); ) { |
+ var member = $$i.next(); |
+ if (!(member.get$parameters().get$length() == this.bareArgs && this.namedArgs == null)) { |
+ this.needsVarCall = true; |
+ } |
+ if (member.canInvoke(context, args)) { |
+ if (member.get$isMethod()) { |
+ this.returnType = MemberSet.unionTypes(this.returnType, member.get$returnType()); |
+ member.get$declaringType().genMethod(member); |
+ } |
+ else { |
+ this.needsVarCall = true; |
+ this.returnType = $globals.world.varType; |
+ } |
+ } |
+ } |
+ if (this.returnType == null) { |
+ this.returnType = $globals.world.varType; |
} |
- return ret; |
} |
-FactoryMap.prototype.addFactory = function(typeName, name, member) { |
- this.getFactoriesFor(typeName).$setindex(name, member); |
+// ********** Code for MethodCallData ************** |
+function MethodCallData(data, method) { |
+ this.method = method; |
+ this.data = data; |
+} |
+MethodCallData.prototype.get$method = function() { return this.method; }; |
+MethodCallData.prototype.set$method = function(value) { return this.method = value; }; |
+MethodCallData.prototype.get$_methodGenerator = function() { return this._methodGenerator; }; |
+MethodCallData.prototype.set$_methodGenerator = function(value) { return this._methodGenerator = value; }; |
+MethodCallData.prototype.matches = function(other) { |
+ return $eq(this.method, other.method); |
+} |
+MethodCallData.prototype.run = function() { |
+ if (this._methodGenerator != null) return; |
+ this._methodGenerator = new MethodGenerator(this.method, this.data.context); |
+ this._methodGenerator.run(); |
+} |
+MethodCallData.prototype.run$0 = MethodCallData.prototype.run; |
+// ********** Code for MethodData ************** |
+function MethodData(baseMethod, context) { |
+ this.needsTypeParams = false; |
+ this._calls = []; |
+ this.baseMethod = baseMethod; |
+ this.context = context; |
+ this.body = this.baseMethod.definition.body; |
+ if (this.baseMethod.get$isConstructor()) { |
+ this.needsTypeParams = true; |
+ } |
+} |
+MethodData.prototype.get$body = function() { return this.body; }; |
+MethodData.prototype.set$body = function(value) { return this.body = value; }; |
+MethodData.prototype.analyze = function() { |
+ if (this.body == null) return; |
+ var ma = new MethodAnalyzer(this.baseMethod, this.body); |
+ ma.analyze$1(this.context); |
+} |
+MethodData.prototype.eval = function(method, newObject, args) { |
+ if (method != this.baseMethod) { |
+ if (!this.needsTypeParams) method = this.baseMethod; |
+ } |
+ var gen = new MethodGenerator(method, this.context); |
+ return gen.evalBody(newObject, args); |
+} |
+MethodData.prototype.invokeCall = function(callData) { |
+ var $$list = this._calls; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var cd = $$i.next(); |
+ if (cd.matches(callData)) { |
+ return cd.run$0(); |
+ } |
+ } |
+ this._calls.add(callData); |
+ callData.run(); |
+} |
+MethodData.prototype.run = function(method) { |
+ if (this.body == null && !method.get$isConstructor() && !method.get$isNative()) return; |
+ if (method != this.baseMethod) { |
+ if (!this.needsTypeParams) method = this.baseMethod; |
+ } |
+ var callData = new MethodCallData(this, method); |
+ method.declaringType.get$genericType().markUsed(); |
+ this.invokeCall(callData); |
+} |
+MethodData.prototype.writeDefinition = function(method, writer) { |
+ var gen = null; |
+ var $$list = this._calls; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var cd = $$i.next(); |
+ if ($eq(cd.get$method(), method)) { |
+ gen = cd.get$_methodGenerator(); |
+ } |
+ } |
+ if ($ne(gen)) { |
+ if (method.definition.nativeBody != null && $eq(method, this.baseMethod)) { |
+ if (method.definition.nativeBody == "") return true; |
+ gen.set$writer(new CodeWriter()); |
+ gen.get$writer().write(method.definition.nativeBody); |
+ gen.set$_paramCode(map(method.parameters, (function (p) { |
+ return p.get$name(); |
+ }) |
+ )); |
+ } |
+ gen.writeDefinition(writer); |
+ return true; |
+ } |
+ else { |
+ return false; |
+ } |
} |
-FactoryMap.prototype.getFactory = function(typeName, name) { |
- return this.getFactoriesFor(typeName).$index(name); |
+MethodData.prototype.createFunction = function(writer) { |
+ this.run(this.baseMethod); |
+ this.writeDefinition(this.baseMethod, writer); |
} |
-FactoryMap.prototype.forEach = function(f) { |
- this.factories.forEach((function (_, constructors) { |
- constructors.forEach((function (_, member) { |
- f.call$1(member); |
- }) |
- ); |
- }) |
- ); |
+MethodData.prototype.createLambda = function(node, context) { |
+ var lambdaGen = new MethodGenerator(this.baseMethod, context); |
+ if (this.baseMethod.name != "") { |
+ lambdaGen.get$_scope().create$3$isFinal(this.baseMethod.name, this.baseMethod.get$functionType(), this.baseMethod.definition.span, true); |
+ lambdaGen._pushBlock$1(this.baseMethod.definition); |
+ } |
+ this._calls.add(new MethodCallData(this, this.baseMethod)); |
+ lambdaGen.run(); |
+ if (this.baseMethod.name != "") { |
+ lambdaGen._popBlock(this.baseMethod.definition); |
+ } |
+ var writer = new CodeWriter(); |
+ lambdaGen.writeDefinition(writer, node); |
+ return new Value(this.baseMethod.get$functionType(), writer.get$text(), this.baseMethod.definition.span); |
} |
-FactoryMap.prototype.forEach$1 = function($0) { |
- return this.forEach(to$call$1($0)); |
-}; |
-FactoryMap.prototype.getFactory$2 = FactoryMap.prototype.getFactory; |
// ********** Code for Token ************** |
function Token(kind, source, start, end) { |
this.end = end; |
@@ -6848,7 +6632,6 @@ function Token(kind, source, start, end) { |
this.source = source; |
} |
Token.prototype.get$kind = function() { return this.kind; }; |
-Token.prototype.get$end = function() { return this.end; }; |
Token.prototype.get$start = function() { return this.start; }; |
Token.prototype.get$text = function() { |
return this.source.get$text().substring(this.start, this.end); |
@@ -6858,7 +6641,7 @@ Token.prototype.toString = function() { |
var actualText = this.get$text(); |
if ($ne(kindText, actualText)) { |
if (actualText.get$length() > (10)) { |
- actualText = $add(actualText.substring$2((0), (8)), "..."); |
+ actualText = $add(actualText.substring((0), (8)), "..."); |
} |
return ("" + kindText + "(" + actualText + ")"); |
} |
@@ -6869,12 +6652,6 @@ Token.prototype.toString = function() { |
Token.prototype.get$span = function() { |
return new SourceSpan(this.source, this.start, this.end); |
} |
-Token.prototype.end$0 = function() { |
- return this.end.call$0(); |
-}; |
-Token.prototype.start$0 = function() { |
- return this.start.call$0(); |
-}; |
Token.prototype.toString$0 = Token.prototype.toString; |
// ********** Code for LiteralToken ************** |
$inherits(LiteralToken, Token); |
@@ -6898,8 +6675,6 @@ function SourceFile(filename, _text) { |
this.filename = filename; |
} |
SourceFile.prototype.get$filename = function() { return this.filename; }; |
-SourceFile.prototype.get$orderInLibrary = function() { return this.orderInLibrary; }; |
-SourceFile.prototype.set$orderInLibrary = function(value) { return this.orderInLibrary = value; }; |
SourceFile.prototype.get$text = function() { |
return this._text; |
} |
@@ -6907,12 +6682,12 @@ SourceFile.prototype.get$lineStarts = function() { |
if (this._lineStarts == null) { |
var starts = [(0)]; |
var index = (0); |
- while (index < this.get$text().length) { |
+ while ($lt(index, this.get$text().length)) { |
index = this.get$text().indexOf("\n", index) + (1); |
- if (index <= (0)) break; |
- starts.add$1(index); |
+ if ($lte(index, (0))) break; |
+ starts.add(index); |
} |
- starts.add$1(this.get$text().length + (1)); |
+ starts.add(this.get$text().length + (1)); |
this._lineStarts = starts; |
} |
return this._lineStarts; |
@@ -6921,7 +6696,7 @@ SourceFile.prototype.getLine = function(position) { |
var starts = this.get$lineStarts(); |
for (var i = (0); |
i < starts.get$length(); i++) { |
- if (starts.$index(i) > position) return i - (1); |
+ if ($gt(starts.$index(i), position)) return i - (1); |
} |
$globals.world.internalError("bad position"); |
} |
@@ -6933,34 +6708,34 @@ SourceFile.prototype.getLocationMessage = function(message, start, end, includeT |
var column = this.getColumn(line, start); |
var buf = new StringBufferImpl(("" + this.filename + ":" + ($add(line, (1))) + ":" + ($add(column, (1))) + ": " + message)); |
if (includeText) { |
- buf.add$1("\n"); |
+ buf.add("\n"); |
var textLine; |
- if (($add(line, (2))) < this._lineStarts.get$length()) { |
- textLine = this.get$text().substring(this._lineStarts[line], this._lineStarts[$add(line, (1))]); |
+ if ($lt(($add(line, (2))), this._lineStarts.get$length())) { |
+ textLine = this.get$text().substring(this._lineStarts.$index(line), this._lineStarts.$index($add(line, (1)))); |
} |
else { |
- textLine = this.get$text().substring(this._lineStarts[line]) + "\n"; |
+ textLine = $add(this.get$text().substring(this._lineStarts.$index(line)), "\n"); |
} |
var toColumn = Math.min($add(column, (end - start)), textLine.get$length()); |
if ($globals.options.useColors) { |
- 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); |
- buf.add$1(textLine.substring$1(toColumn)); |
+ buf.add(textLine.substring((0), column)); |
+ buf.add($globals._RED_COLOR); |
+ buf.add(textLine.substring(column, toColumn)); |
+ buf.add($globals._NO_COLOR); |
+ buf.add(textLine.substring$1(toColumn)); |
} |
else { |
- buf.add$1(textLine); |
+ buf.add(textLine); |
} |
var i = (0); |
- for (; i < column; i++) { |
- buf.add$1(" "); |
+ for (; $lt(i, column); i++) { |
+ buf.add(" "); |
} |
- if ($globals.options.useColors) buf.add$1($globals._RED_COLOR); |
+ if ($globals.options.useColors) buf.add($globals._RED_COLOR); |
for (; i < toColumn; i++) { |
- buf.add$1("^"); |
+ buf.add("^"); |
} |
- if ($globals.options.useColors) buf.add$1($globals._NO_COLOR); |
+ if ($globals.options.useColors) buf.add($globals._NO_COLOR); |
} |
return buf.toString$0(); |
} |
@@ -6972,9 +6747,6 @@ SourceFile.prototype.compareTo = function(other) { |
return this.filename.compareTo(other.filename); |
} |
} |
-SourceFile.prototype.compareTo$1 = SourceFile.prototype.compareTo; |
-SourceFile.prototype.getColumn$2 = SourceFile.prototype.getColumn; |
-SourceFile.prototype.getLine$1 = SourceFile.prototype.getLine; |
// ********** Code for SourceSpan ************** |
function SourceSpan(file, start, end) { |
this.file = file; |
@@ -6983,7 +6755,6 @@ function SourceSpan(file, start, end) { |
} |
SourceSpan.prototype.get$file = function() { return this.file; }; |
SourceSpan.prototype.get$start = function() { return this.start; }; |
-SourceSpan.prototype.get$end = function() { return this.end; }; |
SourceSpan.prototype.get$text = function() { |
return this.file.get$text().substring(this.start, this.end); |
} |
@@ -7002,13 +6773,6 @@ SourceSpan.prototype.compareTo = function(other) { |
} |
return this.file.compareTo(other.file); |
} |
-SourceSpan.prototype.compareTo$1 = SourceSpan.prototype.compareTo; |
-SourceSpan.prototype.end$0 = function() { |
- return this.end.call$0(); |
-}; |
-SourceSpan.prototype.start$0 = function() { |
- return this.start.call$0(); |
-}; |
// ********** Code for InterpStack ************** |
function InterpStack(previous, quote, isMultiline) { |
this.quote = quote; |
@@ -7030,9 +6794,6 @@ InterpStack.push = function(stack, quote, isMultiline) { |
if (stack != null) newStack.set$previous(stack); |
return newStack; |
} |
-InterpStack.prototype.next$0 = function() { |
- return this.next.call$0(); |
-}; |
// ********** Code for TokenizerHelpers ************** |
function TokenizerHelpers() { |
@@ -7209,7 +6970,7 @@ TokenizerBase.prototype.readHex = function(hexLength) { |
} |
} |
TokenizerBase._hexDigit(this._text.charCodeAt(this._lang_index)); |
- result = (result * (16)) + digit; |
+ result = $add(($mul(result, (16))), digit); |
this._lang_index++; |
} |
return result; |
@@ -7274,9 +7035,9 @@ TokenizerBase.prototype.finishMultilineString = function(quote) { |
if (this._maybeEatChar(quote)) { |
return this._makeStringToken(buf, false); |
} |
- buf.add$1(quote); |
+ buf.add(quote); |
} |
- buf.add$1(quote); |
+ buf.add(quote); |
} |
else if (ch == (36)) { |
this._interpStack = InterpStack.push(this._interpStack, quote, true); |
@@ -7288,11 +7049,11 @@ TokenizerBase.prototype.finishMultilineString = function(quote) { |
return this._errorToken("invalid hex escape sequence"); |
} |
else { |
- buf.add$1(escapeVal); |
+ buf.add(escapeVal); |
} |
} |
else { |
- buf.add$1(ch); |
+ buf.add(ch); |
} |
} |
} |
@@ -7377,11 +7138,11 @@ TokenizerBase.prototype.finishStringBody = function(quote) { |
return this._errorToken("invalid hex escape sequence"); |
} |
else { |
- buf.add$1(escapeVal); |
+ buf.add(escapeVal); |
} |
} |
else { |
- buf.add$1(ch); |
+ buf.add(ch); |
} |
} |
} |
@@ -7489,7 +7250,6 @@ TokenizerBase.prototype.finishIdentifier = function(ch) { |
return this._finishToken(kind); |
} |
} |
-TokenizerBase.prototype.next$0 = TokenizerBase.prototype.next; |
// ********** Code for Tokenizer ************** |
$inherits(Tokenizer, TokenizerBase); |
function Tokenizer(source, skipWhitespace, index) { |
@@ -7832,7 +7592,7 @@ Tokenizer.prototype.next = function() { |
Tokenizer.prototype.getIdentifierKind = function() { |
var i0 = this._startIndex; |
var ch; |
- switch (this._lang_index - i0) { |
+ switch ($sub(this._lang_index, i0)) { |
case (2): |
ch = this._text.charCodeAt(i0); |
@@ -8043,7 +7803,6 @@ Tokenizer.prototype.getIdentifierKind = function() { |
} |
} |
-Tokenizer.prototype.next$0 = Tokenizer.prototype.next; |
// ********** Code for TokenKind ************** |
function TokenKind() {} |
TokenKind.kindToString = function(kind) { |
@@ -8514,7 +8273,7 @@ TokenKind.kindToString = function(kind) { |
default: |
- return "TokenKind(" + kind.toString$0() + ")"; |
+ return $add($add("TokenKind(", kind.toString$0()), ")"); |
} |
} |
@@ -8866,7 +8625,7 @@ function Parser(source, diet, throwOnIncomplete, optionalSemicolons, startOffset |
this.diet = diet; |
this._afterParensIndex = (0); |
this.tokenizer = new Tokenizer(this.source, true, startOffset); |
- this._peekToken = this.tokenizer.next$0(); |
+ this._peekToken = this.tokenizer.next(); |
this._afterParens = []; |
} |
Parser.prototype.get$enableAwait = function() { |
@@ -8900,7 +8659,7 @@ Parser.prototype._peek = function() { |
} |
Parser.prototype._lang_next = function() { |
this._previousToken = this._peekToken; |
- this._peekToken = this.tokenizer.next$0(); |
+ this._peekToken = this.tokenizer.next(); |
return this._previousToken; |
} |
Parser.prototype._peekKind = function(kind) { |
@@ -8915,7 +8674,7 @@ Parser.prototype._isIdentifier = function(kind) { |
Parser.prototype._maybeEat = function(kind) { |
if (this._peekToken.kind == kind) { |
this._previousToken = this._peekToken; |
- this._peekToken = this.tokenizer.next$0(); |
+ this._peekToken = this.tokenizer.next(); |
return true; |
} |
else { |
@@ -8954,14 +8713,14 @@ Parser.prototype._skipBlock = function() { |
this._eat((6)); |
while (true) { |
var tok = this._lang_next(); |
- if ($eq(tok.get$kind(), (6))) { |
+ if (tok.get$kind() == (6)) { |
depth += (1); |
} |
- else if ($eq(tok.get$kind(), (7))) { |
+ else if (tok.get$kind() == (7)) { |
depth -= (1); |
if (depth == (0)) return; |
} |
- else if ($eq(tok.get$kind(), (1))) { |
+ else if (tok.get$kind() == (1)) { |
this._lang_error("unexpected end of file during diet parse", tok.get$span()); |
return; |
} |
@@ -8974,11 +8733,11 @@ Parser.prototype.compilationUnit = function() { |
var ret = []; |
this._maybeEat((13)); |
while (this._peekKind((12))) { |
- ret.add$1(this.directive()); |
+ ret.add(this.directive()); |
} |
this._recover = false; |
while (!this._maybeEat((1))) { |
- ret.add$1(this.topLevelDefinition()); |
+ ret.add(this.topLevelDefinition()); |
} |
this._recover = false; |
return ret; |
@@ -9030,7 +8789,7 @@ Parser.prototype.classDefinition = function(kind) { |
var _native = null; |
if (this._maybeEat((80))) { |
_native = this.maybeStringLiteral(); |
- if (_native != null) _native = new NativeType(_native); |
+ if ($ne(_native)) _native = new NativeType(_native); |
} |
var oldFactory = this._maybeEat((74)); |
var defaultType = null; |
@@ -9039,16 +8798,16 @@ Parser.prototype.classDefinition = function(kind) { |
$globals.world.warning("factory no longer supported, use \"default\" instead", this._previousToken.get$span()); |
} |
var baseType = this.nameTypeReference(); |
- var typeParams0 = null; |
+ var factTypeParams = null; |
if (this._peekKind((52))) { |
- typeParams0 = this.typeParameters(); |
+ factTypeParams = this.typeParameters(); |
} |
- defaultType = new DefaultTypeReference(oldFactory, baseType, typeParams0, this._makeSpan(baseType.get$span().get$start())); |
+ defaultType = new DefaultTypeReference(oldFactory, baseType, factTypeParams, this._makeSpan(baseType.get$span().start)); |
} |
var body = []; |
if (this._maybeEat((6))) { |
while (!this._maybeEat((7))) { |
- body.add$1(this.declaration(true)); |
+ body.add(this.declaration(true)); |
if (this._recover) { |
if (!this._recoverTo((7), (10))) break; |
this._maybeEat((10)); |
@@ -9077,7 +8836,7 @@ Parser.prototype.initializers = function() { |
this._inhibitLambda = true; |
var ret = []; |
do { |
- ret.add$1(this.expression()); |
+ ret.add(this.expression()); |
} |
while (this._maybeEat((11))) |
this._inhibitLambda = false; |
@@ -9115,12 +8874,12 @@ Parser.prototype.finishField = function(start, modifiers, type, name, value) { |
var names = [name]; |
var values = [value]; |
while (this._maybeEat((11))) { |
- names.add$1(this.identifier()); |
+ names.add(this.identifier()); |
if (this._maybeEat((20))) { |
- values.add$1(this.expression()); |
+ values.add(this.expression()); |
} |
else { |
- values.add$1(); |
+ values.add(); |
} |
} |
this._eatSemicolon(); |
@@ -9137,10 +8896,10 @@ Parser.prototype.finishDefinition = function(start, modifiers, di) { |
} |
if (this._maybeEat((80))) { |
native_ = this.maybeStringLiteral(); |
- if (native_ == null) native_ = ""; |
+ if ($eq(native_)) native_ = ""; |
} |
var body = this.functionBody(false); |
- if (di.get$name() == null) { |
+ if ($eq(di.get$name())) { |
di.set$name(di.get$type().get$name()); |
} |
return new FunctionDefinition(modifiers, di.get$type(), di.get$name(), formals, inits, native_, body, this._makeSpan(start)); |
@@ -9176,11 +8935,11 @@ Parser.prototype.factoryConstructorDeclaration = function() { |
var factoryToken = this._lang_next(); |
var names = [this.identifier()]; |
while (this._maybeEat((14))) { |
- names.add$1(this.identifier()); |
+ names.add(this.identifier()); |
} |
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().start)); |
} |
var name = null; |
var type = null; |
@@ -9189,7 +8948,7 @@ Parser.prototype.factoryConstructorDeclaration = function() { |
} |
else { |
if (names.get$length() > (1)) { |
- name = names.removeLast$0(); |
+ name = names.removeLast(); |
} |
else { |
name = new Identifier("", names.$index((0)).get$span()); |
@@ -9271,15 +9030,15 @@ Parser.prototype.statement = function() { |
} |
} |
Parser.prototype.finishExpressionAsStatement = function(expr) { |
- var start = expr.get$span().get$start(); |
+ var start = expr.get$span().start; |
if (this._maybeEat((8))) { |
var label = this._makeLabel(expr); |
return new LabeledStatement(label, this.statement(), this._makeSpan(start)); |
} |
if ((expr instanceof LambdaExpression)) { |
- if (!(expr.get$func().get$body() instanceof BlockStatement)) { |
+ if (!(expr.get$func().body instanceof BlockStatement)) { |
this._eatSemicolon(); |
- expr.get$func().set$span(this._makeSpan(start)); |
+ expr.get$func().span = this._makeSpan(start); |
} |
return expr.get$func(); |
} |
@@ -9303,11 +9062,11 @@ Parser.prototype.finishExpressionAsStatement = function(expr) { |
if (this._maybeEat((20))) { |
value = this.expression(); |
} |
- return this.finishField(expr.get$span().get$start(), null, gt, name, value); |
+ return this.finishField(expr.get$span().start, null, gt, name, value); |
} |
else { |
this._eatSemicolon(); |
- return new ExpressionStatement(expr, this._makeSpan(expr.get$span().get$start())); |
+ return new ExpressionStatement(expr, this._makeSpan(expr.get$span().start)); |
} |
} |
Parser.prototype.testCondition = function() { |
@@ -9321,7 +9080,7 @@ Parser.prototype.block = function() { |
this._eat((6)); |
var stmts = []; |
while (!this._maybeEat((7))) { |
- stmts.add$1(this.statement()); |
+ stmts.add(this.statement()); |
if (this._recover && !this._recoverTo((7), (10))) break; |
} |
this._recover = false; |
@@ -9374,9 +9133,9 @@ Parser.prototype.forStatement = function() { |
} |
var step = []; |
if (!this._maybeEat((3))) { |
- step.add$1(this.expression()); |
+ step.add(this.expression()); |
while (this._maybeEat((11))) { |
- step.add$1(this.expression()); |
+ step.add(this.expression()); |
} |
this._eat((3)); |
} |
@@ -9395,7 +9154,7 @@ Parser.prototype.forInitializerStatement = function(start) { |
var typeArgs = [this._makeType(init.get$y())]; |
var gt = this._finishTypeArguments(baseType, (0), typeArgs); |
var name = this.identifier(); |
- init = new DeclaredIdentifier(gt, name, this._makeSpan(init.get$span().get$start())); |
+ init = new DeclaredIdentifier(gt, name, this._makeSpan(init.get$span().start)); |
} |
if (this._maybeEat((103))) { |
return this._finishForIn(start, this._makeDeclaredIdentifier(init)); |
@@ -9417,7 +9176,7 @@ Parser.prototype.tryStatement = function() { |
var body = this.block(); |
var catches = []; |
while (this._peekKind((90))) { |
- catches.add$1(this.catchNode()); |
+ catches.add(this.catchNode()); |
} |
var finallyBlock = null; |
if (this._maybeEat((100))) { |
@@ -9445,7 +9204,7 @@ Parser.prototype.switchStatement = function() { |
var cases = []; |
this._eat((6)); |
while (!this._maybeEat((7))) { |
- cases.add$1(this.caseNode()); |
+ cases.add(this.caseNode()); |
} |
return new SwitchStatement(test, cases, this._makeSpan(start)); |
} |
@@ -9463,23 +9222,23 @@ Parser.prototype.caseNode = function() { |
var cases = []; |
while (true) { |
if (this._maybeEat((89))) { |
- cases.add$1(this.expression()); |
+ cases.add(this.expression()); |
this._eat((8)); |
} |
else if (this._maybeEat((94))) { |
- cases.add$1(); |
+ cases.add(); |
this._eat((8)); |
} |
else { |
break; |
} |
} |
- if ($eq(cases.get$length(), (0))) { |
+ if (cases.get$length() == (0)) { |
this._lang_error("case or default"); |
} |
var stmts = []; |
while (!this._peekCaseEnd()) { |
- stmts.add$1(this.statement()); |
+ stmts.add(this.statement()); |
if (this._recover && !this._recoverTo((7), (89), (94))) { |
break; |
} |
@@ -9554,7 +9313,7 @@ Parser.prototype._makeType = function(expr) { |
type.set$names([expr.get$name()]); |
} |
else { |
- type.get$names().add$1(expr.get$name()); |
+ type.get$names().add(expr.get$name()); |
} |
type.set$span(expr.get$span()); |
return type; |
@@ -9569,7 +9328,7 @@ Parser.prototype.infixExpression = function(precedence) { |
} |
Parser.prototype._finishDeclaredId = function(type) { |
var name = this.identifier(); |
- return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._makeSpan(type.get$span().get$start()))); |
+ return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._makeSpan(type.get$span().start))); |
} |
Parser.prototype._fixAsType = function(x) { |
if (this._maybeEat((53))) { |
@@ -9600,21 +9359,21 @@ Parser.prototype.finishInfixExpression = function(x, precedence) { |
while (true) { |
var kind = this._peek(); |
var prec = TokenKind.infixPrecedence(this._peek()); |
- if (prec >= precedence) { |
+ if ($gte(prec, precedence)) { |
if (kind == (52) || kind == (53)) { |
if (this._isBin(x, (52))) { |
return this._fixAsType(x); |
} |
} |
var op = this._lang_next(); |
- if ($eq(op.get$kind(), (104))) { |
+ if (op.get$kind() == (104)) { |
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 : $add(prec, (1))); |
- if ($eq(op.get$kind(), (33))) { |
+ if (op.get$kind() == (33)) { |
this._eat((8)); |
var z = this.infixExpression(prec); |
x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start)); |
@@ -9667,7 +9426,7 @@ Parser.prototype.argument = function() { |
label = new Identifier("...", this._makeSpan(start)); |
} |
expr = this.expression(); |
- if (label == null && this._maybeEat((8))) { |
+ if ($eq(label) && this._maybeEat((8))) { |
label = this._makeLabel(expr); |
expr = this.expression(); |
} |
@@ -9680,7 +9439,7 @@ Parser.prototype.arguments = function() { |
this._inhibitLambda = false; |
if (!this._maybeEat((3))) { |
do { |
- args.add$1(this.argument()); |
+ args.add(this.argument()); |
} |
while (this._maybeEat((11))) |
this._eat((3)); |
@@ -9699,20 +9458,20 @@ Parser.prototype.finishPostfixExpression = function(expr) { |
this._eat((4)); |
var index = this.expression(); |
this._eat((5)); |
- return this.finishPostfixExpression(new IndexExpression(expr, index, this._makeSpan(expr.get$span().get$start()))); |
+ return this.finishPostfixExpression(new IndexExpression(expr, index, this._makeSpan(expr.get$span().start))); |
case (14): |
this._eat((14)); |
var name = this.identifier(); |
- var ret = new DotExpression(expr, name, this._makeSpan(expr.get$span().get$start())); |
+ var ret = new DotExpression(expr, name, this._makeSpan(expr.get$span().start)); |
return this.finishPostfixExpression(ret); |
case (16): |
case (17): |
var tok = this._lang_next(); |
- return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().get$start())); |
+ return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().start)); |
case (9): |
case (6): |
@@ -9722,7 +9481,7 @@ Parser.prototype.finishPostfixExpression = function(expr) { |
default: |
if (this._peekIdentifier()) { |
- return this.finishPostfixExpression(new DeclaredIdentifier(this._makeType(expr), this.identifier(), this._makeSpan(expr.get$span().get$start()))); |
+ return this.finishPostfixExpression(new DeclaredIdentifier(this._makeType(expr), this.identifier(), this._makeSpan(expr.get$span().start))); |
} |
else { |
return expr; |
@@ -9741,11 +9500,11 @@ Parser.prototype.finishCallOrLambdaExpression = function(expr) { |
this._lang_error("illegal target for call, did you mean to declare a function?", expr.get$span()); |
} |
var args = this.arguments(); |
- return this.finishPostfixExpression(new CallExpression(expr, args, this._makeSpan(expr.get$span().get$start()))); |
+ return this.finishPostfixExpression(new CallExpression(expr, args, this._makeSpan(expr.get$span().start))); |
} |
} |
Parser.prototype._isBin = function(expr, kind) { |
- return (expr instanceof BinaryExpression) && $eq(expr.get$op().get$kind(), kind); |
+ return (expr instanceof BinaryExpression) && expr.get$op().kind == kind; |
} |
Parser.prototype._makeLiteral = function(value) { |
return new LiteralExpression(value, value.span); |
@@ -9861,24 +9620,24 @@ Parser.prototype.stringInterpolation = function() { |
var startQuote = null, endQuote = null; |
while (this._peekKind((59))) { |
var token = this._lang_next(); |
- pieces.add$1(this._makeLiteral(Value.fromString(token.get$value(), token.get$span()))); |
+ pieces.add(this._makeLiteral(Value.fromString(token.get$value(), token.get$span()))); |
if (this._maybeEat((6))) { |
- pieces.add$1(this.expression()); |
+ pieces.add(this.expression()); |
this._eat((7)); |
} |
else if (this._maybeEat((110))) { |
- pieces.add$1(new ThisExpression(this._previousToken.get$span())); |
+ pieces.add(new ThisExpression(this._previousToken.get$span())); |
} |
else { |
var id = this.identifier(); |
- pieces.add$1(new VarExpression(id, id.get$span())); |
+ pieces.add(new VarExpression(id, id.get$span())); |
} |
} |
var tok = this._lang_next(); |
- if ($ne(tok.get$kind(), (58))) { |
+ if (tok.get$kind() != (58)) { |
this._errorExpected("interpolated string"); |
} |
- pieces.add$1(this._makeLiteral(Value.fromString(tok.get$value(), tok.get$span()))); |
+ pieces.add(this._makeLiteral(Value.fromString(tok.get$value(), tok.get$span()))); |
var span = this._makeSpan(start); |
return new StringInterpExpression(pieces, span); |
} |
@@ -9930,14 +9689,14 @@ Parser.prototype._peekAfterCloseParen = function() { |
var tokens = [this._lang_next()]; |
this._lookaheadAfterParens(tokens); |
var after = this._peekToken; |
- tokens.add$1(after); |
+ tokens.add(after); |
this.tokenizer = new DivertedTokenSource(tokens, this, this.tokenizer); |
this._lang_next(); |
return after; |
} |
Parser.prototype._lookaheadAfterParens = function(tokens) { |
var saved = this._afterParens.get$length(); |
- this._afterParens.add(null); |
+ this._afterParens.add(); |
while (true) { |
var token = this._lang_next(); |
tokens.add(token); |
@@ -10030,10 +9789,10 @@ Parser.prototype.declaredIdentifier = function(includeOperators) { |
var start = this._peekToken.start; |
var myType = null; |
var name = this._specialIdentifier(includeOperators); |
- if (name == null) { |
+ if ($eq(name)) { |
myType = this.type((0)); |
name = this._specialIdentifier(includeOperators); |
- if (name == null) { |
+ if ($eq(name)) { |
if (this._peekIdentifier()) { |
name = this.identifier(); |
} |
@@ -10063,7 +9822,7 @@ Parser.prototype.finishListLiteral = function(start, isConst, itemType) { |
var values = []; |
this._eat((4)); |
while (!this._maybeEat((5))) { |
- values.add$1(this.expression()); |
+ values.add(this.expression()); |
if (this._recover && !this._recoverTo((5), (11))) break; |
if (!this._maybeEat((11))) { |
this._eat((5)); |
@@ -10076,9 +9835,9 @@ Parser.prototype.finishMapLiteral = function(start, isConst, keyType, valueType) |
var items = []; |
this._eat((6)); |
while (!this._maybeEat((7))) { |
- items.add$1(this.expression()); |
+ items.add(this.expression()); |
this._eat((8)); |
- items.add$1(this.expression()); |
+ items.add(this.expression()); |
if (this._recover && !this._recoverTo((7), (11))) break; |
if (!this._maybeEat((11))) { |
this._eat((7)); |
@@ -10093,20 +9852,20 @@ Parser.prototype.finishTypedLiteral = function(start, isConst) { |
var genericType = this.addTypeArguments(typeToBeNamedLater, (0)); |
var typeArgs = genericType.get$typeArguments(); |
if (this._peekKind((4)) || this._peekKind((56))) { |
- if ($ne(typeArgs.get$length(), (1))) { |
+ if (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))) { |
+ if (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()); |
+ else if (typeArgs.get$length() == (2)) { |
+ keyType = typeArgs.$index((0)); |
+ $globals.world.warning("a map literal takes one type argument specifying the value type", keyType.get$span()); |
valueType = typeArgs.$index((1)); |
} |
return this.finishMapLiteral(start, isConst, keyType, valueType); |
@@ -10125,8 +9884,8 @@ Parser.prototype._readModifiers = function() { |
case (71): |
case (74): |
- if (modifiers == null) modifiers = []; |
- modifiers.add$1(this._lang_next()); |
+ if ($eq(modifiers)) modifiers = []; |
+ modifiers.add(this._lang_next()); |
break; |
default: |
@@ -10156,8 +9915,8 @@ Parser.prototype.typeParameters = function() { |
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$dynamic().get$depth(), (0))) { |
+ ret.add(tp); |
+ if ((tp.get$typeParameter().get$extendsType() instanceof GenericTypeReference) && tp.get$typeParameter().get$extendsType().get$dynamic().get$depth() == (0)) { |
closed = true; |
break; |
} |
@@ -10194,15 +9953,15 @@ Parser.prototype._finishTypeArguments = function(baseType, depth, types) { |
var delta = (-1); |
do { |
var myType = this.type(depth + (1)); |
- types.add$1(myType); |
+ types.add(myType); |
if ((myType instanceof GenericTypeReference) && myType.get$depth() <= depth) { |
delta = depth - myType.get$depth(); |
break; |
} |
} |
while (this._maybeEat((11))) |
- if (delta >= (0)) { |
- depth = depth - delta; |
+ if ($gte(delta, (0))) { |
+ depth = $sub(depth, delta); |
} |
else { |
depth = this._eatClosingAngle(depth); |
@@ -10213,7 +9972,7 @@ Parser.prototype._finishTypeArguments = function(baseType, depth, types) { |
Parser.prototype.typeList = function() { |
var types = []; |
do { |
- types.add$1(this.type((0))); |
+ types.add(this.type((0))); |
} |
while (this._maybeEat((11))) |
return types; |
@@ -10227,11 +9986,11 @@ Parser.prototype.nameTypeReference = function() { |
switch (this._peek()) { |
case (115): |
- return new TypeReference(this._lang_next().get$span(), $globals.world.voidType); |
+ return new SimpleTypeReference($globals.world.voidType, this._lang_next().get$span()); |
case (114): |
- return new TypeReference(this._lang_next().get$span(), $globals.world.varType); |
+ return new SimpleTypeReference($globals.world.varType, this._lang_next().get$span()); |
case (99): |
@@ -10247,8 +10006,8 @@ Parser.prototype.nameTypeReference = function() { |
} |
while (this._maybeEat((14))) { |
- if (names == null) names = []; |
- names.add$1(this.identifier()); |
+ if ($eq(names)) names = []; |
+ names.add(this.identifier()); |
} |
return new NameTypeReference(isFinal, name, names, this._makeSpan(start)); |
} |
@@ -10272,7 +10031,7 @@ Parser.prototype.formalParameter = function(inOptionalBlock) { |
var di = this.declaredIdentifier(false); |
var type = di.get$type(); |
var name = di.get$name(); |
- if (name == null) { |
+ if ($eq(name)) { |
this._lang_error("Formal parameter invalid", this._makeSpan(start)); |
} |
var value = null; |
@@ -10287,7 +10046,7 @@ Parser.prototype.formalParameter = function(inOptionalBlock) { |
var func = new FunctionDefinition(null, type, name, formals, null, null, null, this._makeSpan(start)); |
type = new FunctionTypeReference(false, func, func.get$span()); |
} |
- if (inOptionalBlock && value == null) { |
+ if (inOptionalBlock && $eq(value)) { |
value = this._makeLiteral(Value.fromNull(this._makeSpan(start))); |
} |
return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start)); |
@@ -10300,7 +10059,7 @@ Parser.prototype.formalParameterList = function() { |
if (this._maybeEat((4))) { |
inOptionalBlock = true; |
} |
- formals.add$1(this.formalParameter(inOptionalBlock)); |
+ formals.add(this.formalParameter(inOptionalBlock)); |
while (this._maybeEat((11))) { |
if (this._maybeEat((4))) { |
if (inOptionalBlock) { |
@@ -10308,7 +10067,7 @@ Parser.prototype.formalParameterList = function() { |
} |
inOptionalBlock = true; |
} |
- formals.add$1(this.formalParameter(inOptionalBlock)); |
+ formals.add(this.formalParameter(inOptionalBlock)); |
} |
if (inOptionalBlock) { |
this._eat((5)); |
@@ -10322,7 +10081,7 @@ Parser.prototype.identifierForType = function() { |
if (!this._isIdentifier(tok.get$kind())) { |
this._lang_error(("expected identifier, but found " + tok), tok.get$span()); |
} |
- if (tok.get$kind() != (70) && $ne(tok.get$kind(), (80))) { |
+ if (tok.get$kind() != (70) && tok.get$kind() != (80)) { |
this._lang_error(("" + tok + " may not be used as a type name"), tok.get$span()); |
} |
return new Identifier(tok.get$text(), this._makeSpan(tok.get$start())); |
@@ -10343,14 +10102,14 @@ Parser.prototype._makeFunction = function(expr, formals, body) { |
else if ((expr instanceof DeclaredIdentifier)) { |
name = expr.get$name(); |
type = expr.get$type(); |
- if (name == null) { |
+ if ($eq(name)) { |
this._lang_error("expected name and type", expr.get$span()); |
} |
} |
else { |
this._lang_error("bad function body", expr.get$span()); |
} |
- var span = new SourceSpan(expr.get$span().get$file(), expr.get$span().get$start(), body.get$span().get$end()); |
+ var span = new SourceSpan(expr.get$span().file, expr.get$span().start, body.get$span().end); |
var func = new FunctionDefinition(null, type, name, formals, null, null, body, span); |
return new LambdaExpression(func, func.get$span()); |
} |
@@ -10375,8 +10134,6 @@ Parser.prototype._makeLabel = function(expr) { |
return null; |
} |
} |
-Parser.prototype.block$0 = Parser.prototype.block; |
-Parser.prototype.compilationUnit$0 = Parser.prototype.compilationUnit; |
// ********** Code for IncompleteSourceException ************** |
function IncompleteSourceException(token) { |
this.token = token; |
@@ -10401,14 +10158,12 @@ DivertedTokenSource.prototype.next = function() { |
} |
return token; |
} |
-DivertedTokenSource.prototype.next$0 = DivertedTokenSource.prototype.next; |
// ********** Code for Node ************** |
function Node(span) { |
this.span = span; |
} |
Node.prototype.get$span = function() { return this.span; }; |
Node.prototype.set$span = function(value) { return this.span = value; }; |
-Node.prototype.visit$1 = Node.prototype.visit; |
// ********** Code for Statement ************** |
$inherits(Statement, Node); |
function Statement(span) { |
@@ -10432,19 +10187,9 @@ function Expression(span) { |
} |
// ********** Code for TypeReference ************** |
$inherits(TypeReference, Node); |
-function TypeReference(span, type) { |
- this.type = type; |
+function TypeReference(span) { |
Node.call(this, span); |
} |
-TypeReference.prototype.get$type = function() { return this.type; }; |
-TypeReference.prototype.set$type = function(value) { return this.type = value; }; |
-TypeReference.prototype.visit = function(visitor) { |
- return visitor.visitTypeReference(this); |
-} |
-TypeReference.prototype.get$isFinal = function() { |
- return false; |
-} |
-TypeReference.prototype.visit$1 = TypeReference.prototype.visit; |
// ********** Code for DirectiveDefinition ************** |
$inherits(DirectiveDefinition, Definition); |
function DirectiveDefinition(name, arguments, span) { |
@@ -10457,7 +10202,6 @@ DirectiveDefinition.prototype.set$name = function(value) { return this.name = va |
DirectiveDefinition.prototype.visit = function(visitor) { |
return visitor.visitDirectiveDefinition(this); |
} |
-DirectiveDefinition.prototype.visit$1 = DirectiveDefinition.prototype.visit; |
// ********** Code for TypeDefinition ************** |
$inherits(TypeDefinition, Definition); |
function TypeDefinition(isClass, name, typeParameters, extendsTypes, implementsTypes, nativeType, defaultType, body, span) { |
@@ -10484,7 +10228,6 @@ TypeDefinition.prototype.set$body = function(value) { return this.body = value; |
TypeDefinition.prototype.visit = function(visitor) { |
return visitor.visitTypeDefinition(this); |
} |
-TypeDefinition.prototype.visit$1 = TypeDefinition.prototype.visit; |
// ********** Code for FunctionTypeDefinition ************** |
$inherits(FunctionTypeDefinition, Definition); |
function FunctionTypeDefinition(func, typeParameters, span) { |
@@ -10499,7 +10242,6 @@ FunctionTypeDefinition.prototype.set$typeParameters = function(value) { return t |
FunctionTypeDefinition.prototype.visit = function(visitor) { |
return visitor.visitFunctionTypeDefinition(this); |
} |
-FunctionTypeDefinition.prototype.visit$1 = FunctionTypeDefinition.prototype.visit; |
// ********** Code for VariableDefinition ************** |
$inherits(VariableDefinition, Definition); |
function VariableDefinition(modifiers, type, names, values, span) { |
@@ -10514,9 +10256,8 @@ VariableDefinition.prototype.set$type = function(value) { return this.type = val |
VariableDefinition.prototype.get$names = function() { return this.names; }; |
VariableDefinition.prototype.set$names = function(value) { return this.names = value; }; |
VariableDefinition.prototype.visit = function(visitor) { |
- return visitor.visitVariableDefinition$1(this); |
+ return visitor.visitVariableDefinition(this); |
} |
-VariableDefinition.prototype.visit$1 = VariableDefinition.prototype.visit; |
// ********** Code for FunctionDefinition ************** |
$inherits(FunctionDefinition, Definition); |
function FunctionDefinition(modifiers, returnType, name, formals, initializers, nativeBody, body, span) { |
@@ -10535,14 +10276,11 @@ FunctionDefinition.prototype.get$name = function() { return this.name; }; |
FunctionDefinition.prototype.set$name = function(value) { return this.name = value; }; |
FunctionDefinition.prototype.get$initializers = function() { return this.initializers; }; |
FunctionDefinition.prototype.set$initializers = function(value) { return this.initializers = value; }; |
-FunctionDefinition.prototype.get$nativeBody = function() { return this.nativeBody; }; |
-FunctionDefinition.prototype.set$nativeBody = function(value) { return this.nativeBody = value; }; |
FunctionDefinition.prototype.get$body = function() { return this.body; }; |
FunctionDefinition.prototype.set$body = function(value) { return this.body = value; }; |
FunctionDefinition.prototype.visit = function(visitor) { |
- return visitor.visitFunctionDefinition$1(this); |
+ return visitor.visitFunctionDefinition(this); |
} |
-FunctionDefinition.prototype.visit$1 = FunctionDefinition.prototype.visit; |
// ********** Code for ReturnStatement ************** |
$inherits(ReturnStatement, Statement); |
function ReturnStatement(value, span) { |
@@ -10552,9 +10290,8 @@ function ReturnStatement(value, span) { |
ReturnStatement.prototype.get$value = function() { return this.value; }; |
ReturnStatement.prototype.set$value = function(value) { return this.value = value; }; |
ReturnStatement.prototype.visit = function(visitor) { |
- return visitor.visitReturnStatement$1(this); |
+ return visitor.visitReturnStatement(this); |
} |
-ReturnStatement.prototype.visit$1 = ReturnStatement.prototype.visit; |
// ********** Code for ThrowStatement ************** |
$inherits(ThrowStatement, Statement); |
function ThrowStatement(value, span) { |
@@ -10564,9 +10301,8 @@ function ThrowStatement(value, span) { |
ThrowStatement.prototype.get$value = function() { return this.value; }; |
ThrowStatement.prototype.set$value = function(value) { return this.value = value; }; |
ThrowStatement.prototype.visit = function(visitor) { |
- return visitor.visitThrowStatement$1(this); |
+ return visitor.visitThrowStatement(this); |
} |
-ThrowStatement.prototype.visit$1 = ThrowStatement.prototype.visit; |
// ********** Code for AssertStatement ************** |
$inherits(AssertStatement, Statement); |
function AssertStatement(test, span) { |
@@ -10574,9 +10310,8 @@ function AssertStatement(test, span) { |
Statement.call(this, span); |
} |
AssertStatement.prototype.visit = function(visitor) { |
- return visitor.visitAssertStatement$1(this); |
+ return visitor.visitAssertStatement(this); |
} |
-AssertStatement.prototype.visit$1 = AssertStatement.prototype.visit; |
// ********** Code for BreakStatement ************** |
$inherits(BreakStatement, Statement); |
function BreakStatement(label, span) { |
@@ -10586,9 +10321,8 @@ function BreakStatement(label, span) { |
BreakStatement.prototype.get$label = function() { return this.label; }; |
BreakStatement.prototype.set$label = function(value) { return this.label = value; }; |
BreakStatement.prototype.visit = function(visitor) { |
- return visitor.visitBreakStatement$1(this); |
+ return visitor.visitBreakStatement(this); |
} |
-BreakStatement.prototype.visit$1 = BreakStatement.prototype.visit; |
// ********** Code for ContinueStatement ************** |
$inherits(ContinueStatement, Statement); |
function ContinueStatement(label, span) { |
@@ -10598,9 +10332,8 @@ function ContinueStatement(label, span) { |
ContinueStatement.prototype.get$label = function() { return this.label; }; |
ContinueStatement.prototype.set$label = function(value) { return this.label = value; }; |
ContinueStatement.prototype.visit = function(visitor) { |
- return visitor.visitContinueStatement$1(this); |
+ return visitor.visitContinueStatement(this); |
} |
-ContinueStatement.prototype.visit$1 = ContinueStatement.prototype.visit; |
// ********** Code for IfStatement ************** |
$inherits(IfStatement, Statement); |
function IfStatement(test, trueBranch, falseBranch, span) { |
@@ -10610,9 +10343,8 @@ function IfStatement(test, trueBranch, falseBranch, span) { |
Statement.call(this, span); |
} |
IfStatement.prototype.visit = function(visitor) { |
- return visitor.visitIfStatement$1(this); |
+ return visitor.visitIfStatement(this); |
} |
-IfStatement.prototype.visit$1 = IfStatement.prototype.visit; |
// ********** Code for WhileStatement ************** |
$inherits(WhileStatement, Statement); |
function WhileStatement(test, body, span) { |
@@ -10623,9 +10355,8 @@ function WhileStatement(test, body, span) { |
WhileStatement.prototype.get$body = function() { return this.body; }; |
WhileStatement.prototype.set$body = function(value) { return this.body = value; }; |
WhileStatement.prototype.visit = function(visitor) { |
- return visitor.visitWhileStatement$1(this); |
+ return visitor.visitWhileStatement(this); |
} |
-WhileStatement.prototype.visit$1 = WhileStatement.prototype.visit; |
// ********** Code for DoStatement ************** |
$inherits(DoStatement, Statement); |
function DoStatement(body, test, span) { |
@@ -10636,9 +10367,8 @@ function DoStatement(body, test, span) { |
DoStatement.prototype.get$body = function() { return this.body; }; |
DoStatement.prototype.set$body = function(value) { return this.body = value; }; |
DoStatement.prototype.visit = function(visitor) { |
- return visitor.visitDoStatement$1(this); |
+ return visitor.visitDoStatement(this); |
} |
-DoStatement.prototype.visit$1 = DoStatement.prototype.visit; |
// ********** Code for ForStatement ************** |
$inherits(ForStatement, Statement); |
function ForStatement(init, test, step, body, span) { |
@@ -10651,9 +10381,8 @@ function ForStatement(init, test, step, body, span) { |
ForStatement.prototype.get$body = function() { return this.body; }; |
ForStatement.prototype.set$body = function(value) { return this.body = value; }; |
ForStatement.prototype.visit = function(visitor) { |
- return visitor.visitForStatement$1(this); |
+ return visitor.visitForStatement(this); |
} |
-ForStatement.prototype.visit$1 = ForStatement.prototype.visit; |
// ********** Code for ForInStatement ************** |
$inherits(ForInStatement, Statement); |
function ForInStatement(item, list, body, span) { |
@@ -10665,9 +10394,8 @@ function ForInStatement(item, list, body, span) { |
ForInStatement.prototype.get$body = function() { return this.body; }; |
ForInStatement.prototype.set$body = function(value) { return this.body = value; }; |
ForInStatement.prototype.visit = function(visitor) { |
- return visitor.visitForInStatement$1(this); |
+ return visitor.visitForInStatement(this); |
} |
-ForInStatement.prototype.visit$1 = ForInStatement.prototype.visit; |
// ********** Code for TryStatement ************** |
$inherits(TryStatement, Statement); |
function TryStatement(body, catches, finallyBlock, span) { |
@@ -10679,9 +10407,8 @@ function TryStatement(body, catches, finallyBlock, span) { |
TryStatement.prototype.get$body = function() { return this.body; }; |
TryStatement.prototype.set$body = function(value) { return this.body = value; }; |
TryStatement.prototype.visit = function(visitor) { |
- return visitor.visitTryStatement$1(this); |
+ return visitor.visitTryStatement(this); |
} |
-TryStatement.prototype.visit$1 = TryStatement.prototype.visit; |
// ********** Code for SwitchStatement ************** |
$inherits(SwitchStatement, Statement); |
function SwitchStatement(test, cases, span) { |
@@ -10692,9 +10419,8 @@ function SwitchStatement(test, cases, span) { |
SwitchStatement.prototype.get$cases = function() { return this.cases; }; |
SwitchStatement.prototype.set$cases = function(value) { return this.cases = value; }; |
SwitchStatement.prototype.visit = function(visitor) { |
- return visitor.visitSwitchStatement$1(this); |
+ return visitor.visitSwitchStatement(this); |
} |
-SwitchStatement.prototype.visit$1 = SwitchStatement.prototype.visit; |
// ********** Code for BlockStatement ************** |
$inherits(BlockStatement, Statement); |
function BlockStatement(body, span) { |
@@ -10704,9 +10430,8 @@ function BlockStatement(body, span) { |
BlockStatement.prototype.get$body = function() { return this.body; }; |
BlockStatement.prototype.set$body = function(value) { return this.body = value; }; |
BlockStatement.prototype.visit = function(visitor) { |
- return visitor.visitBlockStatement$1(this); |
+ return visitor.visitBlockStatement(this); |
} |
-BlockStatement.prototype.visit$1 = BlockStatement.prototype.visit; |
// ********** Code for LabeledStatement ************** |
$inherits(LabeledStatement, Statement); |
function LabeledStatement(name, body, span) { |
@@ -10719,9 +10444,8 @@ LabeledStatement.prototype.set$name = function(value) { return this.name = value |
LabeledStatement.prototype.get$body = function() { return this.body; }; |
LabeledStatement.prototype.set$body = function(value) { return this.body = value; }; |
LabeledStatement.prototype.visit = function(visitor) { |
- return visitor.visitLabeledStatement$1(this); |
+ return visitor.visitLabeledStatement(this); |
} |
-LabeledStatement.prototype.visit$1 = LabeledStatement.prototype.visit; |
// ********** Code for ExpressionStatement ************** |
$inherits(ExpressionStatement, Statement); |
function ExpressionStatement(body, span) { |
@@ -10731,27 +10455,24 @@ function ExpressionStatement(body, span) { |
ExpressionStatement.prototype.get$body = function() { return this.body; }; |
ExpressionStatement.prototype.set$body = function(value) { return this.body = value; }; |
ExpressionStatement.prototype.visit = function(visitor) { |
- return visitor.visitExpressionStatement$1(this); |
+ return visitor.visitExpressionStatement(this); |
} |
-ExpressionStatement.prototype.visit$1 = ExpressionStatement.prototype.visit; |
// ********** Code for EmptyStatement ************** |
$inherits(EmptyStatement, Statement); |
function EmptyStatement(span) { |
Statement.call(this, span); |
} |
EmptyStatement.prototype.visit = function(visitor) { |
- return visitor.visitEmptyStatement$1(this); |
+ return visitor.visitEmptyStatement(this); |
} |
-EmptyStatement.prototype.visit$1 = EmptyStatement.prototype.visit; |
// ********** Code for DietStatement ************** |
$inherits(DietStatement, Statement); |
function DietStatement(span) { |
Statement.call(this, span); |
} |
DietStatement.prototype.visit = function(visitor) { |
- return visitor.visitDietStatement$1(this); |
+ return visitor.visitDietStatement(this); |
} |
-DietStatement.prototype.visit$1 = DietStatement.prototype.visit; |
// ********** Code for LambdaExpression ************** |
$inherits(LambdaExpression, Expression); |
function LambdaExpression(func, span) { |
@@ -10761,9 +10482,8 @@ function LambdaExpression(func, span) { |
LambdaExpression.prototype.get$func = function() { return this.func; }; |
LambdaExpression.prototype.set$func = function(value) { return this.func = value; }; |
LambdaExpression.prototype.visit = function(visitor) { |
- return visitor.visitLambdaExpression$1(this); |
+ return visitor.visitLambdaExpression(this); |
} |
-LambdaExpression.prototype.visit$1 = LambdaExpression.prototype.visit; |
// ********** Code for CallExpression ************** |
$inherits(CallExpression, Expression); |
function CallExpression(target, arguments, span) { |
@@ -10774,7 +10494,6 @@ function CallExpression(target, arguments, span) { |
CallExpression.prototype.visit = function(visitor) { |
return visitor.visitCallExpression(this); |
} |
-CallExpression.prototype.visit$1 = CallExpression.prototype.visit; |
// ********** Code for IndexExpression ************** |
$inherits(IndexExpression, Expression); |
function IndexExpression(target, index, span) { |
@@ -10783,9 +10502,8 @@ function IndexExpression(target, index, span) { |
Expression.call(this, span); |
} |
IndexExpression.prototype.visit = function(visitor) { |
- return visitor.visitIndexExpression$1(this); |
+ return visitor.visitIndexExpression(this); |
} |
-IndexExpression.prototype.visit$1 = IndexExpression.prototype.visit; |
// ********** Code for BinaryExpression ************** |
$inherits(BinaryExpression, Expression); |
function BinaryExpression(op, x, y, span) { |
@@ -10803,7 +10521,6 @@ BinaryExpression.prototype.set$y = function(value) { return this.y = value; }; |
BinaryExpression.prototype.visit = function(visitor) { |
return visitor.visitBinaryExpression$1(this); |
} |
-BinaryExpression.prototype.visit$1 = BinaryExpression.prototype.visit; |
// ********** Code for UnaryExpression ************** |
$inherits(UnaryExpression, Expression); |
function UnaryExpression(op, self, span) { |
@@ -10818,7 +10535,6 @@ UnaryExpression.prototype.set$self = function(value) { return this.self = value; |
UnaryExpression.prototype.visit = function(visitor) { |
return visitor.visitUnaryExpression(this); |
} |
-UnaryExpression.prototype.visit$1 = UnaryExpression.prototype.visit; |
// ********** Code for PostfixExpression ************** |
$inherits(PostfixExpression, Expression); |
function PostfixExpression(body, op, span) { |
@@ -10833,7 +10549,6 @@ PostfixExpression.prototype.set$op = function(value) { return this.op = value; } |
PostfixExpression.prototype.visit = function(visitor) { |
return visitor.visitPostfixExpression$1(this); |
} |
-PostfixExpression.prototype.visit$1 = PostfixExpression.prototype.visit; |
// ********** Code for NewExpression ************** |
$inherits(NewExpression, Expression); |
function NewExpression(isConst, type, name, arguments, span) { |
@@ -10850,9 +10565,8 @@ NewExpression.prototype.set$type = function(value) { return this.type = value; } |
NewExpression.prototype.get$name = function() { return this.name; }; |
NewExpression.prototype.set$name = function(value) { return this.name = value; }; |
NewExpression.prototype.visit = function(visitor) { |
- return visitor.visitNewExpression$1(this); |
+ return visitor.visitNewExpression(this); |
} |
-NewExpression.prototype.visit$1 = NewExpression.prototype.visit; |
// ********** Code for ListExpression ************** |
$inherits(ListExpression, Expression); |
function ListExpression(isConst, itemType, values, span) { |
@@ -10866,7 +10580,6 @@ ListExpression.prototype.set$isConst = function(value) { return this.isConst = v |
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, keyType, valueType, items, span) { |
@@ -10879,9 +10592,8 @@ function MapExpression(isConst, keyType, valueType, items, span) { |
MapExpression.prototype.get$isConst = function() { return this.isConst; }; |
MapExpression.prototype.set$isConst = function(value) { return this.isConst = value; }; |
MapExpression.prototype.visit = function(visitor) { |
- return visitor.visitMapExpression$1(this); |
+ return visitor.visitMapExpression(this); |
} |
-MapExpression.prototype.visit$1 = MapExpression.prototype.visit; |
// ********** Code for ConditionalExpression ************** |
$inherits(ConditionalExpression, Expression); |
function ConditionalExpression(test, trueBranch, falseBranch, span) { |
@@ -10893,7 +10605,6 @@ function ConditionalExpression(test, trueBranch, falseBranch, span) { |
ConditionalExpression.prototype.visit = function(visitor) { |
return visitor.visitConditionalExpression(this); |
} |
-ConditionalExpression.prototype.visit$1 = ConditionalExpression.prototype.visit; |
// ********** Code for IsExpression ************** |
$inherits(IsExpression, Expression); |
function IsExpression(isTrue, x, type, span) { |
@@ -10909,7 +10620,6 @@ IsExpression.prototype.set$type = function(value) { return this.type = value; }; |
IsExpression.prototype.visit = function(visitor) { |
return visitor.visitIsExpression(this); |
} |
-IsExpression.prototype.visit$1 = IsExpression.prototype.visit; |
// ********** Code for ParenExpression ************** |
$inherits(ParenExpression, Expression); |
function ParenExpression(body, span) { |
@@ -10921,7 +10631,6 @@ ParenExpression.prototype.set$body = function(value) { return this.body = value; |
ParenExpression.prototype.visit = function(visitor) { |
return visitor.visitParenExpression(this); |
} |
-ParenExpression.prototype.visit$1 = ParenExpression.prototype.visit; |
// ********** Code for AwaitExpression ************** |
$inherits(AwaitExpression, Expression); |
function AwaitExpression(body, span) { |
@@ -10933,7 +10642,6 @@ AwaitExpression.prototype.set$body = function(value) { return this.body = value; |
AwaitExpression.prototype.visit = function(visitor) { |
return visitor.visitAwaitExpression(this); |
} |
-AwaitExpression.prototype.visit$1 = AwaitExpression.prototype.visit; |
// ********** Code for DotExpression ************** |
$inherits(DotExpression, Expression); |
function DotExpression(self, name, span) { |
@@ -10948,7 +10656,6 @@ DotExpression.prototype.set$name = function(value) { return this.name = value; } |
DotExpression.prototype.visit = function(visitor) { |
return visitor.visitDotExpression(this); |
} |
-DotExpression.prototype.visit$1 = DotExpression.prototype.visit; |
// ********** Code for VarExpression ************** |
$inherits(VarExpression, Expression); |
function VarExpression(name, span) { |
@@ -10960,7 +10667,6 @@ VarExpression.prototype.set$name = function(value) { return this.name = value; } |
VarExpression.prototype.visit = function(visitor) { |
return visitor.visitVarExpression(this); |
} |
-VarExpression.prototype.visit$1 = VarExpression.prototype.visit; |
// ********** Code for ThisExpression ************** |
$inherits(ThisExpression, Expression); |
function ThisExpression(span) { |
@@ -10969,7 +10675,6 @@ function ThisExpression(span) { |
ThisExpression.prototype.visit = function(visitor) { |
return visitor.visitThisExpression(this); |
} |
-ThisExpression.prototype.visit$1 = ThisExpression.prototype.visit; |
// ********** Code for SuperExpression ************** |
$inherits(SuperExpression, Expression); |
function SuperExpression(span) { |
@@ -10978,7 +10683,6 @@ function SuperExpression(span) { |
SuperExpression.prototype.visit = function(visitor) { |
return visitor.visitSuperExpression(this); |
} |
-SuperExpression.prototype.visit$1 = SuperExpression.prototype.visit; |
// ********** Code for LiteralExpression ************** |
$inherits(LiteralExpression, Expression); |
function LiteralExpression(value, span) { |
@@ -10988,9 +10692,8 @@ function LiteralExpression(value, span) { |
LiteralExpression.prototype.get$value = function() { return this.value; }; |
LiteralExpression.prototype.set$value = function(value) { return this.value = value; }; |
LiteralExpression.prototype.visit = function(visitor) { |
- return visitor.visitLiteralExpression$1(this); |
+ return visitor.visitLiteralExpression(this); |
} |
-LiteralExpression.prototype.visit$1 = LiteralExpression.prototype.visit; |
// ********** Code for StringInterpExpression ************** |
$inherits(StringInterpExpression, Expression); |
function StringInterpExpression(pieces, span) { |
@@ -11000,7 +10703,17 @@ function StringInterpExpression(pieces, span) { |
StringInterpExpression.prototype.visit = function(visitor) { |
return visitor.visitStringInterpExpression(this); |
} |
-StringInterpExpression.prototype.visit$1 = StringInterpExpression.prototype.visit; |
+// ********** Code for SimpleTypeReference ************** |
+$inherits(SimpleTypeReference, TypeReference); |
+function SimpleTypeReference(type, span) { |
+ this.type = type; |
+ TypeReference.call(this, span); |
+} |
+SimpleTypeReference.prototype.get$type = function() { return this.type; }; |
+SimpleTypeReference.prototype.set$type = function(value) { return this.type = value; }; |
+SimpleTypeReference.prototype.visit = function(visitor) { |
+ return visitor.visitSimpleTypeReference(this); |
+} |
// ********** Code for NameTypeReference ************** |
$inherits(NameTypeReference, TypeReference); |
function NameTypeReference(isFinal, name, names, span) { |
@@ -11018,7 +10731,6 @@ NameTypeReference.prototype.set$names = function(value) { return this.names = va |
NameTypeReference.prototype.visit = function(visitor) { |
return visitor.visitNameTypeReference(this); |
} |
-NameTypeReference.prototype.visit$1 = NameTypeReference.prototype.visit; |
// ********** Code for GenericTypeReference ************** |
$inherits(GenericTypeReference, TypeReference); |
function GenericTypeReference(baseType, typeArguments, depth, span) { |
@@ -11036,7 +10748,6 @@ GenericTypeReference.prototype.set$depth = function(value) { return this.depth = |
GenericTypeReference.prototype.visit = function(visitor) { |
return visitor.visitGenericTypeReference(this); |
} |
-GenericTypeReference.prototype.visit$1 = GenericTypeReference.prototype.visit; |
// ********** Code for FunctionTypeReference ************** |
$inherits(FunctionTypeReference, TypeReference); |
function FunctionTypeReference(isFinal, func, span) { |
@@ -11051,7 +10762,6 @@ FunctionTypeReference.prototype.set$func = function(value) { return this.func = |
FunctionTypeReference.prototype.visit = function(visitor) { |
return visitor.visitFunctionTypeReference(this); |
} |
-FunctionTypeReference.prototype.visit$1 = FunctionTypeReference.prototype.visit; |
// ********** Code for DefaultTypeReference ************** |
$inherits(DefaultTypeReference, TypeReference); |
function DefaultTypeReference(oldFactory, baseType, typeParameters, span) { |
@@ -11067,7 +10777,6 @@ DefaultTypeReference.prototype.set$typeParameters = function(value) { return thi |
DefaultTypeReference.prototype.visit = function(visitor) { |
return visitor.visitDefaultTypeReference(this); |
} |
-DefaultTypeReference.prototype.visit$1 = DefaultTypeReference.prototype.visit; |
// ********** Code for ArgumentNode ************** |
$inherits(ArgumentNode, Node); |
function ArgumentNode(label, value, span) { |
@@ -11082,7 +10791,6 @@ ArgumentNode.prototype.set$value = function(value) { return this.value = value; |
ArgumentNode.prototype.visit = function(visitor) { |
return visitor.visitArgumentNode(this); |
} |
-ArgumentNode.prototype.visit$1 = ArgumentNode.prototype.visit; |
// ********** Code for FormalNode ************** |
$inherits(FormalNode, Node); |
function FormalNode(isThis, isRest, type, name, value, span) { |
@@ -11102,7 +10810,6 @@ FormalNode.prototype.set$value = function(value) { return this.value = value; }; |
FormalNode.prototype.visit = function(visitor) { |
return visitor.visitFormalNode(this); |
} |
-FormalNode.prototype.visit$1 = FormalNode.prototype.visit; |
// ********** Code for CatchNode ************** |
$inherits(CatchNode, Node); |
function CatchNode(exception, trace, body, span) { |
@@ -11120,7 +10827,6 @@ CatchNode.prototype.set$body = function(value) { return this.body = value; }; |
CatchNode.prototype.visit = function(visitor) { |
return visitor.visitCatchNode(this); |
} |
-CatchNode.prototype.visit$1 = CatchNode.prototype.visit; |
// ********** Code for CaseNode ************** |
$inherits(CaseNode, Node); |
function CaseNode(label, cases, statements, span) { |
@@ -11138,7 +10844,6 @@ CaseNode.prototype.set$statements = function(value) { return this.statements = v |
CaseNode.prototype.visit = function(visitor) { |
return visitor.visitCaseNode(this); |
} |
-CaseNode.prototype.visit$1 = CaseNode.prototype.visit; |
// ********** Code for TypeParameter ************** |
$inherits(TypeParameter, Node); |
function TypeParameter(name, extendsType, span) { |
@@ -11153,7 +10858,6 @@ TypeParameter.prototype.set$extendsType = function(value) { return this.extendsT |
TypeParameter.prototype.visit = function(visitor) { |
return visitor.visitTypeParameter(this); |
} |
-TypeParameter.prototype.visit$1 = TypeParameter.prototype.visit; |
// ********** Code for Identifier ************** |
$inherits(Identifier, Node); |
function Identifier(name, span) { |
@@ -11165,7 +10869,6 @@ Identifier.prototype.set$name = function(value) { return this.name = value; }; |
Identifier.prototype.visit = function(visitor) { |
return visitor.visitIdentifier(this); |
} |
-Identifier.prototype.visit$1 = Identifier.prototype.visit; |
// ********** Code for DeclaredIdentifier ************** |
$inherits(DeclaredIdentifier, Expression); |
function DeclaredIdentifier(type, name, span) { |
@@ -11178,9 +10881,8 @@ DeclaredIdentifier.prototype.set$type = function(value) { return this.type = val |
DeclaredIdentifier.prototype.get$name = function() { return this.name; }; |
DeclaredIdentifier.prototype.set$name = function(value) { return this.name = value; }; |
DeclaredIdentifier.prototype.visit = function(visitor) { |
- return visitor.visitDeclaredIdentifier$1(this); |
+ return visitor.visitDeclaredIdentifier(this); |
} |
-DeclaredIdentifier.prototype.visit$1 = DeclaredIdentifier.prototype.visit; |
// ********** Code for Type ************** |
$inherits(Type, Element); |
function Type(name) { |
@@ -11225,10 +10927,7 @@ Type.prototype.get$isString = function() { |
Type.prototype.get$isBool = function() { |
return false; |
} |
-Type.prototype.get$isFunction = function() { |
- return false; |
-} |
-Type.prototype.get$isList = function() { |
+Type.prototype.get$isFunction = function() { |
return false; |
} |
Type.prototype.get$isNum = function() { |
@@ -11286,22 +10985,22 @@ Type.prototype.get$factories = function() { |
return null; |
} |
Type.prototype.get$typeArgsInOrder = function() { |
- return null; |
+ return const$0007; |
} |
Type.prototype.get$genericType = function() { |
return this; |
} |
+Type.prototype.get$isConcreteGeneric = function() { |
+ return $ne(this.get$genericType(), this); |
+} |
Type.prototype.get$interfaces = function() { |
return null; |
} |
Type.prototype.get$parent = function() { |
return null; |
} |
-Type.prototype.getAllMembers = function() { |
- return new HashMapImplementation(); |
-} |
Type.prototype.get$nativeName = function() { |
- return this.get$isNative() ? this.get$definition().get$nativeType().get$name() : this.get$jsname(); |
+ return this.get$isNative() ? this.get$definition().get$nativeType().name : this.get$jsname(); |
} |
Type.prototype.get$avoidNativeName = function() { |
return this.get$isHiddenNativeType(); |
@@ -11317,28 +11016,25 @@ Type.prototype.get$hasNativeSubtypes = function() { |
} |
Type.prototype._checkExtends = function() { |
var typeParams = this.get$genericType().typeParameters; |
- if (typeParams != null && this.get$typeArgsInOrder() != null) { |
- var args = this.get$typeArgsInOrder().iterator$0(); |
- var params = typeParams.iterator$0(); |
- while (args.hasNext$0() && params.hasNext$0()) { |
- var typeParam = params.next$0(); |
- var typeArg = args.next$0(); |
- if (typeParam.get$extendsType() != null && typeArg != null) { |
- typeArg.ensureSubtypeOf$3(typeParam.get$extendsType(), typeParam.get$span(), true); |
+ if ($ne(typeParams)) { |
+ for (var i = (0); |
+ i < typeParams.get$length(); i++) { |
+ if ($ne(typeParams.$index(i).get$extendsType())) { |
+ this.get$typeArgsInOrder().$index(i).get$dynamic().ensureSubtypeOf(typeParams.$index(i).get$extendsType(), typeParams.$index(i).get$span(), false); |
} |
} |
} |
if (this.get$interfaces() != null) { |
var $$list = this.get$interfaces(); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var i = $$list[$$i]; |
- i._checkExtends$0(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var i = $$i.next(); |
+ i._checkExtends(); |
} |
} |
} |
Type.prototype._checkOverride = function(member) { |
var parentMember = this._getMemberInParents(member.name); |
- if (parentMember != null) { |
+ if ($ne(parentMember)) { |
if (!member.get$isPrivate() || $eq(member.get$library(), parentMember.get$library())) { |
member.override(parentMember); |
} |
@@ -11350,7 +11046,6 @@ Type.prototype._createNotEqualMember = function() { |
return; |
} |
var ne = new MethodMember(":ne", this, eq.definition); |
- ne.set$isGenerated(true); |
ne.set$returnType(eq.returnType); |
ne.set$parameters(eq.parameters); |
ne.set$isStatic(eq.isStatic); |
@@ -11369,10 +11064,10 @@ Type.prototype._getMemberInParents = function(memberName) { |
else { |
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[$$i]; |
- var ret = i.getMember$1(memberName); |
- if (ret != null) { |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var i = $$i.next(); |
+ var ret = i.getMember(memberName); |
+ if ($ne(ret)) { |
return ret; |
} |
} |
@@ -11396,13 +11091,16 @@ Type.prototype.needsVarCall = function(args) { |
return true; |
} |
var call = this.getCallMethod(); |
- if (call != null) { |
- if (args.get$length() != call.get$parameters().get$length() || !call.namesInOrder$1(args)) { |
+ if ($ne(call)) { |
+ if (args.get$length() != call.get$parameters().get$length() || !call.namesInOrder(args)) { |
return true; |
} |
} |
return false; |
} |
+Type.prototype.get$needsVarCall = function() { |
+ return this.needsVarCall.bind(this); |
+} |
Type.union = function(x, y) { |
if ($eq(x, y)) return x; |
if (x.get$isNum() && y.get$isNum()) return $globals.world.numType; |
@@ -11430,23 +11128,20 @@ Type.prototype._isDirectSupertypeOf = function(other) { |
} |
} |
Type.prototype.isSubtypeOf = function(other) { |
- if ((other instanceof ParameterType)) { |
- return true; |
- } |
if ($eq(this, other)) return true; |
- if (this.get$isVar()) return true; |
- if (other.get$isVar()) return true; |
+ if (this.get$isVar() || other.get$isVar()) return true; |
if (other._isDirectSupertypeOf(this)) return true; |
var call = this.getCallMethod(); |
var otherCall = other.getCallMethod(); |
- if (call != null && otherCall != null) { |
+ if ($ne(call) && $ne(otherCall)) { |
return Type._isFunctionSubtypeOf(call, otherCall); |
} |
- if ($eq(this.get$genericType(), other.get$genericType()) && this.get$typeArgsInOrder() != null && other.get$typeArgsInOrder() != null && $eq(this.get$typeArgsInOrder().get$length(), other.get$typeArgsInOrder().get$length())) { |
- var t = this.get$typeArgsInOrder().iterator$0(); |
- var s = other.get$typeArgsInOrder().iterator$0(); |
- while (t.hasNext$0()) { |
- if (!t.next$0().isSubtypeOf$1(s.next$0())) return false; |
+ if (this.get$genericType() == other.get$genericType()) { |
+ for (var i = (0); |
+ i < this.get$typeArgsInOrder().get$length(); i++) { |
+ if (!this.get$typeArgsInOrder().$index(i).get$dynamic().isSubtypeOf(other.get$typeArgsInOrder().$index(i))) { |
+ return false; |
+ } |
} |
return true; |
} |
@@ -11454,7 +11149,7 @@ Type.prototype.isSubtypeOf = function(other) { |
return true; |
} |
if (this.get$interfaces() != null && this.get$interfaces().some((function (i) { |
- return i.isSubtypeOf$1(other); |
+ return i.isSubtypeOf(other); |
}) |
)) { |
return true; |
@@ -11464,7 +11159,7 @@ Type.prototype.isSubtypeOf = function(other) { |
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; |
+ return $bit_xor(($shl(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()); |
@@ -11480,23 +11175,11 @@ Type._isFunctionSubtypeOf = function(t, s) { |
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; |
- if (!tp.$index(i).get$type().isAssignable$1(sp.$index(i).get$type())) return false; |
+ if (!tp.$index(i).get$type().isAssignable(sp.$index(i).get$type())) return false; |
} |
if (tp.get$length() > sp.get$length() && !tp.$index(sp.get$length()).get$isOptional()) return false; |
return true; |
} |
-Type.prototype._checkExtends$0 = Type.prototype._checkExtends; |
-Type.prototype.addDirectSubtype$1 = Type.prototype.addDirectSubtype; |
-Type.prototype.ensureSubtypeOf$3 = Type.prototype.ensureSubtypeOf; |
-Type.prototype.getConstructor$1 = Type.prototype.getConstructor; |
-Type.prototype.getFactory$2 = Type.prototype.getFactory; |
-Type.prototype.getMember$1 = Type.prototype.getMember; |
-Type.prototype.getOrMakeConcreteType$1 = Type.prototype.getOrMakeConcreteType; |
-Type.prototype.hashCode$0 = Type.prototype.hashCode; |
-Type.prototype.isAssignable$1 = Type.prototype.isAssignable; |
-Type.prototype.isSubtypeOf$1 = Type.prototype.isSubtypeOf; |
-Type.prototype.markUsed$0 = Type.prototype.markUsed; |
-Type.prototype.resolveTypeParams$1 = Type.prototype.resolveTypeParams; |
// ********** Code for ParameterType ************** |
$inherits(ParameterType, Type); |
function ParameterType(name, typeParameter) { |
@@ -11534,26 +11217,17 @@ ParameterType.prototype.getConstructor = function(constructorName) { |
ParameterType.prototype.getOrMakeConcreteType = function(typeArgs) { |
$globals.world.internalError("no concrete types of type parameters yet", this.get$span()); |
} |
-ParameterType.prototype.resolveTypeParams = function(inType) { |
- return inType.typeArguments.$index(this.name); |
-} |
ParameterType.prototype.addDirectSubtype = function(type) { |
$globals.world.internalError("no subtypes of type parameters yet", this.get$span()); |
} |
ParameterType.prototype.resolve = function() { |
if (this.typeParameter.extendsType != null) { |
- this.extendsType = this.get$enclosingElement().resolveType$2(this.typeParameter.extendsType, true); |
+ this.extendsType = this.get$enclosingElement().resolveType(this.typeParameter.extendsType, true, true); |
} |
else { |
this.extendsType = $globals.world.objectType; |
} |
} |
-ParameterType.prototype.addDirectSubtype$1 = ParameterType.prototype.addDirectSubtype; |
-ParameterType.prototype.getConstructor$1 = ParameterType.prototype.getConstructor; |
-ParameterType.prototype.getOrMakeConcreteType$1 = ParameterType.prototype.getOrMakeConcreteType; |
-ParameterType.prototype.isSubtypeOf$1 = ParameterType.prototype.isSubtypeOf; |
-ParameterType.prototype.resolve$0 = ParameterType.prototype.resolve; |
-ParameterType.prototype.resolveTypeParams$1 = ParameterType.prototype.resolveTypeParams; |
// ********** Code for NonNullableType ************** |
$inherits(NonNullableType, Type); |
function NonNullableType(type) { |
@@ -11573,14 +11247,11 @@ NonNullableType.prototype.get$isUsed = function() { |
NonNullableType.prototype.isSubtypeOf = function(other) { |
return $eq(this, other) || $eq(this.type, other) || this.type.isSubtypeOf(other); |
} |
-NonNullableType.prototype.resolveType = function(node, isRequired) { |
- return this.type.resolveType$2(node, isRequired); |
-} |
-NonNullableType.prototype.resolveTypeParams = function(inType) { |
- return this.type.resolveTypeParams(inType); |
+NonNullableType.prototype.resolveType = function(node, isRequired, allowTypeParams) { |
+ return this.type.resolveType(node, isRequired, allowTypeParams); |
} |
NonNullableType.prototype.addDirectSubtype = function(subtype) { |
- this.type.addDirectSubtype$1(subtype); |
+ this.type.addDirectSubtype(subtype); |
} |
NonNullableType.prototype.markUsed = function() { |
this.type.markUsed(); |
@@ -11595,10 +11266,7 @@ NonNullableType.prototype.getMember = function(name) { |
return this.type.getMember(name); |
} |
NonNullableType.prototype.getConstructor = function(name) { |
- return this.type.getConstructor$1(name); |
-} |
-NonNullableType.prototype.getFactory = function(t, name) { |
- return this.type.getFactory$2(t, name); |
+ return this.type.getConstructor(name); |
} |
NonNullableType.prototype.getOrMakeConcreteType = function(typeArgs) { |
return this.type.getOrMakeConcreteType(typeArgs); |
@@ -11648,201 +11316,14 @@ NonNullableType.prototype.get$interfaces = function() { |
NonNullableType.prototype.get$parent = function() { |
return this.type.get$parent(); |
} |
-NonNullableType.prototype.getAllMembers = function() { |
- return this.type.getAllMembers(); |
-} |
NonNullableType.prototype.get$isNative = function() { |
return this.type.get$isNative(); |
} |
-NonNullableType.prototype.addDirectSubtype$1 = NonNullableType.prototype.addDirectSubtype; |
-NonNullableType.prototype.getConstructor$1 = NonNullableType.prototype.getConstructor; |
-NonNullableType.prototype.getFactory$2 = NonNullableType.prototype.getFactory; |
-NonNullableType.prototype.getMember$1 = NonNullableType.prototype.getMember; |
-NonNullableType.prototype.getOrMakeConcreteType$1 = NonNullableType.prototype.getOrMakeConcreteType; |
-NonNullableType.prototype.isSubtypeOf$1 = NonNullableType.prototype.isSubtypeOf; |
-NonNullableType.prototype.markUsed$0 = NonNullableType.prototype.markUsed; |
-NonNullableType.prototype.resolveType$2 = NonNullableType.prototype.resolveType; |
-NonNullableType.prototype.resolveTypeParams$1 = NonNullableType.prototype.resolveTypeParams; |
-// ********** Code for ConcreteType ************** |
-$inherits(ConcreteType, Type); |
-function ConcreteType(name, genericType, typeArguments, typeArgsInOrder) { |
- this.isUsed = false; |
- this.constructors = new HashMapImplementation(); |
- this.genericType = genericType; |
- this.factories = new FactoryMap(); |
- this.members = new HashMapImplementation(); |
- this.typeArguments = typeArguments; |
- this.typeArgsInOrder = typeArgsInOrder; |
- Type.call(this, name); |
-} |
-ConcreteType.prototype.get$genericType = function() { return this.genericType; }; |
-ConcreteType.prototype.get$typeArguments = function() { return this.typeArguments; }; |
-ConcreteType.prototype.set$typeArguments = function(value) { return this.typeArguments = value; }; |
-ConcreteType.prototype.get$_parent = function() { return this._parent; }; |
-ConcreteType.prototype.set$_parent = function(value) { return this._parent = value; }; |
-ConcreteType.prototype.get$typeArgsInOrder = function() { return this.typeArgsInOrder; }; |
-ConcreteType.prototype.set$typeArgsInOrder = function(value) { return this.typeArgsInOrder = value; }; |
-ConcreteType.prototype.get$isList = function() { |
- return this.genericType.get$isList(); |
-} |
-ConcreteType.prototype.get$isClass = function() { |
- return this.genericType.isClass; |
-} |
-ConcreteType.prototype.get$library = function() { |
- return this.genericType.library; |
-} |
-ConcreteType.prototype.get$span = function() { |
- return this.genericType.get$span(); |
-} |
-ConcreteType.prototype.get$hasTypeParams = function() { |
- return this.typeArguments.getValues().some((function (e) { |
- return (e instanceof ParameterType); |
- }) |
- ); |
-} |
-ConcreteType.prototype.get$isUsed = function() { return this.isUsed; }; |
-ConcreteType.prototype.set$isUsed = function(value) { return this.isUsed = value; }; |
-ConcreteType.prototype.get$members = function() { return this.members; }; |
-ConcreteType.prototype.set$members = function(value) { return this.members = value; }; |
-ConcreteType.prototype.get$constructors = function() { return this.constructors; }; |
-ConcreteType.prototype.set$constructors = function(value) { return this.constructors = value; }; |
-ConcreteType.prototype.get$factories = function() { return this.factories; }; |
-ConcreteType.prototype.set$factories = function(value) { return this.factories = value; }; |
-ConcreteType.prototype.resolveTypeParams = function(inType) { |
- var newTypeArgs = []; |
- var needsNewType = false; |
- var $$list = this.typeArgsInOrder; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var t = $$list[$$i]; |
- var newType = t.resolveTypeParams$1(inType); |
- if ($ne(newType, t)) needsNewType = true; |
- newTypeArgs.add$1(newType); |
- } |
- if (!needsNewType) return this; |
- return this.genericType.getOrMakeConcreteType(newTypeArgs); |
-} |
-ConcreteType.prototype.getOrMakeConcreteType = function(typeArgs) { |
- return this.genericType.getOrMakeConcreteType(typeArgs); |
-} |
-ConcreteType.prototype.get$parent = function() { |
- if (this._parent == null && this.genericType.get$parent() != null) { |
- this._parent = this.genericType.get$parent().resolveTypeParams(this); |
- } |
- return this._parent; |
-} |
-ConcreteType.prototype.get$interfaces = function() { |
- if (this._interfaces == null && this.genericType.interfaces != null) { |
- this._interfaces = []; |
- var $$list = this.genericType.interfaces; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var i = $$list[$$i]; |
- this._interfaces.add(i.resolveTypeParams$1(this)); |
- } |
- } |
- return this._interfaces; |
-} |
-ConcreteType.prototype.get$subtypes = function() { |
- if (this._subtypes == null) { |
- this._subtypes = new HashSetImplementation(); |
- var $$list = this.genericType.get$subtypes(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var s = $$i.next$0(); |
- this._subtypes.add(s.resolveTypeParams$1(this)); |
- } |
- } |
- return this._subtypes; |
-} |
-ConcreteType.prototype.getCallMethod = function() { |
- return this.genericType.getCallMethod(); |
-} |
-ConcreteType.prototype.getAllMembers = function() { |
- var result = this.genericType.getAllMembers(); |
- var $$list = result.getKeys$0(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var memberName = $$i.next$0(); |
- var myMember = this.members.$index(memberName); |
- if (myMember != null) { |
- result.$setindex(memberName, myMember); |
- } |
- } |
- return result; |
-} |
-ConcreteType.prototype.markUsed = function() { |
- if (this.isUsed) return; |
- this.isUsed = true; |
- this._checkExtends(); |
- this.genericType.markUsed(); |
-} |
-ConcreteType.prototype.genMethod = function(method) { |
- return this.genericType.genMethod(method); |
-} |
-ConcreteType.prototype.getFactory = function(type, constructorName) { |
- return this.genericType.getFactory(type, constructorName); |
-} |
-ConcreteType.prototype.getConstructor = function(constructorName) { |
- var ret = this.constructors.$index(constructorName); |
- if (ret != null) return ret; |
- ret = this.factories.getFactory(this.name, constructorName); |
- if (ret != null) return ret; |
- var genericMember = this.genericType.getConstructor(constructorName); |
- if (genericMember == null) return null; |
- if ($ne(genericMember.get$declaringType(), this.genericType)) { |
- if (!genericMember.get$declaringType().get$isGeneric()) return genericMember; |
- var newDeclaringType = genericMember.get$declaringType().getOrMakeConcreteType$1(this.typeArgsInOrder); |
- var factory = newDeclaringType.getFactory$2(this.genericType, constructorName); |
- if (factory != null) return factory; |
- return newDeclaringType.getConstructor$1(constructorName); |
- } |
- if (genericMember.get$isFactory()) { |
- ret = new ConcreteMember(genericMember.get$name(), this, genericMember); |
- this.factories.addFactory(this.name, constructorName, ret); |
- } |
- else { |
- ret = new ConcreteMember(this.name, this, genericMember); |
- this.constructors.$setindex(constructorName, ret); |
- } |
- return ret; |
-} |
-ConcreteType.prototype.getMember = function(memberName) { |
- var member = this._foundMembers.$index(memberName); |
- if (member != null) return member; |
- member = this.members.$index(memberName); |
- if (member != null) { |
- this._checkOverride(member); |
- this._foundMembers.$setindex(memberName, member); |
- return member; |
- } |
- var genericMember = this.genericType.members.$index(memberName); |
- if (genericMember != null) { |
- member = new ConcreteMember(genericMember.get$name(), this, genericMember); |
- this.members.$setindex(memberName, member); |
- this._foundMembers.$setindex(memberName, member); |
- return member; |
- } |
- member = this._getMemberInParents(memberName); |
- this._foundMembers.$setindex(memberName, member); |
- return member; |
-} |
-ConcreteType.prototype.resolveType = function(node, isRequired) { |
- var ret = this.genericType.resolveType$2(node, isRequired); |
- return ret; |
-} |
-ConcreteType.prototype.addDirectSubtype = function(type) { |
- this.genericType.addDirectSubtype(type); |
-} |
-ConcreteType.prototype.addDirectSubtype$1 = ConcreteType.prototype.addDirectSubtype; |
-ConcreteType.prototype.getConstructor$1 = ConcreteType.prototype.getConstructor; |
-ConcreteType.prototype.getFactory$2 = ConcreteType.prototype.getFactory; |
-ConcreteType.prototype.getMember$1 = ConcreteType.prototype.getMember; |
-ConcreteType.prototype.getOrMakeConcreteType$1 = ConcreteType.prototype.getOrMakeConcreteType; |
-ConcreteType.prototype.markUsed$0 = ConcreteType.prototype.markUsed; |
-ConcreteType.prototype.resolveType$2 = ConcreteType.prototype.resolveType; |
-ConcreteType.prototype.resolveTypeParams$1 = ConcreteType.prototype.resolveTypeParams; |
// ********** Code for DefinedType ************** |
$inherits(DefinedType, Type); |
function DefinedType(name, library, definition, isClass) { |
this.isUsed = false; |
- this.directSubtypes = new HashSetImplementation(); |
+ this.directSubtypes = new HashSetImplementation_Type(); |
this.isNative = false; |
this.library = library; |
this.isClass = isClass; |
@@ -11856,8 +11337,6 @@ DefinedType.prototype.get$definition = function() { return this.definition; }; |
DefinedType.prototype.set$definition = function(value) { return this.definition = value; }; |
DefinedType.prototype.get$library = function() { return this.library; }; |
DefinedType.prototype.get$isClass = function() { return this.isClass; }; |
-DefinedType.prototype.get$_parent = function() { return this._parent; }; |
-DefinedType.prototype.set$_parent = function(value) { return this._parent = value; }; |
DefinedType.prototype.get$parent = function() { |
return this._parent; |
} |
@@ -11870,6 +11349,8 @@ DefinedType.prototype.get$directSubtypes = function() { return this.directSubtyp |
DefinedType.prototype.set$directSubtypes = function(value) { return this.directSubtypes = value; }; |
DefinedType.prototype.get$typeParameters = function() { return this.typeParameters; }; |
DefinedType.prototype.set$typeParameters = function(value) { return this.typeParameters = value; }; |
+DefinedType.prototype.get$typeArgsInOrder = function() { return this.typeArgsInOrder; }; |
+DefinedType.prototype.set$typeArgsInOrder = function(value) { return this.typeArgsInOrder = value; }; |
DefinedType.prototype.get$constructors = function() { return this.constructors; }; |
DefinedType.prototype.set$constructors = function(value) { return this.constructors = value; }; |
DefinedType.prototype.get$members = function() { return this.members; }; |
@@ -11882,26 +11363,32 @@ DefinedType.prototype.get$isUsed = function() { return this.isUsed; }; |
DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value; }; |
DefinedType.prototype.get$isNative = function() { return this.isNative; }; |
DefinedType.prototype.set$isNative = function(value) { return this.isNative = value; }; |
+DefinedType.prototype.get$baseGenericType = function() { return this.baseGenericType; }; |
+DefinedType.prototype.set$baseGenericType = function(value) { return this.baseGenericType = value; }; |
+DefinedType.prototype.get$genericType = function() { |
+ return this.baseGenericType == null ? this : this.baseGenericType; |
+} |
DefinedType.prototype.setDefinition = function(def) { |
this.definition = def; |
if ((this.definition instanceof TypeDefinition) && this.definition.get$nativeType() != null) { |
this.isNative = true; |
} |
- if (this.definition != null && this.definition.get$typeParameters() != null) { |
+ if (this.definition != null && $ne(this.definition.get$typeParameters())) { |
this._concreteTypes = new HashMapImplementation(); |
this.typeParameters = this.definition.get$typeParameters(); |
+ this.typeArgsInOrder = new Array(this.typeParameters.get$length()); |
+ for (var i = (0); |
+ i < this.typeArgsInOrder.get$length(); i++) { |
+ this.typeArgsInOrder.$setindex(i, $globals.world.varType); |
+ } |
+ } |
+ else { |
+ this.typeArgsInOrder = const$0007; |
} |
} |
DefinedType.prototype.get$nativeType = function() { |
return (this.definition != null ? this.definition.get$nativeType() : null); |
} |
-DefinedType.prototype.get$typeArgsInOrder = function() { |
- if (this.typeParameters == null) return null; |
- if (this._typeArgsInOrder == null) { |
- this._typeArgsInOrder = new FixedCollection_Type($globals.world.varType, this.typeParameters.get$length()); |
- } |
- return this._typeArgsInOrder; |
-} |
DefinedType.prototype.get$isVar = function() { |
return $eq(this, $globals.world.varType); |
} |
@@ -11912,19 +11399,16 @@ DefinedType.prototype.get$isTop = function() { |
return this.name == null; |
} |
DefinedType.prototype.get$isObject = function() { |
- return this.library.get$isCore() && this.name == "Object"; |
+ return $eq(this, $globals.world.objectType); |
} |
DefinedType.prototype.get$isString = function() { |
- return this.library.get$isCore() && this.name == "String" || this.library.get$isCoreImpl() && this.name == "StringImplementation"; |
+ return $eq(this, $globals.world.stringType) || $eq(this, $globals.world.stringImplType); |
} |
DefinedType.prototype.get$isBool = function() { |
- return this.library.get$isCore() && this.name == "bool"; |
+ return $eq(this, $globals.world.boolType); |
} |
DefinedType.prototype.get$isFunction = function() { |
- return this.library.get$isCore() && this.name == "Function"; |
-} |
-DefinedType.prototype.get$isList = function() { |
- return this.library.get$isCore() && this.name == "List"; |
+ return $eq(this, $globals.world.functionType) || $eq(this, $globals.world.functionImplType); |
} |
DefinedType.prototype.get$isGeneric = function() { |
return this.typeParameters != null; |
@@ -11944,7 +11428,7 @@ DefinedType.prototype.get$isNum = function() { |
return $eq(this, $globals.world.numType) || $eq(this, $globals.world.intType) || $eq(this, $globals.world.doubleType) || $eq(this, $globals.world.numImplType); |
} |
DefinedType.prototype.getCallMethod = function() { |
- return this.members.$index(":call"); |
+ return this.get$genericType().members.$index(":call"); |
} |
DefinedType.prototype.getAllMembers = function() { |
return HashMapImplementation.HashMapImplementation$from$factory(this.members); |
@@ -11955,8 +11439,8 @@ DefinedType.prototype.markUsed = function() { |
this._checkExtends(); |
if (this._lazyGenMethods != null) { |
var $$list = orderValuesByKeys(this._lazyGenMethods); |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var method = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var method = $$i.next(); |
$globals.world.gen.genMethod(method); |
} |
this._lazyGenMethods = null; |
@@ -11964,7 +11448,7 @@ DefinedType.prototype.markUsed = function() { |
if (this.get$parent() != null) this.get$parent().markUsed(); |
} |
DefinedType.prototype.genMethod = function(method) { |
- if (this.isUsed) { |
+ if (this.isUsed || this.baseGenericType != null) { |
$globals.world.gen.genMethod(method); |
} |
else if (this.isClass) { |
@@ -11975,26 +11459,29 @@ DefinedType.prototype.genMethod = function(method) { |
DefinedType.prototype._resolveInterfaces = function(types) { |
if (types == null) return []; |
var interfaces = []; |
- for (var $$i = 0;$$i < types.get$length(); $$i++) { |
- var type = types[$$i]; |
- var resolvedInterface = this.resolveType$2(type, true); |
+ for (var $$i = types.iterator(); $$i.hasNext(); ) { |
+ var type = $$i.next(); |
+ var resolvedInterface = this.resolveType(type, true, true); |
if (resolvedInterface.get$isClosed() && !(this.library.get$isCore() || this.library.get$isCoreImpl())) { |
- $globals.world.error(("can not implement \"" + resolvedInterface.get$name() + "\": ") + "only native implementation allowed", type.get$span()); |
+ $globals.world.error($add(("can not implement \"" + resolvedInterface.get$name() + "\": "), "only native implementation allowed"), type.get$span()); |
} |
- resolvedInterface.addDirectSubtype$1(this); |
- interfaces.add$1(resolvedInterface); |
+ resolvedInterface.addDirectSubtype(this); |
+ interfaces.add(resolvedInterface); |
} |
return interfaces; |
} |
DefinedType.prototype.addDirectSubtype = function(type) { |
this.directSubtypes.add(type); |
+ if (this.baseGenericType != null) { |
+ this.baseGenericType.addDirectSubtype(type); |
+ } |
} |
DefinedType.prototype.get$subtypes = function() { |
if (this._subtypes == null) { |
- this._subtypes = new HashSetImplementation(); |
+ this._subtypes = new HashSetImplementation_Type(); |
var $$list = this.directSubtypes; |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var st = $$i.next$0(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var st = $$i.next(); |
this._subtypes.add(st); |
this._subtypes.addAll(st.get$subtypes()); |
} |
@@ -12003,16 +11490,16 @@ DefinedType.prototype.get$subtypes = function() { |
} |
DefinedType.prototype._cycleInClassExtends = function() { |
var seen = new HashSetImplementation(); |
- seen.add$1(this); |
+ seen.add(this); |
var ancestor = this.get$parent(); |
- while (ancestor != null) { |
+ while ($ne(ancestor)) { |
if (ancestor == this) { |
return true; |
} |
if (seen.contains$1(ancestor)) { |
return false; |
} |
- seen.add$1(ancestor); |
+ seen.add(ancestor); |
ancestor = ancestor.get$parent(); |
} |
return false; |
@@ -12020,26 +11507,26 @@ DefinedType.prototype._cycleInClassExtends = function() { |
DefinedType.prototype._cycleInInterfaceExtends = function() { |
var $this = this; // closure support |
var seen = new HashSetImplementation(); |
- seen.add$1(this); |
+ seen.add(this); |
function _helper(ancestor) { |
- if (ancestor == null) return false; |
+ if ($eq(ancestor)) return false; |
if (ancestor == $this) return true; |
if (seen.contains$1(ancestor)) { |
return false; |
} |
- seen.add$1(ancestor); |
+ seen.add(ancestor); |
if (ancestor.get$interfaces() != null) { |
var $$list = ancestor.get$interfaces(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var parent = $$i.next$0(); |
- if (_helper.call$1(parent)) return true; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var parent = $$i.next(); |
+ if (_helper(parent)) return true; |
} |
} |
return false; |
} |
for (var i = (0); |
i < this.interfaces.get$length(); i++) { |
- if (_helper.call$1(this.interfaces[i])) return i; |
+ if (_helper(this.interfaces.$index(i))) return i; |
} |
return (-1); |
} |
@@ -12049,18 +11536,18 @@ DefinedType.prototype.resolve = function() { |
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[(1)].get$span()); |
+ $globals.world.error("more than one base class", typeDef.extendsTypes[(1)].span); |
} |
var extendsTypeRef = typeDef.extendsTypes[(0)]; |
if ((extendsTypeRef instanceof GenericTypeReference)) { |
var g = extendsTypeRef; |
- this.set$parent(this.resolveType$2(g.baseType, true)); |
+ this.set$parent(this.resolveType(g.baseType, true, true)); |
} |
- this.set$parent(this.resolveType$2(extendsTypeRef, true)); |
+ this.set$parent(this.resolveType(extendsTypeRef, true, true)); |
if (!this.get$parent().get$isClass()) { |
- $globals.world.error("class may not extend an interface - use implements", typeDef.extendsTypes[(0)].get$span()); |
+ $globals.world.error("class may not extend an interface - use implements", typeDef.extendsTypes[(0)].span); |
} |
- this.get$parent().addDirectSubtype$1(this); |
+ this.get$parent().addDirectSubtype(this); |
if (this._cycleInClassExtends()) { |
$globals.world.error(("class \"" + this.name + "\" has a cycle in its inheritance chain"), extendsTypeRef.get$span()); |
} |
@@ -12068,7 +11555,7 @@ DefinedType.prototype.resolve = function() { |
else { |
if (!this.get$isObject()) { |
this.set$parent($globals.world.objectType); |
- this.get$parent().addDirectSubtype$1(this); |
+ this.get$parent().addDirectSubtype(this); |
} |
} |
this.interfaces = this._resolveInterfaces(typeDef.implementsTypes); |
@@ -12078,20 +11565,25 @@ 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[(0)].get$span()); |
+ $globals.world.error("implements not allowed on interfaces (use extends)", typeDef.implementsTypes[(0)].span); |
} |
this.interfaces = this._resolveInterfaces(typeDef.extendsTypes); |
var res = this._cycleInInterfaceExtends(); |
- if (res >= (0)) { |
- $globals.world.error(("interface \"" + this.name + "\" has a cycle in its inheritance chain"), typeDef.extendsTypes[res].get$span()); |
+ if ($gte(res, (0))) { |
+ $globals.world.error(("interface \"" + this.name + "\" has a cycle in its inheritance chain"), typeDef.extendsTypes.$index(res).span); |
} |
if (typeDef.defaultType != null) { |
- this.defaultType = this.resolveType$2(typeDef.defaultType.baseType, true); |
+ this.defaultType = this.resolveType(typeDef.defaultType.baseType, true, true); |
if (this.defaultType == null) { |
$globals.world.warning("unresolved default class", typeDef.defaultType.span); |
} |
else { |
- this.defaultType._resolveTypeParams(typeDef.defaultType.typeParameters); |
+ if (this.baseGenericType != null) { |
+ if (!this.defaultType.get$isGeneric()) { |
+ $globals.world.error("default type of generic interface must be generic", typeDef.defaultType.span); |
+ } |
+ this.defaultType = this.defaultType.getOrMakeConcreteType(this.typeArgsInOrder); |
+ } |
} |
} |
} |
@@ -12101,35 +11593,35 @@ DefinedType.prototype.resolve = function() { |
} |
this._resolveTypeParams(this.typeParameters); |
if (this.get$isObject()) this._createNotEqualMember(); |
- $globals.world._addType(this); |
+ if ($ne(this.baseGenericType, $globals.world.listFactoryType)) $globals.world._addType(this); |
var $$list = this.constructors.getValues(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var c = $$i.next$0(); |
- c.resolve$0(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var c = $$i.next(); |
+ c.resolve(); |
} |
var $$list = this.members.getValues(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var m = $$i.next$0(); |
- m.resolve$0(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var m = $$i.next(); |
+ m.resolve(); |
} |
this.factories.forEach((function (f) { |
- return f.resolve$0(); |
+ return f.resolve(); |
}) |
); |
if (this.get$isJsGlobalObject()) { |
var $$list = this.members.getValues(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var m = $$i.next$0(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var m = $$i.next(); |
if (!m.get$isStatic()) $globals.world._addTopName(new ExistingJsGlobal(m.get$name(), m)); |
} |
} |
} |
DefinedType.prototype._resolveTypeParams = function(params) { |
if (params == null) return; |
- for (var $$i = 0;$$i < params.get$length(); $$i++) { |
- var tp = params[$$i]; |
+ for (var $$i = params.iterator(); $$i.hasNext(); ) { |
+ var tp = $$i.next(); |
tp.set$enclosingElement(this); |
- tp.resolve$0(); |
+ tp.resolve(); |
} |
} |
DefinedType.prototype.addMethod = function(methodName, definition) { |
@@ -12143,7 +11635,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[(0)].get$kind(), (74))) { |
+ if (definition.modifiers != null && definition.modifiers.get$length() == (1) && definition.modifiers[(0)].kind == (74)) { |
if (this.factories.getFactory(method.get$constructorName(), method.get$name()) != null) { |
$globals.world.error(("duplicate factory definition of \"" + method.get$name() + "\""), definition.span); |
return; |
@@ -12154,7 +11646,7 @@ DefinedType.prototype.addMethod = function(methodName, definition) { |
if (methodName.startsWith("get:") || methodName.startsWith("set:")) { |
var propName = methodName.substring((4)); |
var prop = this.members.$index(propName); |
- if (prop == null) { |
+ if ($eq(prop)) { |
prop = new PropertyMember(propName, this); |
this.members.$setindex(propName, prop); |
} |
@@ -12185,7 +11677,7 @@ DefinedType.prototype.addMethod = function(methodName, definition) { |
DefinedType.prototype.addField = function(definition) { |
for (var i = (0); |
i < definition.names.get$length(); i++) { |
- var name = definition.names[i].get$name(); |
+ var name = definition.names[i].name; |
if (this.members.containsKey(name)) { |
$globals.world.error(("duplicate field definition of \"" + name + "\""), definition.span); |
return; |
@@ -12202,59 +11694,59 @@ DefinedType.prototype.addField = function(definition) { |
} |
} |
DefinedType.prototype.getFactory = function(type, constructorName) { |
- var ret = this.factories.getFactory(type.name, constructorName); |
- if (ret != null) return ret; |
+ if (this.baseGenericType != null) { |
+ var rr = this.baseGenericType.get$factories().getFactory(type.get$genericType().name, constructorName); |
+ if ($ne(rr)) { |
+ $globals.world.info(("need to remap factory on " + this.name + " from " + rr.get$declaringType().name)); |
+ return rr; |
+ } |
+ else { |
+ var ret = this.getConstructor(constructorName); |
+ return ret; |
+ } |
+ } |
+ var ret = this.factories.getFactory(type.get$genericType().name, constructorName); |
+ if ($ne(ret)) return ret; |
ret = this.factories.getFactory(this.name, constructorName); |
- if (ret != null) return ret; |
+ if ($ne(ret)) return ret; |
ret = this.constructors.$index(constructorName); |
- if (ret != null) return ret; |
+ if ($ne(ret)) return ret; |
return this._tryCreateDefaultConstructor(constructorName); |
} |
DefinedType.prototype.getConstructor = function(constructorName) { |
+ if (this.baseGenericType != null) { |
+ var rr = this.constructors.$index(constructorName); |
+ if ($ne(rr)) return rr; |
+ rr = this.baseGenericType.get$constructors().$index(constructorName); |
+ if ($ne(rr)) { |
+ if (this.defaultType != null) { |
+ var ret = this.defaultType.getFactory(this, constructorName); |
+ return ret; |
+ } |
+ } |
+ else { |
+ rr = this.baseGenericType.get$factories().getFactory(this.baseGenericType.name, constructorName); |
+ } |
+ if ($eq(rr)) { |
+ rr = this.baseGenericType.get$dynamic()._tryCreateDefaultConstructor(constructorName); |
+ } |
+ if ($eq(rr)) return null; |
+ var rr1 = rr.makeConcrete(this); |
+ rr1.resolve(); |
+ this.constructors.$setindex(constructorName, rr1); |
+ return rr1; |
+ } |
var ret = this.constructors.$index(constructorName); |
- if (ret != null) { |
+ if ($ne(ret)) { |
if (this.defaultType != null) { |
- this._checkDefaultTypeParams(); |
return this.defaultType.getFactory(this, constructorName); |
} |
return ret; |
} |
ret = this.factories.getFactory(this.name, constructorName); |
- if (ret != null) return ret; |
+ if ($ne(ret)) return ret; |
return this._tryCreateDefaultConstructor(constructorName); |
} |
-DefinedType.prototype._checkDefaultTypeParams = function() { |
- function toList(list) { |
- return (list != null ? list : const$0008); |
- } |
- var typeDef = this.definition; |
- if (typeDef.defaultType.oldFactory) { |
- return; |
- } |
- var interfaceParams = toList.call$1(this.typeParameters); |
- var defaultParams = toList.call$1(typeDef.defaultType.typeParameters); |
- var classParams = toList.call$1(this.defaultType.typeParameters); |
- if ($ne(interfaceParams.get$length(), defaultParams.get$length()) || $ne(defaultParams.get$length(), classParams.get$length())) { |
- $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); |
- i < interfaceParams.get$length(); i++) { |
- var ip = interfaceParams.$index(i); |
- var dp = defaultParams.$index(i); |
- var cp = classParams.$index(i); |
- dp.resolve$0(); |
- if ($ne(ip.get$name(), dp.get$name()) || $ne(dp.get$name(), cp.get$name())) { |
- $globals.world.error("default class must have the same type parameter names as the class and interface", ip.get$span(), dp.get$span(), cp.get$span()); |
- } |
- else if ($ne(dp.get$extendsType(), cp.get$extendsType())) { |
- $globals.world.error("default class type parameters must have the same extends as the class does", dp.get$span(), cp.get$span()); |
- } |
- else if (!dp.get$extendsType().isSubtypeOf$1(ip.get$extendsType())) { |
- $globals.world.warning("\"default\" can only have tighter type parameter \"extends\" than the interface", dp.get$span(), ip.get$span()); |
- } |
- } |
-} |
DefinedType.prototype._tryCreateDefaultConstructor = function(name) { |
if (name == "" && this.definition != null && this.isClass && this.constructors.get$length() == (0)) { |
var span = this.definition.span; |
@@ -12270,7 +11762,7 @@ DefinedType.prototype._tryCreateDefaultConstructor = function(name) { |
var typeDef = this.definition; |
var c = new FunctionDefinition(null, null, typeDef.name, [], inits, native_, body, span); |
this.addMethod(null, c); |
- this.constructors.$index("").resolve$0(); |
+ this.constructors.$index("").resolve(); |
return this.constructors.$index(""); |
} |
return null; |
@@ -12278,6 +11770,24 @@ DefinedType.prototype._tryCreateDefaultConstructor = function(name) { |
DefinedType.prototype.getMember = function(memberName) { |
var member = this._foundMembers.$index(memberName); |
if (member != null) return member; |
+ if (this.baseGenericType != null) { |
+ member = this.baseGenericType.getMember(memberName); |
+ if (member == null) return null; |
+ if (member.get$isStatic() || $ne(member.declaringType, this.baseGenericType)) { |
+ this._foundMembers.$setindex(memberName, member); |
+ return member; |
+ } |
+ var rr = member.makeConcrete(this); |
+ if (member.get$definition() != null || (member instanceof PropertyMember)) { |
+ rr.resolve(); |
+ } |
+ else { |
+ $globals.world.info(("no definition for " + member.name + " on " + this.name)); |
+ } |
+ this.members.$setindex(memberName, rr); |
+ this._foundMembers.$setindex(memberName, rr); |
+ return rr; |
+ } |
member = this.members.$index(memberName); |
if (member != null) { |
this._checkOverride(member); |
@@ -12286,7 +11796,7 @@ DefinedType.prototype.getMember = function(memberName) { |
} |
if (this.get$isTop()) { |
var libType = this.library.findTypeByName(memberName); |
- if (libType != null) { |
+ if ($ne(libType)) { |
member = libType.get$typeMember(); |
this._foundMembers.$setindex(memberName, member); |
return member; |
@@ -12296,50 +11806,48 @@ DefinedType.prototype.getMember = function(memberName) { |
this._foundMembers.$setindex(memberName, member); |
return member; |
} |
-DefinedType.prototype.resolveTypeParams = function(inType) { |
- return this; |
-} |
DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { |
var jsnames = []; |
var names = []; |
var typeMap = new HashMapImplementation(); |
+ var allVar = true; |
for (var i = (0); |
i < typeArgs.get$length(); i++) { |
- var paramName = this.typeParameters[i].get$name(); |
- typeMap.$setindex(paramName, typeArgs[i]); |
- names.add$1(typeArgs[i].get$name()); |
- jsnames.add$1(typeArgs[i].get$jsname()); |
- } |
+ var typeArg = typeArgs.$index(i); |
+ if ((typeArg instanceof ParameterType)) { |
+ typeArg = $globals.world.varType; |
+ typeArgs.$setindex(i, typeArg); |
+ } |
+ if (!typeArg.get$isVar()) allVar = false; |
+ var paramName = this.typeParameters[i].name; |
+ typeMap.$setindex(paramName, typeArg); |
+ names.add(typeArg.get$name()); |
+ jsnames.add(typeArg.get$jsname()); |
+ } |
+ if (allVar) return this; |
var jsname = ("" + this.get$jsname() + "_" + Strings.join(jsnames, "$")); |
var simpleName = ("" + this.name + "<" + Strings.join(names, ", ") + ">"); |
var key = Strings.join(names, "$"); |
var ret = this._concreteTypes.$index(key); |
- if (ret == null) { |
- ret = new ConcreteType(simpleName, this, typeMap, typeArgs); |
+ if ($eq(ret)) { |
+ ret = new DefinedType(simpleName, this.library, this.definition, this.isClass); |
+ ret.set$baseGenericType(this); |
+ ret.set$typeArgsInOrder(typeArgs); |
ret.set$_jsname(jsname); |
this._concreteTypes.$setindex(key, ret); |
+ ret.resolve(); |
} |
return ret; |
} |
DefinedType.prototype.getCallStub = function(args) { |
var name = _getCallStubName("call", args); |
var stub = this.varStubs.$index(name); |
- if (stub == null) { |
+ if ($eq(stub)) { |
stub = new VarFunctionStub(name, args); |
this.varStubs.$setindex(name, stub); |
} |
return stub; |
} |
-DefinedType.prototype.addDirectSubtype$1 = DefinedType.prototype.addDirectSubtype; |
-DefinedType.prototype.addMethod$2 = DefinedType.prototype.addMethod; |
-DefinedType.prototype.getConstructor$1 = DefinedType.prototype.getConstructor; |
-DefinedType.prototype.getFactory$2 = DefinedType.prototype.getFactory; |
-DefinedType.prototype.getMember$1 = DefinedType.prototype.getMember; |
-DefinedType.prototype.getOrMakeConcreteType$1 = DefinedType.prototype.getOrMakeConcreteType; |
-DefinedType.prototype.markUsed$0 = DefinedType.prototype.markUsed; |
-DefinedType.prototype.resolve$0 = DefinedType.prototype.resolve; |
-DefinedType.prototype.resolveTypeParams$1 = DefinedType.prototype.resolveTypeParams; |
-DefinedType.prototype.setDefinition$1 = DefinedType.prototype.setDefinition; |
// ********** Code for NativeType ************** |
function NativeType(name) { |
this.isConstructorHidden = false; |
@@ -12366,91 +11874,14 @@ function NativeType(name) { |
} |
NativeType.prototype.get$name = function() { return this.name; }; |
NativeType.prototype.set$name = function(value) { return this.name = value; }; |
-// ********** Code for FixedCollection ************** |
-function FixedCollection(value, length) { |
- this.length = length; |
- this.value = value; |
-} |
-FixedCollection.prototype.get$value = function() { return this.value; }; |
-FixedCollection.prototype.get$length = function() { return this.length; }; |
-FixedCollection.prototype.iterator = function() { |
- return new FixedIterator_E(this.value, this.length); |
-} |
-FixedCollection.prototype.forEach = function(f) { |
- Collections.forEach(this, f); |
-} |
-FixedCollection.prototype.filter = function(f) { |
- return Collections.filter(this, new Array(), f); |
-} |
-FixedCollection.prototype.every = function(f) { |
- return Collections.every(this, f); |
-} |
-FixedCollection.prototype.some = function(f) { |
- return Collections.some(this, f); |
-} |
-FixedCollection.prototype.isEmpty = function() { |
- return this.length == (0); |
-} |
-FixedCollection.prototype.filter$1 = function($0) { |
- return this.filter(to$call$1($0)); |
-}; |
-FixedCollection.prototype.forEach$1 = function($0) { |
- return this.forEach(to$call$1($0)); |
-}; |
-FixedCollection.prototype.isEmpty$0 = FixedCollection.prototype.isEmpty; |
-FixedCollection.prototype.iterator$0 = FixedCollection.prototype.iterator; |
-// ********** Code for FixedCollection_Type ************** |
-$inherits(FixedCollection_Type, FixedCollection); |
-function FixedCollection_Type(value, length) { |
- this.value = value; |
- this.length = length; |
-} |
-// ********** Code for FixedIterator ************** |
-function FixedIterator(value, length) { |
- this.length = length; |
- this._index = (0); |
- this.value = value; |
-} |
-FixedIterator.prototype.get$value = function() { return this.value; }; |
-FixedIterator.prototype.get$length = function() { return this.length; }; |
-FixedIterator.prototype.hasNext = function() { |
- return this._index < this.length; |
-} |
-FixedIterator.prototype.next = function() { |
- this._index++; |
- return this.value; |
-} |
-FixedIterator.prototype.hasNext$0 = FixedIterator.prototype.hasNext; |
-FixedIterator.prototype.next$0 = FixedIterator.prototype.next; |
-// ********** Code for FixedIterator_E ************** |
-$inherits(FixedIterator_E, FixedIterator); |
-function FixedIterator_E(value, length) { |
- this._index = (0); |
- this.value = value; |
- this.length = length; |
-} |
// ********** Code for _SharedBackingMap ************** |
-$inherits(_SharedBackingMap, HashMapImplementation_K$V); |
+$inherits(_SharedBackingMap, HashMapImplementation); |
function _SharedBackingMap() { |
this.shared = (0); |
- HashMapImplementation_K$V.call(this); |
+ HashMapImplementation.call(this); |
} |
_SharedBackingMap._SharedBackingMap$from$factory = function(other) { |
- var result = new _SharedBackingMap_K$V(); |
- other.forEach((function (k, v) { |
- result.$setindex(k, v); |
- }) |
- ); |
- return result; |
-} |
-// ********** Code for _SharedBackingMap_K$V ************** |
-$inherits(_SharedBackingMap_K$V, _SharedBackingMap); |
-function _SharedBackingMap_K$V() { |
- this.shared = (0); |
- HashMapImplementation_K$V.call(this); |
-} |
-_SharedBackingMap_K$V._SharedBackingMap$from$factory = function(other) { |
- var result = new _SharedBackingMap_K$V(); |
+ var result = new _SharedBackingMap(); |
other.forEach((function (k, v) { |
result.$setindex(k, v); |
}) |
@@ -12463,29 +11894,21 @@ function _SharedBackingMap_dart_core_String$VariableValue() { |
this.shared = (0); |
HashMapImplementation_dart_core_String$VariableValue.call(this); |
} |
-_SharedBackingMap_dart_core_String$VariableValue._SharedBackingMap$from$factory = function(other) { |
- var result = new _SharedBackingMap_dart_core_String$VariableValue(); |
- other.forEach((function (k, v) { |
- result.$setindex(k, v); |
- }) |
- ); |
- return result; |
-} |
// ********** Code for CopyOnWriteMap ************** |
-function CopyOnWriteMap() { |
- this._lang_map = new _SharedBackingMap_K$V(); |
-} |
CopyOnWriteMap._wrap$ctor = function(_map) { |
this._lang_map = _map; |
} |
CopyOnWriteMap._wrap$ctor.prototype = CopyOnWriteMap.prototype; |
+function CopyOnWriteMap() {} |
CopyOnWriteMap.prototype.clone = function() { |
- this._lang_map.shared++; |
- return new CopyOnWriteMap_K$V._wrap$ctor(this._lang_map); |
+ var $0; |
+ ($0 = this._lang_map).shared = $0.shared + (1); |
+ return new CopyOnWriteMap._wrap$ctor(this._lang_map); |
} |
CopyOnWriteMap.prototype._ensureWritable = function() { |
+ var $0; |
if (this._lang_map.shared > (0)) { |
- this._lang_map.shared--; |
+ ($0 = this._lang_map).shared = $0.shared - (1); |
this._lang_map = _SharedBackingMap._SharedBackingMap$from$factory(this._lang_map); |
} |
} |
@@ -12497,6 +11920,10 @@ CopyOnWriteMap.prototype.putIfAbsent = function(key, ifAbsent) { |
this._ensureWritable(); |
return this._lang_map.putIfAbsent(key, ifAbsent); |
} |
+CopyOnWriteMap.prototype.remove = function(key) { |
+ this._ensureWritable(); |
+ return this._lang_map.remove(key); |
+} |
CopyOnWriteMap.prototype.$index = function(key) { |
return this._lang_map.$index(key); |
} |
@@ -12518,52 +11945,13 @@ CopyOnWriteMap.prototype.getValues = function() { |
CopyOnWriteMap.prototype.containsKey = function(key) { |
return this._lang_map.containsKey(key); |
} |
-CopyOnWriteMap.prototype.containsKey$1 = CopyOnWriteMap.prototype.containsKey; |
-CopyOnWriteMap.prototype.forEach$1 = function($0) { |
- return this.forEach(to$call$2($0)); |
-}; |
-CopyOnWriteMap.prototype.getKeys$0 = CopyOnWriteMap.prototype.getKeys; |
-CopyOnWriteMap.prototype.getValues$0 = CopyOnWriteMap.prototype.getValues; |
-CopyOnWriteMap.prototype.isEmpty$0 = CopyOnWriteMap.prototype.isEmpty; |
-// ********** Code for CopyOnWriteMap_K$V ************** |
-$inherits(CopyOnWriteMap_K$V, CopyOnWriteMap); |
-function CopyOnWriteMap_K$V() {} |
-CopyOnWriteMap_K$V._wrap$ctor = function(_map) { |
- this._lang_map = _map; |
-} |
-CopyOnWriteMap_K$V._wrap$ctor.prototype = CopyOnWriteMap_K$V.prototype; |
+CopyOnWriteMap.prototype.remove$1 = CopyOnWriteMap.prototype.remove; |
// ********** Code for CopyOnWriteMap_dart_core_String$VariableValue ************** |
$inherits(CopyOnWriteMap_dart_core_String$VariableValue, CopyOnWriteMap); |
function CopyOnWriteMap_dart_core_String$VariableValue() { |
this._lang_map = new _SharedBackingMap_dart_core_String$VariableValue(); |
} |
-CopyOnWriteMap_dart_core_String$VariableValue._wrap$ctor = function(_map) { |
- this._lang_map = _map; |
-} |
-CopyOnWriteMap_dart_core_String$VariableValue._wrap$ctor.prototype = CopyOnWriteMap_dart_core_String$VariableValue.prototype; |
-CopyOnWriteMap_dart_core_String$VariableValue.prototype.clone = function() { |
- this._lang_map.shared++; |
- return new CopyOnWriteMap_dart_core_String$VariableValue._wrap$ctor(this._lang_map); |
-} |
-CopyOnWriteMap_dart_core_String$VariableValue.prototype._ensureWritable = function() { |
- if (this._lang_map.shared > (0)) { |
- this._lang_map.shared--; |
- this._lang_map = _SharedBackingMap._SharedBackingMap$from$factory(this._lang_map); |
- } |
-} |
-CopyOnWriteMap_dart_core_String$VariableValue.prototype.$setindex = function(key, value) { |
- this._ensureWritable(); |
- this._lang_map.$setindex(key, value); |
-} |
-CopyOnWriteMap_dart_core_String$VariableValue.prototype.$index = function(key) { |
- return this._lang_map.$index(key); |
-} |
-CopyOnWriteMap_dart_core_String$VariableValue.prototype.forEach = function(f) { |
- return this._lang_map.forEach(f); |
-} |
-CopyOnWriteMap_dart_core_String$VariableValue.prototype.containsKey = function(key) { |
- return this._lang_map.containsKey(key); |
-} |
+CopyOnWriteMap_dart_core_String$VariableValue.prototype.remove$1 = CopyOnWriteMap_dart_core_String$VariableValue.prototype.remove; |
// ********** Code for Value ************** |
function Value(type, code, span) { |
this.type = type; |
@@ -12599,9 +11987,9 @@ Value.union = function(x, y) { |
if (y == null || $eq(x, y)) return x; |
if (x == null) return y; |
var ret = x._tryUnion(y); |
- if (ret != null) return ret; |
+ if ($ne(ret)) return ret; |
ret = y._tryUnion(x); |
- if (ret != null) return ret; |
+ if ($ne(ret)) return ret; |
return new Value(Type.union(x.get$type(), y.get$type()), null, null); |
} |
Value.prototype._tryUnion = function(right) { |
@@ -12611,37 +11999,37 @@ Value.prototype.validateInitialized = function(span) { |
} |
Value.prototype.get_ = function(context, name, node) { |
- var member = this._resolveMember(context, name, node, false); |
- if (member != null) { |
- return member._get$3(context, node, this); |
+ var member = this._resolveMember(context, name, node); |
+ if ($ne(member)) { |
+ return member._get(context, node, this); |
} |
else { |
return this.invokeNoSuchMethod(context, ("get:" + name), node); |
} |
} |
-Value.prototype.set_ = function(context, name, node, value, isDynamic, kind, returnKind) { |
- var member = this._resolveMember(context, name, node, isDynamic); |
- if (member != null) { |
+Value.prototype.set_ = function(context, name, node, value, kind, returnKind) { |
+ var member = this._resolveMember(context, name, node); |
+ if ($ne(member)) { |
var thisValue = this; |
var thisTmp = null; |
var retTmp = null; |
if (kind != (0)) { |
thisTmp = context.getTemp(thisValue); |
thisValue = context.assignTemp(thisTmp, thisValue); |
- var lhs = member._get$3(context, node, thisTmp); |
+ var lhs = member._get(context, node, thisTmp); |
if (returnKind == (3)) { |
retTmp = context.forceTemp(lhs); |
lhs = context.assignTemp(retTmp, lhs); |
} |
- value = lhs.binop$4(kind, value, context, node); |
+ value = lhs.binop(kind, value, context, node); |
} |
if (returnKind == (2)) { |
retTmp = context.forceTemp(value); |
value = context.assignTemp(retTmp, value); |
} |
- var ret = member._set$5(context, node, thisValue, value, isDynamic); |
- if (thisTmp != null && $ne(thisTmp, this)) context.freeTemp(thisTmp); |
- if (retTmp != null) { |
+ var ret = member._set(context, node, thisValue, value); |
+ if ($ne(thisTmp) && $ne(thisTmp, this)) context.freeTemp(thisTmp); |
+ if ($ne(retTmp)) { |
context.freeTemp(retTmp); |
return Value.comma(ret, retTmp); |
} |
@@ -12653,9 +12041,9 @@ Value.prototype.set_ = function(context, name, node, value, isDynamic, kind, ret |
return this.invokeNoSuchMethod(context, ("set:" + name), node, new Arguments(null, [value])); |
} |
} |
-Value.prototype.setIndex = function(context, index, node, value, isDynamic, kind, returnKind) { |
- var member = this._resolveMember(context, ":setindex", node, isDynamic); |
- if (member != null) { |
+Value.prototype.setIndex = function(context, index, node, value, kind, returnKind) { |
+ var member = this._resolveMember(context, ":setindex", node); |
+ if ($ne(member)) { |
var thisValue = this; |
var indexValue = index; |
var thisTmp = null; |
@@ -12672,19 +12060,19 @@ Value.prototype.setIndex = function(context, index, node, value, isDynamic, kind |
if (returnKind == (3)) { |
retTmp = context.forceTemp(value); |
} |
- var lhs = thisTmp.invoke$4(context, ":index", node, new Arguments(null, [indexTmp])); |
+ var lhs = thisTmp.invoke(context, ":index", node, new Arguments(null, [indexTmp])); |
if (returnKind == (3)) { |
lhs = context.assignTemp(retTmp, lhs); |
} |
- value = lhs.binop$4(kind, value, context, node); |
+ value = lhs.binop(kind, value, context, node); |
} |
if (returnKind == (2)) { |
value = context.assignTemp(retTmp, value); |
} |
- var ret = member.invoke$5(context, node, thisValue, new Arguments(null, [indexValue, value]), isDynamic); |
- if (thisTmp != null && $ne(thisTmp, this)) context.freeTemp(thisTmp); |
- if (indexTmp != null && $ne(indexTmp, index)) context.freeTemp(indexTmp); |
- if (retTmp != null) { |
+ var ret = member.invoke(context, node, thisValue, new Arguments(null, [indexValue, value])); |
+ if ($ne(thisTmp) && $ne(thisTmp, this)) context.freeTemp(thisTmp); |
+ if ($ne(indexTmp) && $ne(indexTmp, index)) context.freeTemp(indexTmp); |
+ if ($ne(retTmp)) { |
context.freeTemp(retTmp); |
return Value.comma(ret, retTmp); |
} |
@@ -12700,7 +12088,7 @@ Value.prototype.unop = function(kind, context, node) { |
switch (kind) { |
case (19): |
- var newVal = this.convertTo(context, $globals.world.nonNullBool, false); |
+ var newVal = this.convertTo(context, $globals.world.nonNullBool); |
return new Value(newVal.get$type(), ("!" + newVal.get$code()), node.get$span()); |
case (42): |
@@ -12710,15 +12098,18 @@ Value.prototype.unop = function(kind, context, node) { |
case (43): |
- return this.invoke(context, ":negate", node, Arguments.get$EMPTY(), false); |
+ return this.invoke(context, ":negate", node, Arguments.get$EMPTY()); |
case (18): |
- return this.invoke(context, ":bit_not", node, Arguments.get$EMPTY(), false); |
+ return this.invoke(context, ":bit_not", node, Arguments.get$EMPTY()); |
} |
$globals.world.internalError(("unimplemented: " + node.get$op()), node.get$span()); |
} |
+Value.prototype._mayOverrideEqual = function() { |
+ return this.get$type().get$isVar() || this.get$type().get$isObject() || !this.get$type().getMember(":eq").declaringType.get$isObject(); |
+} |
Value.prototype.binop = function(kind, other, context, node) { |
switch (kind) { |
case (35): |
@@ -12735,11 +12126,35 @@ Value.prototype.binop = function(kind, other, context, node) { |
return new Value($globals.world.nonNullBool, ("" + this.get$code() + " != " + other.get$code()), node.get$span()); |
+ case (48): |
+ |
+ if (other.get$code() == "null") { |
+ if (!this._mayOverrideEqual()) { |
+ return new Value($globals.world.nonNullBool, ("" + this.get$code() + " == " + other.get$code()), node.get$span()); |
+ } |
+ } |
+ else if (this.get$code() == "null") { |
+ return new Value($globals.world.nonNullBool, ("" + this.get$code() + " == " + other.get$code()), node.get$span()); |
+ } |
+ break; |
+ |
+ case (49): |
+ |
+ if (other.get$code() == "null") { |
+ if (!this._mayOverrideEqual()) { |
+ return new Value($globals.world.nonNullBool, ("" + this.get$code() + " != " + other.get$code()), node.get$span()); |
+ } |
+ } |
+ else if (this.get$code() == "null") { |
+ return new Value($globals.world.nonNullBool, ("" + this.get$code() + " != " + other.get$code()), node.get$span()); |
+ } |
+ break; |
+ |
} |
var name = kind == (49) ? ":ne" : TokenKind.binaryMethodName(kind); |
- return this.invoke(context, name, node, new Arguments(null, [other]), false); |
+ return this.invoke(context, name, node, new Arguments(null, [other])); |
} |
-Value.prototype.invoke = function(context, name, node, args, isDynamic) { |
+Value.prototype.invoke = function(context, name, node, args) { |
if (name == ":call") { |
if (this.get$isType()) { |
$globals.world.error("must use \"new\" or \"const\" to construct a new instance", node.span); |
@@ -12748,36 +12163,29 @@ Value.prototype.invoke = function(context, name, node, args, isDynamic) { |
return this._varCall(context, node, args); |
} |
} |
- var member = this._resolveMember(context, name, node, isDynamic); |
- if (member == null) { |
+ var member = this._resolveMember(context, name, node); |
+ if ($eq(member)) { |
return this.invokeNoSuchMethod(context, name, node, args); |
} |
else { |
- return member.invoke$5(context, node, this, args, isDynamic); |
- } |
-} |
-Value.prototype.canInvoke = function(context, name, args) { |
- if (this.get$type().get$isVarOrFunction() && name == ":call") { |
- return true; |
+ return member.invoke(context, node, this, args); |
} |
- var member = this._resolveMember(context, name, null, true); |
- return member != null && member.canInvoke$2(context, args); |
} |
Value.prototype._hasOverriddenNoSuchMethod = function() { |
var m = this.get$type().getMember("noSuchMethod"); |
- return m != null && !m.get$declaringType().get$isObject(); |
+ return $ne(m) && !m.get$declaringType().get$isObject(); |
} |
Value.prototype.get$isPreciseType = function() { |
return this.get$isSuper() || this.get$isType(); |
} |
-Value.prototype._missingMemberError = function(context, name, isDynamic, node) { |
+Value.prototype._missingMemberError = function(context, name, node) { |
var onStaticType = false; |
if ($ne(this.get$type(), this.get$staticType())) { |
onStaticType = this.get$staticType().getMember(name) != null; |
} |
- if (!onStaticType && !isDynamic && !this._isVarOrParameterType(this.get$staticType()) && !this._hasOverriddenNoSuchMethod()) { |
+ if (!onStaticType && context.get$showWarnings() && !this._isVarOrParameterType(this.get$staticType()) && !this._hasOverriddenNoSuchMethod()) { |
var typeName = this.get$staticType().name; |
- if (typeName == null) typeName = this.get$staticType().get$library().name; |
+ if ($eq(typeName)) typeName = this.get$staticType().get$library().name; |
var message = ("can not resolve \"" + name + "\" on \"" + typeName + "\""); |
if (this.get$isType()) { |
$globals.world.error(message, node.span); |
@@ -12787,17 +12195,15 @@ Value.prototype._missingMemberError = function(context, name, isDynamic, node) { |
} |
} |
} |
-Value.prototype._tryResolveMember = function(context, name, isDynamic, node) { |
+Value.prototype._tryResolveMember = function(context, name, node) { |
var member = this.get$type().getMember(name); |
- if (member == null) { |
- this._missingMemberError(context, name, isDynamic, node); |
+ if ($eq(member)) { |
+ this._missingMemberError(context, name, node); |
return null; |
} |
else { |
- if (this.get$isType() && !member.get$isStatic()) { |
- if (!isDynamic) { |
- $globals.world.error("can not refer to instance member as static", node.span); |
- } |
+ if (this.get$isType() && !member.get$isStatic() && context.get$showWarnings()) { |
+ $globals.world.error("can not refer to instance member as static", node.span); |
return null; |
} |
} |
@@ -12814,14 +12220,14 @@ Value.prototype._isVarOrParameterType = function(t) { |
Value.prototype._shouldBindDynamically = function() { |
return this._isVarOrParameterType(this.get$type()) || $globals.options.forceDynamic && !this.get$isConst(); |
} |
-Value.prototype._resolveMember = function(context, name, node, isDynamic) { |
+Value.prototype._resolveMember = function(context, name, node) { |
var member = null; |
if (!this._shouldBindDynamically()) { |
- member = this._tryResolveMember(context, name, isDynamic, node); |
+ member = this._tryResolveMember(context, name, node); |
} |
- if (member == null && !this.get$isSuper() && !this.get$isType()) { |
+ if ($eq(member) && !this.get$isSuper() && !this.get$isType()) { |
member = context.findMembers(name); |
- if (member == null && !isDynamic) { |
+ if ($eq(member) && context.get$showWarnings()) { |
var where = "the world"; |
if (name.startsWith("_")) { |
where = ("library \"" + context.get$library().name + "\""); |
@@ -12838,16 +12244,16 @@ Value.prototype.checkFirstClass = function(span) { |
} |
Value.prototype._varCall = function(context, node, args) { |
var stub = $globals.world.functionType.getCallStub(args); |
- return stub.invoke$4(context, node, this, args); |
+ return stub.invoke(context, node, this, args); |
} |
Value.prototype.needsConversion = function(toType) { |
- var c = this.convertTo(null, toType, true); |
- return c == null || this.get$code() != c.get$code(); |
+ var c = this.convertTo(null, toType); |
+ return $eq(c) || this.get$code() != c.get$code(); |
} |
-Value.prototype.convertTo = function(context, toType, isDynamic) { |
- var checked = !isDynamic; |
+Value.prototype.convertTo = function(context, toType) { |
+ var checked = context != null && context.get$showWarnings(); |
var callMethod = toType.getCallMethod(); |
- if (callMethod != null) { |
+ if ($ne(callMethod)) { |
if (checked && !toType.isAssignable(this.get$type())) { |
this.convertWarning(toType); |
} |
@@ -12865,10 +12271,10 @@ Value.prototype.convertTo = function(context, toType, isDynamic) { |
this.convertWarning(toType); |
} |
if ($globals.options.enableTypeChecks) { |
- if (context == null && isDynamic) { |
+ if (context == null) { |
return null; |
} |
- return this._typeAssert(context, toType, isDynamic); |
+ return this._typeAssert(context, toType); |
} |
else { |
return this.changeStaticType(toType); |
@@ -12881,7 +12287,7 @@ Value.prototype._maybeWrapFunction = function(toType, callMethod) { |
var arity = callMethod.parameters.get$length(); |
var myCall = this.get$type().getCallMethod(); |
var result = this; |
- if (myCall == null || $ne(myCall.get$parameters().get$length(), arity)) { |
+ if ($eq(myCall) || myCall.get$parameters().get$length() != arity) { |
var stub = $globals.world.functionType.getCallStub(Arguments.Arguments$bare$factory(arity)); |
result = new Value(toType, ("to$" + stub.get$name() + "(" + this.get$code() + ")"), this.span); |
} |
@@ -12897,7 +12303,8 @@ Value.prototype._maybeWrapFunction = function(toType, callMethod) { |
if (result == this) result = this.changeStaticType(toType); |
return result; |
} |
-Value.prototype._typeAssert = function(context, toType, isDynamic) { |
+Value.prototype._typeAssert = function(context, toType) { |
+ var $0; |
if ((toType instanceof ParameterType)) { |
var p = toType; |
toType = p.extendsType; |
@@ -12909,7 +12316,7 @@ Value.prototype._typeAssert = function(context, toType, isDynamic) { |
return $globals.world.withoutForceDynamic((function () { |
var typeErrorCtor = $globals.world.typeErrorType.getConstructor("_internal"); |
$globals.world.gen.corejs.ensureTypeNameOf(); |
- var result = typeErrorCtor.invoke$5(context, null, new TypeValue($globals.world.typeErrorType, null), new Arguments(null, [new Value($globals.world.objectType, paramName, null), new Value($globals.world.stringType, ("\"" + toType.name + "\""), null)]), isDynamic); |
+ var result = typeErrorCtor.invoke(context, null, new TypeValue($globals.world.typeErrorType, null), new Arguments(null, [new Value($globals.world.objectType, paramName, null), new Value($globals.world.stringType, ("\"" + toType.name + "\""), null)])); |
$globals.world.gen.corejs.useThrow = true; |
return ("$throw(" + result.get$code() + ")"); |
}) |
@@ -12920,7 +12327,7 @@ Value.prototype._typeAssert = function(context, toType, isDynamic) { |
if (toType.get$isVoid()) { |
check = ("$assert_void(" + this.get$code() + ")"); |
if (toType.typeCheckCode == null) { |
- toType.typeCheckCode = ("function $assert_void(x) {\n if (x == null) return null;\n " + throwTypeError.call$1("x") + "\n}"); |
+ toType.typeCheckCode = ("function $assert_void(x) {\n if (x == null) return null;\n " + throwTypeError("x") + "\n}"); |
} |
} |
else if ($eq(toType, $globals.world.nonNullBool)) { |
@@ -12930,22 +12337,22 @@ Value.prototype._typeAssert = function(context, toType, isDynamic) { |
else if (toType.get$library().get$isCore() && toType.get$typeofName() != null) { |
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.call$1("x") + "\n}"); |
+ toType.typeCheckCode = ("function $assert_" + toType.name + "(x) {\n if (x == null || typeof(x) == \"" + toType.get$typeofName() + "\") return x;\n " + throwTypeError("x") + "\n}"); |
} |
} |
else { |
toType.isChecked = true; |
- var checkName = "assert$" + toType.get$jsname(); |
+ var checkName = $add("assert$", toType.get$jsname()); |
var temp = context.getTemp(this); |
check = ("(" + context.assignTemp(temp, this).get$code() + " == null ? null :"); |
- check = check + (" " + temp.get$code() + "." + checkName + "())"); |
+ check = $add(check, (" " + temp.get$code() + "." + checkName + "())")); |
if ($ne(this, temp)) context.freeTemp(temp); |
$globals.world.objectType.varStubs.putIfAbsent(checkName, (function () { |
- return new VarMethodStub(checkName, null, Arguments.get$EMPTY(), throwTypeError.call$1("this")); |
+ return new VarMethodStub(checkName, null, Arguments.get$EMPTY(), throwTypeError("this")); |
}) |
); |
} |
- context.counters.typeAsserts++; |
+ ($0 = context.get$counters()).typeAsserts = $0.typeAsserts + (1); |
return new Value(toType, check, this.span); |
} |
Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) { |
@@ -12963,15 +12370,15 @@ Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) |
} |
if (toType.get$library().get$isCore()) { |
var typeofName = toType.get$typeofName(); |
- if (typeofName != null) { |
+ if ($ne(typeofName)) { |
testCode = ("(typeof(" + this.get$code() + ") " + (isTrue ? "==" : "!=") + " '" + typeofName + "')"); |
} |
} |
- if (toType.get$isClass() && !(toType instanceof ConcreteType) && !toType.get$isHiddenNativeType()) { |
+ if (toType.get$isClass() && !toType.get$isHiddenNativeType() && !toType.get$isConcreteGeneric()) { |
toType.markUsed(); |
testCode = ("(" + this.get$code() + " instanceof " + toType.get$jsname() + ")"); |
if (!isTrue) { |
- testCode = "!" + testCode; |
+ testCode = $add("!", testCode); |
} |
} |
if (testCode == null) { |
@@ -12979,12 +12386,12 @@ Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) |
var temp = context.getTemp(this); |
var checkName = ("is$" + toType.get$jsname()); |
testCode = ("(" + context.assignTemp(temp, this).get$code() + " &&"); |
- testCode = testCode + (" " + temp.get$code() + "." + checkName + "())"); |
+ testCode = $add(testCode, (" " + temp.get$code() + "." + checkName + "())")); |
if (isTrue) { |
- testCode = "!!" + testCode; |
+ testCode = $add("!!", testCode); |
} |
else { |
- testCode = "!" + testCode; |
+ testCode = $add("!", testCode); |
} |
if ($ne(this, temp)) context.freeTemp(temp); |
if (!$globals.world.objectType.varStubs.containsKey(checkName)) { |
@@ -13005,12 +12412,12 @@ Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { |
var argsCode = []; |
for (var i = (0); |
i < args.get$length(); i++) { |
- argsCode.add$1(args.values[i].get$code()); |
+ argsCode.add(args.values.$index(i).get$code()); |
} |
pos = Strings.join(argsCode, ", "); |
} |
var noSuchArgs = [new Value($globals.world.stringType, ("\"" + name + "\""), node.span), new Value($globals.world.listType, ("[" + pos + "]"), node.span)]; |
- return this._resolveMember(context, "noSuchMethod", node, false).invoke(context, node, this, new Arguments(null, noSuchArgs), false); |
+ return this._resolveMember(context, "noSuchMethod", node).invoke(context, node, this, new Arguments(null, noSuchArgs)); |
} |
Value.fromBool = function(value, span) { |
return new BoolValue(value, true, span); |
@@ -13027,31 +12434,121 @@ Value.fromString = function(value, 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.setIndex$4$kind = function($0, $1, $2, $3, kind) { |
+ return this.setIndex($0, $1, $2, $3, kind, (1)); |
+}; |
+Value.prototype.setIndex$4$kind$returnKind = Value.prototype.setIndex; |
+Value.prototype.set_$4$kind = function($0, $1, $2, $3, kind) { |
+ return this.set_($0, $1, $2, $3, kind, (1)); |
}; |
-Value.prototype.invoke$4$isDynamic = Value.prototype.invoke; |
-Value.prototype.invoke$5 = Value.prototype.invoke; |
-Value.prototype.invokeNoSuchMethod$4 = Value.prototype.invokeNoSuchMethod; |
-Value.prototype.needsConversion$1 = Value.prototype.needsConversion; |
-Value.prototype.setIndex$4$kind$returnKind = function($0, $1, $2, $3, kind, returnKind) { |
- return this.setIndex($0, $1, $2, $3, false, kind, returnKind); |
+Value.prototype.set_$4$kind$returnKind = Value.prototype.set_; |
+// ********** Code for PureStaticValue ************** |
+$inherits(PureStaticValue, Value); |
+function PureStaticValue(type, span, isConst, isType) { |
+ this.isType = isType; |
+ this.isConst = isConst; |
+ Value.call(this, type, null, span); |
+} |
+PureStaticValue.prototype.get$isConst = function() { return this.isConst; }; |
+PureStaticValue.prototype.set$isConst = function(value) { return this.isConst = value; }; |
+PureStaticValue.prototype.get$isType = function() { return this.isType; }; |
+PureStaticValue.prototype.set$isType = function(value) { return this.isType = value; }; |
+PureStaticValue.prototype.getMem = function(context, name, node) { |
+ var member = this.get$type().getMember(name); |
+ if ($eq(member)) { |
+ $globals.world.warning(("can not find \"" + name + "\" on \"" + this.get$type().name + "\""), node.span); |
+ } |
+ if (this.isType && !member.get$isStatic()) { |
+ $globals.world.error("can not refer to instance member as static", node.span); |
+ } |
+ return member; |
+} |
+PureStaticValue.prototype.get_ = function(context, name, node) { |
+ if (this.get$type().get$isVar()) return new PureStaticValue($globals.world.varType, node.span, false, false); |
+ var member = this.getMem(context, name, node); |
+ if ($eq(member)) return new PureStaticValue($globals.world.varType, node.span, false, false); |
+ return member._get(context, node, this); |
+} |
+PureStaticValue.prototype.set_ = function(context, name, node, value, kind, returnKind) { |
+ if (this.get$type().get$isVar()) return new PureStaticValue($globals.world.varType, node.span, false, false); |
+ var member = this.getMem(context, name, node); |
+ if ($ne(member)) { |
+ member._set(context, node, this, value); |
+ } |
+ return new PureStaticValue(value.get$type(), node.span, false, false); |
+} |
+PureStaticValue.prototype.setIndex = function(context, index, node, value, kind, returnKind) { |
+ return this.invoke(context, ":setindex", node, new Arguments(null, [index, value])); |
+} |
+PureStaticValue.prototype.unop = function(kind, context, node) { |
+ switch (kind) { |
+ case (19): |
+ |
+ return new PureStaticValue($globals.world.boolType, node.get$span(), false, false); |
+ |
+ case (42): |
+ |
+ if (!this.isConst && !this.get$type().get$isNum()) { |
+ $globals.world.error("no unary add operator in dart", node.get$span()); |
+ } |
+ return new PureStaticValue($globals.world.numType, node.get$span(), false, false); |
+ |
+ case (43): |
+ |
+ return this.invoke(context, ":negate", node, Arguments.get$EMPTY()); |
+ |
+ case (18): |
+ |
+ return this.invoke(context, ":bit_not", node, Arguments.get$EMPTY()); |
+ |
+ } |
+ $globals.world.internalError(("unimplemented: " + node.get$op()), node.get$span()); |
+} |
+PureStaticValue.prototype.binop = function(kind, other, context, node) { |
+ var isConst = this.isConst && other.get$isConst(); |
+ switch (kind) { |
+ case (35): |
+ case (34): |
+ |
+ return new PureStaticValue($globals.world.boolType, node.get$span(), isConst, false); |
+ |
+ case (50): |
+ |
+ return new PureStaticValue($globals.world.boolType, node.get$span(), isConst, false); |
+ |
+ case (51): |
+ |
+ return new PureStaticValue($globals.world.boolType, node.get$span(), isConst, false); |
+ |
+ } |
+ var name = kind == (49) ? ":ne" : TokenKind.binaryMethodName(kind); |
+ var ret = this.invoke(context, name, node, new Arguments(null, [other])); |
+ if (isConst) { |
+ ret = new PureStaticValue(ret.get$type(), node.get$span(), isConst, false); |
+ } |
+ return ret; |
+} |
+PureStaticValue.prototype.invoke = function(context, name, node, args) { |
+ if (this.get$type().get$isVar()) return new PureStaticValue($globals.world.varType, node.span, false, false); |
+ if (this.get$type().get$isFunction() && name == ":call") { |
+ return new PureStaticValue($globals.world.varType, node.span, false, false); |
+ } |
+ var member = this.getMem(context, name, node); |
+ if ($eq(member)) return new PureStaticValue($globals.world.varType, node.span, false, false); |
+ return member.invoke(context, node, this, args); |
+} |
+PureStaticValue.prototype.setIndex$4$kind = function($0, $1, $2, $3, kind) { |
+ return this.setIndex($0, $1, $2, $3, kind, (1)); |
}; |
-Value.prototype.set_$4$kind$returnKind = function($0, $1, $2, $3, kind, returnKind) { |
- return this.set_($0, $1, $2, $3, false, kind, returnKind); |
+PureStaticValue.prototype.setIndex$4$kind$returnKind = PureStaticValue.prototype.setIndex; |
+PureStaticValue.prototype.set_$4$kind = function($0, $1, $2, $3, kind) { |
+ return this.set_($0, $1, $2, $3, kind, (1)); |
}; |
-Value.prototype.unop$3 = Value.prototype.unop; |
+PureStaticValue.prototype.set_$4$kind$returnKind = PureStaticValue.prototype.set_; |
// ********** Code for EvaluatedValue ************** |
$inherits(EvaluatedValue, Value); |
function EvaluatedValue(isConst, type, span) { |
@@ -13071,7 +12568,6 @@ EvaluatedValue.prototype.hashCode = function() { |
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) { |
@@ -13101,7 +12597,6 @@ NullValue.prototype.binop = function(kind, other, context, node) { |
} |
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) { |
@@ -13148,8 +12643,6 @@ BoolValue.prototype.binop = function(kind, other, context, node) { |
} |
return Value.prototype.binop.call(this, kind, other, context, node); |
} |
-BoolValue.prototype.binop$4 = BoolValue.prototype.binop; |
-BoolValue.prototype.unop$3 = BoolValue.prototype.unop; |
// ********** Code for IntValue ************** |
$inherits(IntValue, EvaluatedValue); |
function IntValue(actualValue, isConst, span) { |
@@ -13314,8 +12807,6 @@ IntValue.prototype.binop = function(kind, other, context, node) { |
} |
return Value.prototype.binop.call(this, kind, other, context, node); |
} |
-IntValue.prototype.binop$4 = IntValue.prototype.binop; |
-IntValue.prototype.unop$3 = IntValue.prototype.unop; |
// ********** Code for DoubleValue ************** |
$inherits(DoubleValue, EvaluatedValue); |
function DoubleValue(actualValue, isConst, span) { |
@@ -13456,8 +12947,6 @@ DoubleValue.prototype.binop = function(kind, other, context, node) { |
} |
return Value.prototype.binop.call(this, kind, other, context, node); |
} |
-DoubleValue.prototype.binop$4 = DoubleValue.prototype.binop; |
-DoubleValue.prototype.unop$3 = DoubleValue.prototype.unop; |
// ********** Code for StringValue ************** |
$inherits(StringValue, EvaluatedValue); |
function StringValue(actualValue, isConst, span) { |
@@ -13483,7 +12972,7 @@ StringValue.prototype.binop = function(kind, other, context, node) { |
case (42): |
- return new StringValue(x + y, c, s); |
+ return new StringValue($add(x, y), c, s); |
} |
return Value.prototype.binop.call(this, kind, other, context, node); |
@@ -13522,11 +13011,11 @@ StringValue.prototype.get$code = function() { |
default: |
- if (ch >= (32) && ch <= (126)) { |
+ if ($gte(ch, (32)) && $lte(ch, (126))) { |
buf.add(this.actualValue[i]); |
} |
else { |
- var hex = ch.toRadixString$1((16)); |
+ var hex = ch.toRadixString((16)); |
switch (hex.get$length()) { |
case (1): |
@@ -13566,7 +13055,6 @@ StringValue.prototype.get$code = function() { |
buf.add("\""); |
return buf.toString(); |
} |
-StringValue.prototype.binop$4 = StringValue.prototype.binop; |
// ********** Code for ListValue ************** |
$inherits(ListValue, EvaluatedValue); |
function ListValue(values, isConst, type, span) { |
@@ -13575,18 +13063,18 @@ function ListValue(values, isConst, type, span) { |
} |
ListValue.prototype.get$code = function() { |
var buf = new StringBufferImpl(""); |
- buf.add$1("["); |
+ buf.add("["); |
for (var i = (0); |
- i < this.values.get$length(); i = $add(i, (1))) { |
- if (i > (0)) buf.add$1(", "); |
- buf.add$1(this.values[i].get$code()); |
+ $lt(i, this.values.get$length()); i = $add(i, (1))) { |
+ if ($gt(i, (0))) buf.add(", "); |
+ buf.add(this.values.$index(i).get$code()); |
} |
- buf.add$1("]"); |
+ buf.add("]"); |
var listCode = buf.toString$0(); |
if (!this.isConst) return listCode; |
var v = new Value($globals.world.listType, listCode, this.span); |
var immutableListCtor = $globals.world.immutableListType.getConstructor("from"); |
- var result = immutableListCtor.invoke$4(null, null, new TypeValue(v.get$type(), this.span), new Arguments(null, [v])); |
+ var result = immutableListCtor.invoke($globals.world.gen.mainContext, null, new TypeValue(v.get$type(), this.span), new Arguments(null, [v])); |
return result.get$code(); |
} |
ListValue.prototype.binop = function(kind, other, context, node) { |
@@ -13606,8 +13094,6 @@ ListValue.prototype.binop = function(kind, other, context, node) { |
ListValue.prototype.getGlobalValue = function() { |
return $globals.world.gen.globalForConst(this, this.values); |
} |
-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) { |
@@ -13617,8 +13103,8 @@ function MapValue(values, isConst, type, span) { |
MapValue.prototype.get$code = function() { |
var items = new ListValue(this.values, false, $globals.world.listType, this.span); |
var tp = $globals.world.coreimpl.topType; |
- var f = this.isConst ? tp.getMember$1("_constMap") : tp.getMember$1("_map"); |
- var value = f.invoke(null, null, new TypeValue(tp, null), new Arguments(null, [items]), false); |
+ var f = this.isConst ? tp.getMember("_constMap") : tp.getMember("_map"); |
+ var value = f.invoke($globals.world.gen.mainContext, null, new TypeValue(tp, null), new Arguments(null, [items])); |
return value.get$code(); |
} |
MapValue.prototype.getGlobalValue = function() { |
@@ -13638,8 +13124,6 @@ MapValue.prototype.binop = function(kind, other, context, node) { |
} |
return Value.prototype.binop.call(this, kind, other, context, node); |
} |
-MapValue.prototype.binop$4 = MapValue.prototype.binop; |
-MapValue.prototype.getGlobalValue$0 = MapValue.prototype.getGlobalValue; |
// ********** Code for ObjectValue ************** |
$inherits(ObjectValue, EvaluatedValue); |
function ObjectValue(isConst, type, span) { |
@@ -13655,11 +13139,11 @@ ObjectValue.prototype.get$code = function() { |
return this._code; |
} |
ObjectValue.prototype.initFields = function() { |
- var allMembers = $globals.world.gen._orderValues(this.get$type().getAllMembers()); |
- for (var $$i = allMembers.iterator$0(); $$i.hasNext$0(); ) { |
- var f = $$i.next$0(); |
+ var allMembers = $globals.world.gen._orderValues(this.get$type().get$genericType().getAllMembers()); |
+ for (var $$i = allMembers.iterator(); $$i.hasNext(); ) { |
+ var f = $$i.next(); |
if (f.get$isField() && !f.get$isStatic() && f.get$declaringType().get$isClass()) { |
- this.fields.$setindex(f, f.computeValue$0()); |
+ this.fields.$setindex(f, f.computeValue()); |
} |
} |
} |
@@ -13688,25 +13172,25 @@ ObjectValue.prototype.setField = function(field, value, duringInit) { |
} |
ObjectValue.prototype.validateInitialized = function(span) { |
var buf = new StringBufferImpl(""); |
- buf.add$1("Object.create("); |
- buf.add$1(("" + this.get$type().get$jsname() + ".prototype, ")); |
- buf.add$1("{"); |
+ buf.add("Object.create("); |
+ buf.add(("" + this.get$type().get$jsname() + ".prototype, ")); |
+ buf.add("{"); |
var $$list = this.fields.getKeys(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var field = $$i.next$0(); |
- buf.add$1(field.get$name()); |
- buf.add$1(": "); |
- buf.add$1("{\"value\": "); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var field = $$i.next(); |
+ buf.add(field.get$name()); |
+ buf.add(": "); |
+ buf.add("{\"value\": "); |
if (this.fields.$index(field) == null) { |
$globals.world.error(("Required field \"" + field.get$name() + "\" was not initialized"), span, field.get$span()); |
- buf.add$1("null"); |
+ buf.add("null"); |
} |
else { |
- buf.add$1(this.fields.$index(field).get$code()); |
+ buf.add(this.fields.$index(field).get$code()); |
} |
- buf.add$1(", writeable: false}, "); |
+ buf.add(", writeable: false}, "); |
} |
- buf.add$1("})"); |
+ buf.add("})"); |
this._code = buf.toString$0(); |
} |
ObjectValue.prototype.binop = function(kind, other, context, node) { |
@@ -13725,8 +13209,6 @@ ObjectValue.prototype.binop = function(kind, other, context, node) { |
} |
return Value.prototype.binop.call(this, kind, other, context, node); |
} |
-ObjectValue.prototype.binop$4 = ObjectValue.prototype.binop; |
-ObjectValue.prototype.initFields$0 = ObjectValue.prototype.initFields; |
// ********** Code for GlobalValue ************** |
$inherits(GlobalValue, Value); |
function GlobalValue(type, code, isConst, field, name, exp, span, deps) { |
@@ -13736,8 +13218,8 @@ function GlobalValue(type, code, isConst, field, name, exp, span, deps) { |
this.dependencies = []; |
this.isConst = isConst; |
Value.call(this, type, code, span); |
- for (var $$i = 0;$$i < deps.get$length(); $$i++) { |
- var dep = deps[$$i]; |
+ for (var $$i = deps.iterator(); $$i.hasNext(); ) { |
+ var dep = $$i.next(); |
if ((dep instanceof GlobalValue)) { |
this.dependencies.add(dep); |
this.dependencies.addAll(dep.get$dependencies()); |
@@ -13784,13 +13266,12 @@ GlobalValue.prototype.compareTo = function(other) { |
return this.field.name.compareTo(other.field.name); |
} |
} |
-GlobalValue.prototype.compareTo$1 = GlobalValue.prototype.compareTo; |
// ********** Code for BareValue ************** |
$inherits(BareValue, Value); |
function BareValue(home, outermost, span) { |
this.isType = outermost.get$isStatic(); |
this.home = home; |
- Value.call(this, outermost.method.declaringType, null, span); |
+ Value.call(this, outermost.method.get$declaringType(), null, span); |
} |
BareValue.prototype.get$isType = function() { return this.isType; }; |
BareValue.prototype.get$needsTemp = function() { |
@@ -13805,16 +13286,16 @@ BareValue.prototype.get$code = function() { |
BareValue.prototype._ensureCode = function() { |
if (this._code == null) this._code = this.isType ? this.get$type().get$jsname() : this.home._makeThisCode(); |
} |
-BareValue.prototype._tryResolveMember = function(context, name, isDynamic, node) { |
+BareValue.prototype._tryResolveMember = function(context, name, node) { |
var member = this.get$type().getMember(name); |
- if (member == null || $ne(member.get$declaringType(), this.get$type())) { |
+ if ($eq(member) || $ne(member.get$declaringType(), this.get$type())) { |
var libMember = this.home.get$library().lookup(name, this.span); |
if (libMember != null) { |
return libMember.get$preciseMemberSet(); |
} |
} |
this._ensureCode(); |
- return Value.prototype._tryResolveMember.call(this, context, name, isDynamic, node); |
+ return Value.prototype._tryResolveMember.call(this, context, name, node); |
} |
// ********** Code for SuperValue ************** |
$inherits(SuperValue, Value); |
@@ -13934,9 +13415,6 @@ VariableValue.prototype.binop = function(kind, other, context, node) { |
} |
return Value.prototype.binop.call(this, kind, other, context, node); |
} |
-VariableValue.prototype.binop$4 = VariableValue.prototype.binop; |
-VariableValue.prototype.replaceValue$1 = VariableValue.prototype.replaceValue; |
-VariableValue.prototype.unop$3 = VariableValue.prototype.unop; |
// ********** Code for CompilerException ************** |
function CompilerException(_message, _location) { |
this._lang_message = _message; |
@@ -13973,7 +13451,6 @@ CounterLog.prototype.add = function(other) { |
this.invokeCalls = this.invokeCalls + other.invokeCalls; |
this.msetN = this.msetN + other.msetN; |
} |
-CounterLog.prototype.add$1 = CounterLog.prototype.add; |
// ********** Code for World ************** |
function World(files) { |
this.files = files; |
@@ -14024,12 +13501,12 @@ World.prototype._addMember = function(member) { |
return; |
} |
var mset = this._members.$index(member.name); |
- if (mset == null) { |
+ if ($eq(mset)) { |
mset = new MemberSet(member, true); |
this._members.$setindex(mset.get$name(), mset); |
} |
else { |
- mset.get$members().add$1(member); |
+ mset.get$members().add(member); |
} |
} |
World.prototype._addTopName = function(named) { |
@@ -14045,14 +13522,14 @@ World.prototype._addTopName = function(named) { |
} |
World.prototype._addJavascriptTopName = function(named, name) { |
var existing = this._topNames.$index(name); |
- if (existing == null) { |
+ if ($eq(existing)) { |
this._topNames.$setindex(name, named); |
return; |
} |
if (existing == named) { |
return; |
} |
- this.info(("mangling matching top level name \"" + named.get$jsname() + "\" in ") + ("both \"" + named.get$library().get$jsname() + "\" and \"" + existing.get$library().get$jsname() + "\"")); |
+ this.info($add(("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)) { |
@@ -14062,7 +13539,7 @@ World.prototype._addJavascriptTopName = function(named, name) { |
this._renameJavascriptTopName(existing); |
} |
else { |
- var msg = ("conflicting JS name \"" + name + "\" of same ") + ("priority " + existingPri + ": (already defined in) ") + ("" + existing.get$span().get$locationText() + " with priority " + namedPri + ")"); |
+ var msg = $add($add(("conflicting JS name \"" + name + "\" of same "), ("priority " + existingPri + ": (already defined in) ")), ("" + existing.get$span().get$locationText() + " with priority " + namedPri + ")")); |
if (named.get$isNative()) { |
$globals.world.info(msg, named.get$span(), existing.get$span()); |
} |
@@ -14074,8 +13551,8 @@ World.prototype._addJavascriptTopName = function(named, name) { |
World.prototype._renameJavascriptTopName = function(named) { |
named._jsname = ("" + named.get$library().get$jsname() + "_" + named.get$jsname()); |
var existing = this._topNames.$index(named.get$jsname()); |
- if (existing != null && $ne(existing, named)) { |
- $globals.world.internalError(("name mangling failed for \"" + named.get$jsname() + "\" ") + ("(\"" + named.get$jsname() + "\" defined also in " + existing.get$span().get$locationText() + ")"), named.get$span()); |
+ if ($ne(existing) && $ne(existing, named)) { |
+ $globals.world.internalError($add(("name mangling failed for \"" + named.get$jsname() + "\" "), ("(\"" + named.get$jsname() + "\" defined also in " + existing.get$span().get$locationText() + ")")), named.get$span()); |
} |
this._topNames.$setindex(named.get$jsname(), named); |
} |
@@ -14088,7 +13565,7 @@ World.prototype.toJsIdentifier = function(name) { |
this._jsKeywords = HashSetImplementation.HashSetImplementation$from$factory(["break", "case", "catch", "continue", "debugger", "default", "delete", "do", "else", "finally", "for", "function", "if", "in", "instanceof", "new", "return", "switch", "this", "throw", "try", "typeof", "var", "void", "while", "with", "class", "enum", "export", "extends", "import", "super", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield", "native"]); |
} |
if (this._jsKeywords.contains(name)) { |
- return name + "_"; |
+ return $add(name, "_"); |
} |
else { |
return name.replaceAll("$", "$$").replaceAll(":", "$"); |
@@ -14100,7 +13577,7 @@ World.prototype.compileAndSave = function() { |
if (success) { |
var code = $globals.world.getGeneratedCode(); |
if (!$globals.options.outfile.endsWith(".js")) { |
- code = "#!/usr/bin/env node\n" + code; |
+ code = $add("#!/usr/bin/env node\n", code); |
} |
$globals.world.files.writeString($globals.options.outfile, code); |
} |
@@ -14136,7 +13613,7 @@ World.prototype.runLeg = function() { |
this.fatal("requested leg enabled, but no leg compiler available"); |
} |
var res = this.withTiming("try leg compile", (function () { |
- return $globals.legCompile.call$1($this); |
+ return $globals.legCompile($this); |
}) |
); |
if (!res && $globals.options.legOnly) { |
@@ -14155,6 +13632,10 @@ World.prototype.runCompilationPhases = function() { |
if ($globals.experimentalAwaitPhase != null) { |
this.withTiming("await translation", to$call$0($globals.experimentalAwaitPhase)); |
} |
+ this.withTiming("analyze pass", (function () { |
+ $this.analyzeCode(lib); |
+ }) |
+ ); |
this.withTiming("generate code", (function () { |
$this.generateCode(lib); |
}) |
@@ -14171,7 +13652,7 @@ World.prototype.getGeneratedCode = function() { |
World.prototype.readFile = function(filename) { |
try { |
var sourceFile = this.reader.readFile(filename); |
- this.dartBytesRead = this.dartBytesRead + sourceFile.get$text().get$length(); |
+ this.dartBytesRead = this.dartBytesRead + sourceFile.get$text().length; |
return sourceFile; |
} catch (e) { |
e = _toDartException(e); |
@@ -14202,9 +13683,9 @@ World.prototype.process = function() { |
while (this._todo.get$length() > (0)) { |
var todo = this._todo; |
this._todo = []; |
- for (var $$i = todo.iterator$0(); $$i.hasNext$0(); ) { |
- var lib = $$i.next$0(); |
- lib.visitSources$0(); |
+ for (var $$i = todo.iterator(); $$i.hasNext(); ) { |
+ var lib = $$i.next(); |
+ lib.visitSources(); |
} |
} |
} |
@@ -14216,14 +13697,14 @@ World.prototype.processDartScript = function(script) { |
} |
World.prototype.resolveAll = function() { |
var $$list = this.libraries.getValues(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var lib = $$i.next$0(); |
- lib.resolve$0(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var lib = $$i.next(); |
+ lib.resolve(); |
} |
var $$list = this.libraries.getValues(); |
- for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { |
- var lib = $$i.next$0(); |
- lib.postResolveChecks$0(); |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var lib = $$i.next(); |
+ lib.postResolveChecks(); |
} |
} |
World.prototype.get$resolveAll = function() { |
@@ -14231,13 +13712,16 @@ World.prototype.get$resolveAll = function() { |
} |
World.prototype.findMainMethod = function(lib) { |
var main = lib.lookup("main", lib.get$span()); |
- if (main == null) { |
+ if ($eq(main)) { |
this.fatal("no main method specified"); |
} |
return main; |
} |
-World.prototype.generateCode = function(lib) { |
+World.prototype.analyzeCode = function(lib) { |
this.gen = new WorldGenerator(this.findMainMethod(lib), new CodeWriter()); |
+ this.gen.analyze(); |
+} |
+World.prototype.generateCode = function(lib) { |
this.gen.run(); |
this.frogCode = this.gen.writer.get$text(); |
this.jsBytesWritten = this.frogCode.length; |
@@ -14254,7 +13738,7 @@ World.prototype._message = function(color, prefix, message, span, span1, span2, |
} |
} |
else { |
- var messageWithPrefix = $globals.options.useColors ? (color + prefix + $globals._NO_COLOR + message) : (prefix + message); |
+ var messageWithPrefix = $globals.options.useColors ? ($add($add($add(color, prefix), $globals._NO_COLOR), message)) : ($add(prefix, message)); |
var text = messageWithPrefix; |
if (span != null) { |
text = span.toMessageString(messageWithPrefix); |
@@ -14268,7 +13752,7 @@ World.prototype._message = function(color, prefix, message, span, span1, span2, |
} |
} |
if (throwing) { |
- $throw(new CompilerException(prefix + message, span)); |
+ $throw(new CompilerException($add(prefix, message), span)); |
} |
} |
World.prototype.error = function(message, span, span1, span2) { |
@@ -14302,7 +13786,7 @@ World.prototype.withoutForceDynamic = function(fn) { |
var oldForceDynamic = $globals.options.forceDynamic; |
$globals.options.forceDynamic = false; |
try { |
- return fn.call$0(); |
+ return fn(); |
} finally { |
$globals.options.forceDynamic = oldForceDynamic; |
} |
@@ -14327,10 +13811,10 @@ World.prototype.printStatus = function() { |
} |
World.prototype.withTiming = function(name, f) { |
var sw = new StopwatchImplementation(); |
- sw.start$0(); |
- var result = f.call$0(); |
- sw.stop$0(); |
- this.info(("" + name + " in " + sw.elapsedInMs$0() + "msec")); |
+ sw.start(); |
+ var result = f(); |
+ sw.stop(); |
+ this.info(("" + name + " in " + sw.elapsedInMs() + "msec")); |
return result; |
} |
// ********** Code for FrogOptions ************** |
@@ -14461,15 +13945,15 @@ function FrogOptions(homedir, args, files) { |
default: |
- if (arg.endsWith$1(".dart")) { |
+ if (arg.endsWith(".dart")) { |
this.dartScript = arg; |
this.childArgs = args.getRange(i + (1), args.get$length() - i - (1)); |
break loop; |
} |
- else if (arg.startsWith$1("--out=")) { |
+ else if (arg.startsWith("--out=")) { |
this.outfile = arg.substring$1("--out=".length); |
} |
- else if (arg.startsWith$1("--libdir=")) { |
+ else if (arg.startsWith("--libdir=")) { |
this.libDir = arg.substring$1("--libdir=".length); |
passedLibDir = true; |
} |
@@ -14505,7 +13989,7 @@ function LibraryReader() { |
} |
LibraryReader.prototype.readFile = function(fullname) { |
var filename = this._specialLibs.$index(fullname); |
- if (filename == null) { |
+ if ($eq(filename)) { |
filename = fullname; |
} |
if ($globals.world.files.fileExists(filename)) { |
@@ -14524,14 +14008,15 @@ function VarMember(name) { |
VarMember.prototype.get$name = function() { return this.name; }; |
VarMember.prototype.get$isGenerated = function() { return this.isGenerated; }; |
VarMember.prototype.set$isGenerated = function(value) { return this.isGenerated = value; }; |
+VarMember.prototype.get$body = function() { |
+ return null; |
+} |
VarMember.prototype.get$returnType = function() { |
return $globals.world.varType; |
} |
VarMember.prototype.invoke = function(context, node, target, args) { |
return new Value(this.get$returnType(), ("" + target.get$code() + "." + this.name + "(" + args.getCode() + ")"), node.span); |
} |
-VarMember.prototype.generate$1 = VarMember.prototype.generate; |
-VarMember.prototype.invoke$4 = VarMember.prototype.invoke; |
// ********** Code for VarFunctionStub ************** |
$inherits(VarFunctionStub, VarMember); |
function VarFunctionStub(name, callArgs) { |
@@ -14573,8 +14058,6 @@ VarFunctionStub.prototype.generateNamed = function(w) { |
w.writeln(("return this." + this.name + "(" + argsCode + ");")); |
w.exitBlock("}"); |
} |
-VarFunctionStub.prototype.generate$1 = VarFunctionStub.prototype.generate; |
-VarFunctionStub.prototype.invoke$4 = VarFunctionStub.prototype.invoke; |
// ********** Code for VarMethodStub ************** |
$inherits(VarMethodStub, VarMember); |
function VarMethodStub(name, member, args, body) { |
@@ -14601,14 +14084,14 @@ VarMethodStub.prototype.generate = function(code) { |
else { |
var suffix = $globals.world.gen._writePrototypePatch(this.get$declaringType(), this.name, ("function(" + this.args.getCode() + ") {"), code, false); |
if (!suffix.endsWith(";")) { |
- suffix = suffix + ";"; |
+ suffix = $add(suffix, ";"); |
} |
if (this._needsExactTypeCheck()) { |
code.enterBlock(("if (Object.getPrototypeOf(this).hasOwnProperty(\"" + this.name + "\")) {")); |
code.writeln(("" + this.body + ";")); |
code.exitBlock("}"); |
var argsCode = this.args.getCode(); |
- if (argsCode != "") argsCode = ", " + argsCode; |
+ if (argsCode != "") argsCode = $add(", ", argsCode); |
code.writeln(("return Object.prototype." + this.name + ".call(this" + argsCode + ");")); |
code.exitBlock(suffix); |
} |
@@ -14622,7 +14105,7 @@ VarMethodStub.prototype._needsExactTypeCheck = function() { |
var $this = this; // closure support |
if (this.member == null || this.member.declaringType.get$isObject()) return false; |
var members = this.member.get$potentialMemberSet().members; |
- return members.filter$1((function (m) { |
+ return members.filter((function (m) { |
return $ne(m, $this.member) && m.get$declaringType().get$isHiddenNativeType(); |
}) |
).get$length() >= (1); |
@@ -14635,7 +14118,7 @@ VarMethodStub.prototype._useDirectCall = function(args) { |
} |
for (var i = args.get$length(); |
i < method.parameters.get$length(); i++) { |
- if ($ne(method.parameters[i].get$value().get$code(), "null")) { |
+ if (method.parameters[i].value.get$code() != "null") { |
return false; |
} |
} |
@@ -14645,7 +14128,6 @@ VarMethodStub.prototype._useDirectCall = function(args) { |
return false; |
} |
} |
-VarMethodStub.prototype.generate$1 = VarMethodStub.prototype.generate; |
// ********** Code for VarMethodSet ************** |
$inherits(VarMethodSet, VarMember); |
function VarMethodSet(baseName, name, members, callArgs, returnType) { |
@@ -14667,27 +14149,25 @@ VarMethodSet.prototype._invokeMembers = function(context, node) { |
this.invoked = true; |
var hasObjectType = false; |
var $$list = this.members; |
- for (var $$i = 0;$$i < $$list.get$length(); $$i++) { |
- var member = $$list[$$i]; |
+ for (var $$i = $$list.iterator(); $$i.hasNext(); ) { |
+ var member = $$i.next(); |
var type = member.get$declaringType(); |
var target = new Value(type, "this", node.span); |
- var result = member.invoke$4$isDynamic(context, node, target, this.args, true); |
- var stub = new VarMethodStub(this.name, member, this.args, "return " + result.get$code()); |
+ var result = member.invoke(context, node, target, this.args); |
+ var stub = new VarMethodStub(this.name, member, this.args, $add("return ", result.get$code())); |
type.get$varStubs().$setindex(stub.get$name(), stub); |
if (type.get$isObject()) hasObjectType = true; |
} |
if (!hasObjectType) { |
var target = new Value($globals.world.objectType, "this", node.span); |
- var result = target.invokeNoSuchMethod$4(context, this.baseName, node, this.args); |
- var stub = new VarMethodStub(this.name, null, this.args, "return " + result.get$code()); |
+ var result = target.invokeNoSuchMethod(context, this.baseName, node, this.args); |
+ var stub = new VarMethodStub(this.name, null, this.args, $add("return ", result.get$code())); |
$globals.world.objectType.varStubs.$setindex(stub.get$name(), stub); |
} |
} |
VarMethodSet.prototype.generate = function(code) { |
} |
-VarMethodSet.prototype.generate$1 = VarMethodSet.prototype.generate; |
-VarMethodSet.prototype.invoke$4 = VarMethodSet.prototype.invoke; |
// ********** Code for top level ************** |
function _otherOperator(jsname, op) { |
return ("function " + jsname + "(x, y) {\n return (typeof(x) == 'number' && typeof(y) == 'number')\n ? x " + op + " y : x." + jsname + "(y);\n}"); |
@@ -14699,38 +14179,38 @@ function map(source, mapper) { |
result.set$length(list.get$length()); |
for (var i = (0); |
i < list.get$length(); i++) { |
- result.$setindex(i, mapper.call$1(list[i])); |
+ result.$setindex(i, mapper(list.$index(i))); |
} |
} |
else { |
- for (var $$i = source.iterator$0(); $$i.hasNext$0(); ) { |
- var item = $$i.next$0(); |
- result.add(mapper.call$1(item)); |
+ for (var $$i = source.iterator(); $$i.hasNext(); ) { |
+ var item = $$i.next(); |
+ result.add(mapper(item)); |
} |
} |
return result; |
} |
function reduce(source, callback, initialValue) { |
- var i = source.iterator$0(); |
+ var i = source.iterator(); |
var current = initialValue; |
- if (current == null && i.hasNext$0()) { |
- current = i.next$0(); |
+ if ($eq(current) && i.hasNext()) { |
+ current = i.next(); |
} |
- while (i.hasNext$0()) { |
- current = callback.call$2(current, i.next$0()); |
+ while (i.hasNext()) { |
+ current = callback.call$2(current, i.next()); |
} |
return current; |
} |
function orderValuesByKeys(map) { |
var keys = map.getKeys(); |
keys.sort((function (x, y) { |
- return x.compareTo$1(y); |
+ return x.compareTo(y); |
}) |
); |
var values = []; |
- for (var $$i = 0;$$i < keys.get$length(); $$i++) { |
- var k = keys[$$i]; |
- values.add$1(map.$index(k)); |
+ for (var $$i = keys.iterator(); $$i.hasNext(); ) { |
+ var k = $$i.next(); |
+ values.add(map.$index(k)); |
} |
return values; |
} |
@@ -14754,12 +14234,12 @@ function _getCallStubName(name, args) { |
var nameBuilder = new StringBufferImpl(("" + name + "$" + args.get$bareCount())); |
for (var i = args.get$bareCount(); |
i < args.get$length(); i++) { |
- var name0 = args.getName(i); |
- nameBuilder.add$1("$"); |
- if (name0.contains$1("$")) { |
- nameBuilder.add$1(("" + name0.get$length())); |
+ var argName = args.getName(i); |
+ nameBuilder.add("$"); |
+ if (argName.contains$1("$")) { |
+ nameBuilder.add(("" + argName.get$length())); |
} |
- nameBuilder.add$1(name0); |
+ nameBuilder.add(argName); |
} |
return nameBuilder.toString$0(); |
} |
@@ -14770,11 +14250,11 @@ function main() { |
var argv = []; |
for (var i = (0); |
i < get$process().get$argv().get$length(); i++) { |
- argv.add$1(get$process().get$argv()[i]); |
+ argv.add(get$process().get$argv()[i]); |
if (i == (1)) { |
var terminal = get$process().get$env().$index("TERM"); |
- if (terminal == null || !terminal.startsWith$1("xterm")) { |
- argv.add$1("--no_colors"); |
+ if ($eq(terminal) || !terminal.startsWith("xterm")) { |
+ argv.add("--no_colors"); |
} |
} |
} |
@@ -14798,19 +14278,6 @@ function main() { |
get$process().exit((1)); |
} |
} |
-// ********** Generic Type Inheritance ************** |
-/** Implements extends for generic types. */ |
-function $inheritsMembers(child, parent) { |
- child = child.prototype; |
- parent = parent.prototype; |
- Object.getOwnPropertyNames(parent).forEach(function(name) { |
- if (typeof(child[name]) == 'undefined') child[name] = parent[name]; |
- }); |
-} |
-$inheritsMembers(_DoubleLinkedQueueEntrySentinel_E, DoubleLinkedQueueEntry_E); |
-$inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQueueEntry_KeyValuePair_K$V); |
-$inheritsMembers(_SharedBackingMap_K$V, HashMapImplementation_K$V); |
-$inheritsMembers(_SharedBackingMap_dart_core_String$VariableValue, HashMapImplementation_dart_core_String$VariableValue); |
// 1 dynamic types. |
// 1 types |
// 0 !leaf |
@@ -14821,11 +14288,11 @@ function $static_init(){ |
$globals._NO_COLOR = "\x1b[0m"; |
$globals._RED_COLOR = "\x1b[31m"; |
} |
-var const$0000 = Object.create(EmptyQueueException.prototype, {}); |
-var const$0001 = Object.create(_DeletedKeySentinel.prototype, {}); |
-var const$0005 = Object.create(NoMoreElementsException.prototype, {}); |
-var const$0007 = Object.create(IllegalAccessException.prototype, {}); |
-var const$0008 = ImmutableList.ImmutableList$from$factory([]); |
+var const$0000 = Object.create(_DeletedKeySentinel.prototype, {}); |
+var const$0001 = Object.create(NoMoreElementsException.prototype, {}); |
+var const$0002 = Object.create(EmptyQueueException.prototype, {}); |
+var const$0006 = Object.create(IllegalAccessException.prototype, {}); |
+var const$0007 = ImmutableList.ImmutableList$from$factory([]); |
var $globals = {}; |
$static_init(); |
main(); |