| Index: frog/minfrog
|
| diff --git a/frog/minfrog b/frog/minfrog
|
| index 1476b54b127eb6e4fe2eb36eb1b3c5129c91b497..420727aecdcafd5091e14b97daab2e42f6cef08a 100755
|
| --- a/frog/minfrog
|
| +++ b/frog/minfrog
|
| @@ -265,9 +265,6 @@ Object.prototype.providePropertySyntax$0 = function() {
|
| Object.prototype.removeLast$0 = function() {
|
| return this.noSuchMethod("removeLast", []);
|
| };
|
| -Object.prototype.replaceAll$2 = function($0, $1) {
|
| - return this.noSuchMethod("replaceAll", [$0, $1]);
|
| -};
|
| Object.prototype.replaceFirst$2 = function($0, $1) {
|
| return this.noSuchMethod("replaceFirst", [$0, $1]);
|
| };
|
| @@ -301,6 +298,9 @@ Object.prototype.substring$1 = function($0) {
|
| Object.prototype.substring$2 = function($0, $1) {
|
| return this.noSuchMethod("substring", [$0, $1]);
|
| };
|
| +Object.prototype.toRadixString$1 = function($0) {
|
| + return this.noSuchMethod("toRadixString", [$0]);
|
| +};
|
| Object.prototype.toString$0 = function() {
|
| return this.toString();
|
| };
|
| @@ -462,6 +462,9 @@ Math.min = function(a, b) {
|
| }
|
| // ********** Code for Strings **************
|
| function Strings() {}
|
| +Strings.String$fromCharCodes$factory = function(charCodes) {
|
| + return StringBase.createFromCharCodes(charCodes);
|
| +}
|
| Strings.join = function(strings, separator) {
|
| return StringBase.join(strings, separator);
|
| }
|
| @@ -605,9 +608,11 @@ ListFactory.prototype.sort$1 = function($0) {
|
| return this.sort(to$call$2($0));
|
| };
|
| ListFactory_E = ListFactory;
|
| +ListFactory_Expression = ListFactory;
|
| ListFactory_K = ListFactory;
|
| ListFactory_dart_core_String = ListFactory;
|
| ListFactory_V = ListFactory;
|
| +ListFactory_int = ListFactory;
|
| // ********** Code for ListIterator **************
|
| function ListIterator(array) {
|
| this._array = array;
|
| @@ -719,6 +724,9 @@ NumImplementation.prototype.toInt = function() {
|
| NumImplementation.prototype.toDouble = function() {
|
| 'use strict'; return this + 0;
|
| }
|
| +NumImplementation.prototype.toRadixString = function(radix) {
|
| + 'use strict'; return this.toString(radix)
|
| +}
|
| NumImplementation.prototype.compareTo = function(other) {
|
| var thisValue = this.toDouble();
|
| if (thisValue < other) {
|
| @@ -749,6 +757,7 @@ NumImplementation.prototype.compareTo = function(other) {
|
| }
|
| 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() {
|
| // Initializers done
|
| @@ -1647,8 +1656,14 @@ StringBufferImpl.prototype.isEmpty$0 = StringBufferImpl.prototype.isEmpty;
|
| StringBufferImpl.prototype.toString$0 = StringBufferImpl.prototype.toString;
|
| // ********** Code for StringBase **************
|
| function StringBase() {}
|
| +StringBase.createFromCharCodes = function(charCodes) {
|
| + if (Object.getPrototypeOf(charCodes) !== Array.prototype) {
|
| + charCodes = new ListFactory.ListFactory$from$factory(charCodes);
|
| + }
|
| + return String.fromCharCode.apply(null, charCodes);
|
| +}
|
| StringBase.join = function(strings, separator) {
|
| - if (strings.get$length() == 0) return '';
|
| + if (strings.get$length() == 0) return "";
|
| var s = strings.$index(0);
|
| for (var i = 1;
|
| i < strings.get$length(); i++) {
|
| @@ -1735,7 +1750,6 @@ StringImplementation.prototype.endsWith$1 = StringImplementation.prototype.endsW
|
| StringImplementation.prototype.hashCode$0 = StringImplementation.prototype.hashCode;
|
| StringImplementation.prototype.indexOf$1 = StringImplementation.prototype.indexOf;
|
| StringImplementation.prototype.isEmpty$0 = StringImplementation.prototype.isEmpty;
|
| -StringImplementation.prototype.replaceAll$2 = StringImplementation.prototype.replaceAll;
|
| StringImplementation.prototype.replaceFirst$2 = StringImplementation.prototype.replaceFirst;
|
| StringImplementation.prototype.startsWith$1 = StringImplementation.prototype.startsWith;
|
| StringImplementation.prototype.substring$1 = StringImplementation.prototype.substring;
|
| @@ -1851,37 +1865,37 @@ _FunctionImplementation.prototype._genStub = function(argsLength, names) {
|
| // ********** Library node **************
|
| // ********** Code for Process **************
|
| function Process(_process) {
|
| - this.SIGHUP = 'SIGHUP'
|
| - this.SIGINT = 'SIGINT'
|
| - this.SIGQUIT = 'SIGQUIT'
|
| - this.SIGILL = 'SIGILL'
|
| - this.SIGTRAP = 'SIGTRAP'
|
| - this.SIGABRT = 'SIGABRT'
|
| - this.SIGEMT = 'SIGEMT'
|
| - this.SIGFPE = 'SIGFPE'
|
| - this.SIGKILL = 'SIGKILL'
|
| - this.SIGBUS = 'SIGBUS'
|
| - this.SIGSEGV = 'SIGSEGV'
|
| - this.SIGSYS = 'SIGSYS'
|
| - this.SIGPIPE = 'SIGPIPE'
|
| - this.SIGALRM = 'SIGALRM'
|
| - this.SIGTERM = 'SIGTERM'
|
| - this.SIGURG = 'SIGURG'
|
| - this.SIGSTOP = 'SIGSTOP'
|
| - this.SIGTSTP = 'SIGTSTP'
|
| - this.SIGCONT = 'SIGCONT'
|
| - this.SIGCHLD = 'SIGCHLD'
|
| - this.SIGTTIN = 'SIGTTIN'
|
| - this.SIGTTOU = 'SIGTTOU'
|
| - this.SIGIO = 'SIGIO'
|
| - this.SIGXCPU = 'SIGXCPU'
|
| - this.SIGXFSZ = 'SIGXFSZ'
|
| - this.SIGVTALRM = 'SIGVTALRM'
|
| - this.SIGPROF = 'SIGPROF'
|
| - this.SIGWINCH = 'SIGWINCH'
|
| - this.SIGINFO = 'SIGINFO'
|
| - this.SIGUSR1 = 'SIGUSR1'
|
| - this.SIGUSR2 = 'SIGUSR2'
|
| + this.SIGHUP = "SIGHUP"
|
| + this.SIGINT = "SIGINT"
|
| + this.SIGQUIT = "SIGQUIT"
|
| + this.SIGILL = "SIGILL"
|
| + this.SIGTRAP = "SIGTRAP"
|
| + this.SIGABRT = "SIGABRT"
|
| + this.SIGEMT = "SIGEMT"
|
| + this.SIGFPE = "SIGFPE"
|
| + this.SIGKILL = "SIGKILL"
|
| + this.SIGBUS = "SIGBUS"
|
| + this.SIGSEGV = "SIGSEGV"
|
| + this.SIGSYS = "SIGSYS"
|
| + this.SIGPIPE = "SIGPIPE"
|
| + this.SIGALRM = "SIGALRM"
|
| + this.SIGTERM = "SIGTERM"
|
| + this.SIGURG = "SIGURG"
|
| + this.SIGSTOP = "SIGSTOP"
|
| + this.SIGTSTP = "SIGTSTP"
|
| + this.SIGCONT = "SIGCONT"
|
| + this.SIGCHLD = "SIGCHLD"
|
| + this.SIGTTIN = "SIGTTIN"
|
| + this.SIGTTOU = "SIGTTOU"
|
| + this.SIGIO = "SIGIO"
|
| + this.SIGXCPU = "SIGXCPU"
|
| + this.SIGXFSZ = "SIGXFSZ"
|
| + this.SIGVTALRM = "SIGVTALRM"
|
| + this.SIGPROF = "SIGPROF"
|
| + this.SIGWINCH = "SIGWINCH"
|
| + this.SIGINFO = "SIGINFO"
|
| + this.SIGUSR1 = "SIGUSR1"
|
| + this.SIGUSR2 = "SIGUSR2"
|
| this._process = _process;
|
| // Initializers done
|
| }
|
| @@ -1975,7 +1989,7 @@ $dynamic("get$end").WriteStream = function() {
|
| return this.end.bind(this);
|
| }
|
| $dynamic("end$0").WriteStream = function() {
|
| - return this.end(null, 'utf8');
|
| + return this.end(null, "utf8");
|
| };
|
| // ********** Code for vm **************
|
| vm = require('vm');
|
| @@ -1998,33 +2012,33 @@ function get$process() {
|
| // ********** Library file_system **************
|
| // ********** Code for top level **************
|
| function joinPaths(path1, path2) {
|
| - var pieces = path1.split('/');
|
| - var $$list = path2.split('/');
|
| + var pieces = path1.split("/");
|
| + var $$list = path2.split("/");
|
| for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
|
| var piece = $$list.$index($$i);
|
| - if ($eq(piece, '..') && pieces.get$length() > 0 && $ne(pieces.last$0(), '.') && $ne(pieces.last$0(), '..')) {
|
| + if ($eq(piece, "..") && pieces.get$length() > 0 && $ne(pieces.last$0(), ".") && $ne(pieces.last$0(), "..")) {
|
| pieces.removeLast$0();
|
| }
|
| - else if ($ne(piece, '')) {
|
| - if (pieces.get$length() > 0 && $eq(pieces.last$0(), '.')) {
|
| + else if ($ne(piece, "")) {
|
| + if (pieces.get$length() > 0 && $eq(pieces.last$0(), ".")) {
|
| pieces.removeLast$0();
|
| }
|
| pieces.add$1(piece);
|
| }
|
| }
|
| - return Strings.join(pieces, '/');
|
| + return Strings.join(pieces, "/");
|
| }
|
| function dirname(path) {
|
| - var lastSlash = path.lastIndexOf('/', path.length);
|
| + var lastSlash = path.lastIndexOf("/", path.length);
|
| if (lastSlash == -1) {
|
| - return '.';
|
| + return ".";
|
| }
|
| else {
|
| return path.substring(0, lastSlash);
|
| }
|
| }
|
| function basename(path) {
|
| - var lastSlash = path.lastIndexOf('/', path.length);
|
| + var lastSlash = path.lastIndexOf("/", path.length);
|
| if (lastSlash == -1) {
|
| return path;
|
| }
|
| @@ -2041,7 +2055,7 @@ NodeFileSystem.prototype.writeString = function(outfile, text) {
|
| fs.writeFileSync(outfile, text);
|
| }
|
| NodeFileSystem.prototype.readAll = function(filename) {
|
| - return fs.readFileSync(filename, 'utf8');
|
| + return fs.readFileSync(filename, "utf8");
|
| }
|
| NodeFileSystem.prototype.fileExists = function(filename) {
|
| return path.existsSync(filename);
|
| @@ -2063,7 +2077,7 @@ CodeWriter.prototype._indent = function() {
|
| this._pendingIndent = false;
|
| for (var i = 0;
|
| i < this._indentation; i++) {
|
| - this._buf.add(' '/*CodeWriter.INDENTATION*/);
|
| + this._buf.add(" "/*CodeWriter.INDENTATION*/);
|
| }
|
| }
|
| CodeWriter.prototype.comment = function(text) {
|
| @@ -2074,8 +2088,8 @@ CodeWriter.prototype.comment = function(text) {
|
| CodeWriter.prototype.write = function(text) {
|
| if (text.length == 0) return;
|
| if (this._pendingIndent) this._indent();
|
| - if (text.indexOf('\n') != -1) {
|
| - var lines = text.split('\n');
|
| + if (text.indexOf("\n") != -1) {
|
| + var lines = text.split("\n");
|
| for (var i = 0;
|
| i < lines.get$length() - 1; i++) {
|
| this.writeln(lines.$index(i));
|
| @@ -2090,7 +2104,7 @@ CodeWriter.prototype.writeln = function(text) {
|
| if (text != null) {
|
| this.write(text);
|
| }
|
| - if (!text.endsWith('\n')) this._buf.add('\n'/*CodeWriter.NEWLINE*/);
|
| + if (!text.endsWith("\n")) this._buf.add("\n"/*CodeWriter.NEWLINE*/);
|
| this._pendingIndent = true;
|
| }
|
| CodeWriter.prototype.enterBlock = function(text) {
|
| @@ -2127,38 +2141,38 @@ CoreJs.prototype.useOperator = function(name) {
|
| if (this._usedOperators.$index(name) != null) return;
|
| var code;
|
| switch (name) {
|
| - case ':ne':
|
| + case ":ne":
|
|
|
| code = "function $ne(x, y) {\n if (x == null) return y != null;\n return (typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'boolean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(y) == 'string')\n ? x != y : !x.$eq(y);\n}"/*null._NE_FUNCTION*/;
|
| break;
|
|
|
| - case ':eq':
|
| + case ":eq":
|
|
|
| code = "function $eq(x, y) {\n if (x == null) return y == null;\n return (typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'boolean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(y) == 'string')\n ? x == y : x.$eq(y);\n}\n// TODO(jimhug): Should this or should it not match equals?\nObject.prototype.$eq = function(other) { return this === other; }"/*null._EQ_FUNCTION*/;
|
| break;
|
|
|
| - case ':bit_not':
|
| + case ":bit_not":
|
|
|
| code = "function $bit_not(x) {\n return (typeof(x) == 'number') ? ~x : x.$bit_not();\n}"/*null._BIT_NOT_FUNCTION*/;
|
| break;
|
|
|
| - case ':negate':
|
| + case ":negate":
|
|
|
| code = "function $negate(x) {\n return (typeof(x) == 'number') ? -x : x.$negate();\n}"/*null._NEGATE_FUNCTION*/;
|
| break;
|
|
|
| - case ':add':
|
| + case ":add":
|
|
|
| code = "function $add(x, y) {\n return ((typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'string'))\n ? x + y : x.$add(y);\n}"/*null._ADD_FUNCTION*/;
|
| break;
|
|
|
| - case ':truncdiv':
|
| + case ":truncdiv":
|
|
|
| this.useThrow = true;
|
| code = "function $truncdiv(x, y) {\n if (typeof(x) == 'number' && typeof(y) == 'number') {\n if (y == 0) $throw(new IntegerDivisionByZeroException());\n var tmp = x / y;\n return (tmp < 0) ? Math.ceil(tmp) : Math.floor(tmp);\n } else {\n return x.$truncdiv(y);\n }\n}"/*null._TRUNCDIV_FUNCTION*/;
|
| break;
|
|
|
| - case ':mod':
|
| + case ":mod":
|
|
|
| code = "function $mod(x, y) {\n if (typeof(x) == 'number' && typeof(y) == 'number') {\n var result = x % y;\n if (result == 0) {\n return 0; // Make sure we don't return -0.0.\n } else if (result < 0) {\n if (y < 0) {\n return result - y;\n } else {\n return result + y;\n }\n }\n return result;\n } else {\n return x.$mod(y);\n }\n}"/*null._MOD_FUNCTION*/;
|
| break;
|
| @@ -2229,8 +2243,7 @@ CoreJs.prototype.generate = function(w) {
|
| }
|
| if ($globals.world.dom != null) {
|
| this.ensureTypeNameOf();
|
| - w.writeln('Object.prototype.get\$typeName = Object.prototype.\$typeNameOf;'/*'Object.prototype.get\$typeName = ' +
|
| - ' Object.prototype.\$typeNameOf;'*/);
|
| + w.writeln("Object.prototype.get$typeName = Object.prototype.$typeNameOf;");
|
| }
|
| }
|
| CoreJs.prototype.generate$1 = CoreJs.prototype.generate;
|
| @@ -2311,11 +2324,11 @@ Element.prototype.resolveType = function(node, typeErrors) {
|
| var typeRef = node;
|
| var baseType = this.resolveType(typeRef.baseType, typeErrors);
|
| if (!baseType.get$isGeneric()) {
|
| - $globals.world.error(('' + baseType.get$name() + ' is not generic'), typeRef.span);
|
| + $globals.world.error(("" + baseType.get$name() + " is not generic"), typeRef.span);
|
| return null;
|
| }
|
| if (typeRef.typeArguments.get$length() != baseType.get$typeParameters().get$length()) {
|
| - $globals.world.error('wrong number of type arguments', typeRef.span);
|
| + $globals.world.error("wrong number of type arguments", typeRef.span);
|
| return null;
|
| }
|
| var typeArgs = [];
|
| @@ -2327,14 +2340,14 @@ Element.prototype.resolveType = function(node, typeErrors) {
|
| }
|
| else if ((node instanceof FunctionTypeReference)) {
|
| var typeRef = node;
|
| - var name = '';
|
| + var name = "";
|
| if (typeRef.func.name != null) {
|
| name = typeRef.func.name.name;
|
| }
|
| typeRef.type = this.get$library().getOrAddFunctionType(this, name, typeRef.func);
|
| }
|
| else {
|
| - $globals.world.internalError('unknown type reference', node.span);
|
| + $globals.world.internalError("unknown type reference", node.span);
|
| }
|
| return node.type;
|
| }
|
| @@ -2357,13 +2370,15 @@ WorldGenerator.prototype.run = function() {
|
| if ($globals.options.compileAll) {
|
| this.markLibrariesUsed([$globals.world.coreimpl, $globals.world.corelib, this.main.declaringType.get$library()]);
|
| }
|
| - if ($globals.world.corelib.types.$index('Isolate').get$isUsed() || $globals.world.coreimpl.types.$index('ReceivePortImpl').get$isUsed()) {
|
| + $globals.world.numImplType.markUsed();
|
| + $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$1("eval"));
|
| + this.genMethod($globals.world.coreimpl.types.$index("EventLoop").getMember$1("run"));
|
| }
|
| this.corejs.useIsolates = true;
|
| - var isolateMain = $globals.world.coreimpl.topType.resolveMember('startRootIsolate').members.$index(0);
|
| + var isolateMain = $globals.world.coreimpl.topType.resolveMember("startRootIsolate").members.$index(0);
|
| var isolateMainTarget = new Value.type$ctor($globals.world.coreimpl.topType, this.main.get$span());
|
| mainCall = isolateMain.invoke(metaGen, null, isolateMainTarget, new Arguments(null, [this.main._get(metaGen, this.main.definition, null, false)]), false);
|
| }
|
| @@ -2373,7 +2388,7 @@ WorldGenerator.prototype.run = function() {
|
| if (this._mixins != null) this.writer.write(this._mixins.get$text());
|
| this.writeDynamicDispatchMetadata();
|
| this.writeGlobals();
|
| - this.writer.writeln(('' + mainCall.get$code() + ';'));
|
| + this.writer.writeln(("" + mainCall.get$code() + ";"));
|
| }
|
| WorldGenerator.prototype.markLibrariesUsed = function(libs) {
|
| return this.getAllTypes(libs).forEach(this.get$markTypeUsed());
|
| @@ -2435,7 +2450,7 @@ WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe
|
| return this.globals.$index(fullname);
|
| }
|
| WorldGenerator.prototype.globalForConst = function(exp, dependencies) {
|
| - var key = exp.get$type().get$jsname() + ':' + exp.canonicalCode;
|
| + var key = exp.get$type().get$jsname() + ":" + exp.canonicalCode;
|
| if (!this.globals.containsKey(key)) {
|
| this.globals.$setindex(key, GlobalValue.GlobalValue$fromConst$factory(this.globals.get$length(), exp, dependencies));
|
| }
|
| @@ -2453,16 +2468,16 @@ WorldGenerator.prototype.writeTypes = function(lib) {
|
| i < lib.sources.get$length(); i++) {
|
| lib.sources.$index(i).set$orderInLibrary(i);
|
| }
|
| - this.writer.comment(('// ********** Library ' + lib.name + ' **************'));
|
| + this.writer.comment(("// ********** Library " + lib.name + " **************"));
|
| if (lib.get$isCore()) {
|
| - this.writer.comment('// ********** Natives dart:core **************');
|
| + this.writer.comment("// ********** Natives dart:core **************");
|
| this.corejs.generate(this.writer);
|
| }
|
| var $$list = lib.natives;
|
| for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
|
| var file = $$list.$index($$i);
|
| var filename = basename(file.get$filename());
|
| - this.writer.comment(('// ********** Natives ' + filename + ' **************'));
|
| + this.writer.comment(("// ********** Natives " + filename + " **************"));
|
| this.writer.writeln(file.get$text());
|
| }
|
| lib.topType.markUsed();
|
| @@ -2480,7 +2495,7 @@ WorldGenerator.prototype.writeTypes = function(lib) {
|
| }
|
| }
|
| else if (type.get$isFunction() && type.get$varStubs().get$length() > 0) {
|
| - this.writer.comment(('// ********** Code for ' + type.get$jsname() + ' **************'));
|
| + this.writer.comment(("// ********** Code for " + type.get$jsname() + " **************"));
|
| this._writeDynamicStubs(type);
|
| }
|
| if (type.get$typeCheckCode() != null) {
|
| @@ -2495,32 +2510,32 @@ WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) {
|
| }
|
| WorldGenerator.prototype._prototypeOf = function(type, name) {
|
| if (type.get$isSingletonNative()) {
|
| - return ('' + type.get$jsname() + '.' + name);
|
| + return ("" + type.get$jsname() + "." + 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().get$name());
|
| }
|
| else {
|
| - return ('' + type.get$jsname() + '.prototype.' + name);
|
| + return ("" + type.get$jsname() + ".prototype." + name);
|
| }
|
| }
|
| WorldGenerator.prototype._maybeIsTest = function(onType, checkType) {
|
| var isSubtype = onType.isSubtypeOf(checkType);
|
| if (checkType.isTested) {
|
| - this.writer.writeln(this._prototypeOf(onType, ('is\$' + checkType.get$jsname())) + (' = function(){return ' + isSubtype + '};'));
|
| + this.writer.writeln(this._prototypeOf(onType, ("is$" + checkType.get$jsname())) + (" = function(){return " + isSubtype + "};"));
|
| }
|
| if (checkType.isChecked) {
|
| - var body = 'return this';
|
| - var checkName = ('assert\$' + checkType.get$jsname());
|
| + var body = "return this";
|
| + var checkName = ("assert$" + checkType.get$jsname());
|
| if (!isSubtype) {
|
| body = $globals.world.objectType.varStubs.$index(checkName).get$body();
|
| }
|
| else if ($eq(onType, $globals.world.stringImplType) || $eq(onType, $globals.world.numImplType)) {
|
| - body = ('return ' + onType.get$nativeType().name + '(this)');
|
| + body = ("return " + onType.get$nativeType().name + "(this)");
|
| }
|
| - this.writer.writeln(this._prototypeOf(onType, checkName) + (' = function(){' + body + '};'));
|
| + this.writer.writeln(this._prototypeOf(onType, checkName) + (" = function(){" + body + "};"));
|
| }
|
| }
|
| WorldGenerator.prototype.writeType = function(type) {
|
| @@ -2529,25 +2544,25 @@ 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() + ';'));
|
| + 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 + ' **************'));
|
| + 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 ($eq(nativeName, '')) {
|
| - this.writer.writeln(('function ' + type.get$jsname() + '() {}'));
|
| + if ($eq(nativeName, "")) {
|
| + this.writer.writeln(("function " + type.get$jsname() + "() {}"));
|
| }
|
| else if (type.get$jsname() != nativeName) {
|
| if (type.get$isHiddenNativeType()) {
|
| if (this._typeNeedsHolderForStaticMethods(type)) {
|
| - this.writer.writeln(('var ' + type.get$jsname() + ' = {};'));
|
| + this.writer.writeln(("var " + type.get$jsname() + " = {};"));
|
| }
|
| }
|
| else {
|
| - this.writer.writeln(('' + type.get$jsname() + ' = ' + nativeName + ';'));
|
| + this.writer.writeln(("" + type.get$jsname() + " = " + nativeName + ";"));
|
| }
|
| }
|
| }
|
| @@ -2555,17 +2570,17 @@ WorldGenerator.prototype.writeType = function(type) {
|
| if ((type instanceof ConcreteType)) {
|
| var c = type;
|
| this.corejs.ensureInheritsHelper();
|
| - this.writer.writeln(('\$inherits(' + c.get$jsname() + ', ' + c.genericType.get$jsname() + ');'));
|
| + 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._mixins.writeln(("$inheritsMembers(" + c.get$jsname() + ", " + p.get$jsname() + ");"));
|
| }
|
| }
|
| else if (!type.get$isNative()) {
|
| if (type.get$parent() != null && !type.get$parent().get$isObject()) {
|
| this.corejs.ensureInheritsHelper();
|
| - this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get$parent().get$jsname() + ');'));
|
| + this.writer.writeln(("$inherits(" + type.get$jsname() + ", " + type.get$parent().get$jsname() + ");"));
|
| }
|
| }
|
| }
|
| @@ -2573,14 +2588,14 @@ WorldGenerator.prototype.writeType = function(type) {
|
| }
|
| else if (type.get$constructors().get$length() == 0) {
|
| if (!type.get$isNative()) {
|
| - this.writer.writeln(('function ' + type.get$jsname() + '() {}'));
|
| + this.writer.writeln(("function " + type.get$jsname() + "() {}"));
|
| }
|
| }
|
| else {
|
| - var standardConstructor = type.get$constructors().$index('');
|
| + var standardConstructor = type.get$constructors().$index("");
|
| if (standardConstructor == null || standardConstructor.generator == null) {
|
| if (!type.get$isNative()) {
|
| - this.writer.writeln(('function ' + type.get$jsname() + '() {}'));
|
| + this.writer.writeln(("function " + type.get$jsname() + "() {}"));
|
| }
|
| }
|
| else {
|
| @@ -2662,7 +2677,7 @@ WorldGenerator.prototype._typeNeedsHolderForStaticMethods = function(type) {
|
| WorldGenerator.prototype._ensureInheritMembersHelper = function() {
|
| if (this._mixins != null) return;
|
| this._mixins = new CodeWriter();
|
| - this._mixins.comment('// ********** Generic Type Inheritance **************');
|
| + 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}");
|
| }
|
| WorldGenerator.prototype._writeDynamicStubs = function(type) {
|
| @@ -2678,21 +2693,21 @@ WorldGenerator.prototype._writeStaticField = function(field) {
|
| if (this.globals.containsKey(fullname)) {
|
| var value = this.globals.$index(fullname);
|
| if (field.declaringType.get$isTop() && !field.isNative) {
|
| - this.writer.writeln(('\$globals.' + field.get$jsname() + ' = ' + value.get$exp().get$code() + ';'));
|
| + 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(("$globals." + field.declaringType.get$jsname() + "_" + field.get$jsname()) + (" = " + value.get$exp().get$code() + ";"));
|
| }
|
| }
|
| }
|
| WorldGenerator.prototype._writeField = function(field) {
|
| if (field.declaringType.get$isTop() && !field.isNative && field.value == null) {
|
| - this.writer.writeln(('var ' + field.get$jsname() + ';'));
|
| + this.writer.writeln(("var " + field.get$jsname() + ";"));
|
| }
|
| if (field._providePropertySyntax) {
|
| - this.writer.writeln(this._prototypeOf(field.declaringType, ('get\$' + field.get$jsname())) + (' = function() { return this.' + field.get$jsname() + '; };'));
|
| + this.writer.writeln(this._prototypeOf(field.declaringType, ("get$" + field.get$jsname())) + (" = function() { return this." + field.get$jsname() + "; };"));
|
| if (!field.isFinal) {
|
| - this.writer.writeln(this._prototypeOf(field.declaringType, ('set\$' + field.get$jsname())) + (' = function(value) { return this.' + field.get$jsname() + ' = value; };'));
|
| + this.writer.writeln(this._prototypeOf(field.declaringType, ("set$" + field.get$jsname())) + (" = function(value) { return this." + field.get$jsname() + " = value; };"));
|
| }
|
| }
|
| }
|
| @@ -2700,15 +2715,15 @@ 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() + '", {'));
|
| + this.writer.enterBlock("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 ? '' : ',');
|
| + this.writer.write(("get: " + property.declaringType.get$jsname() + ".prototype." + property.getter.get$jsname()));
|
| + this.writer.writeln(property.setter == null ? "" : ",");
|
| }
|
| if (property.setter != null) {
|
| - this.writer.writeln(('set: ' + property.declaringType.get$jsname() + '.prototype.' + property.setter.get$jsname()));
|
| + this.writer.writeln(("set: " + property.declaringType.get$jsname() + ".prototype." + property.setter.get$jsname()));
|
| }
|
| - this.writer.exitBlock('});');
|
| + this.writer.exitBlock("});");
|
| }
|
| }
|
| WorldGenerator.prototype._writeMethod = function(m) {
|
| @@ -2724,33 +2739,33 @@ WorldGenerator.prototype.get$_writeMethod = function() {
|
| }
|
| WorldGenerator.prototype.writeGlobals = function() {
|
| if (this.globals.get$length() > 0) {
|
| - this.writer.comment('// ********** Globals **************');
|
| + this.writer.comment("// ********** Globals **************");
|
| var list = this.globals.getValues();
|
| list.sort$1((function (a, b) {
|
| return a.compareTo$1(b);
|
| })
|
| );
|
| - this.writer.enterBlock('function \$static_init(){');
|
| + this.writer.enterBlock("function $static_init(){");
|
| for (var $$i = list.iterator$0(); $$i.hasNext$0(); ) {
|
| var global = $$i.next$0();
|
| if (global.get$field() != null) {
|
| this._writeStaticField(global.get$field());
|
| }
|
| }
|
| - this.writer.exitBlock('}');
|
| + this.writer.exitBlock("}");
|
| for (var $$i = list.iterator$0(); $$i.hasNext$0(); ) {
|
| var global = $$i.next$0();
|
| if (global.get$field() == null) {
|
| - this.writer.writeln(('var ' + global.get$name() + ' = ' + global.get$exp().get$code() + ';'));
|
| + this.writer.writeln(("var " + global.get$name() + " = " + global.get$exp().get$code() + ";"));
|
| }
|
| }
|
| }
|
| if (!this.corejs.useIsolates) {
|
| if (this.hasStatics) {
|
| - this.writer.writeln('var \$globals = {};');
|
| + this.writer.writeln("var $globals = {};");
|
| }
|
| if (this.globals.get$length() > 0) {
|
| - this.writer.writeln('\$static_init();');
|
| + this.writer.writeln("$static_init();");
|
| }
|
| }
|
| }
|
| @@ -2761,7 +2776,7 @@ WorldGenerator.prototype._usedDynamicDispatchOnType = function(type) {
|
| WorldGenerator.prototype.writeDynamicDispatchMetadata = function() {
|
| var $this = this; // closure support
|
| if (this.typesWithDynamicDispatch == null) return;
|
| - this.writer.comment(('// ' + this.typesWithDynamicDispatch.get$length() + ' dynamic types.'));
|
| + this.writer.comment(("// " + this.typesWithDynamicDispatch.get$length() + " dynamic types."));
|
| var seen = new HashSetImplementation();
|
| var types = [];
|
| function visit(type) {
|
| @@ -2783,11 +2798,11 @@ WorldGenerator.prototype.writeDynamicDispatchMetadata = function() {
|
| return !type.get$directSubtypes().isEmpty$0() && $this.typesWithDynamicDispatch.contains(type);
|
| })
|
| );
|
| - this.writer.comment(('// ' + types.get$length() + ' types'));
|
| - this.writer.comment(('// ' + types.filter$1((function (t) {
|
| + this.writer.comment(("// " + types.get$length() + " types"));
|
| + this.writer.comment(("// " + types.filter$1((function (t) {
|
| return !t.get$directSubtypes().isEmpty$0();
|
| })
|
| - ).get$length() + ' !leaf'));
|
| + ).get$length() + " !leaf"));
|
| var varNames = [];
|
| var varDefns = new HashMapImplementation();
|
| var tagDefns = new HashMapImplementation();
|
| @@ -2809,7 +2824,7 @@ WorldGenerator.prototype.writeDynamicDispatchMetadata = function() {
|
| expressions.add$1(existing);
|
| }
|
| else {
|
| - var varName = ('v' + varNames.get$length() + '/*' + tag + '*/');
|
| + var varName = ("v" + varNames.get$length() + "/*" + tag + "*/");
|
| varNames.add$1(varName);
|
| varDefns.$setindex(varName, existing);
|
| tagDefns.$setindex(tag, varName);
|
| @@ -2819,14 +2834,14 @@ WorldGenerator.prototype.writeDynamicDispatchMetadata = function() {
|
| }
|
| }
|
| walk(type);
|
| - var constantPart = ("'" + Strings.join(subtags, '|') + "'");
|
| + var constantPart = ("'" + Strings.join(subtags, "|") + "'");
|
| if ($ne(constantPart, "''")) expressions.add$1(constantPart);
|
| var expression;
|
| if ($eq(expressions.get$length(), 1)) {
|
| expression = expressions.$index(0);
|
| }
|
| else {
|
| - expression = ("[" + Strings.join(expressions, ',') + "].join('|')");
|
| + expression = ("[" + Strings.join(expressions, ",") + "].join('|')");
|
| }
|
| return expression;
|
| }
|
| @@ -2835,21 +2850,20 @@ WorldGenerator.prototype.writeDynamicDispatchMetadata = function() {
|
| tagDefns.$setindex(type.get$nativeName(), makeExpression(type));
|
| }
|
| if (!tagDefns.isEmpty$0()) {
|
| - this.writer.enterBlock('(function(){');
|
| + this.writer.enterBlock("(function(){");
|
| for (var $$i = varNames.iterator$0(); $$i.hasNext$0(); ) {
|
| var varName = $$i.next$0();
|
| - this.writer.writeln(('var ' + varName + ' = ' + varDefns.$index(varName) + ';'));
|
| + 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]'/*'// [dynamic-dispatch-tag, '
|
| - + 'tags of classes implementing dynamic-dispatch-tag]'*/);
|
| + 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();
|
| this.writer.writeln(("['" + type.get$nativeName() + "', " + tagDefns.$index(type.get$nativeName()) + "],"));
|
| }
|
| - this.writer.exitBlock('];');
|
| - this.writer.writeln('\$dynamicSetMetadata(table);');
|
| - this.writer.exitBlock('})();');
|
| + this.writer.exitBlock("];");
|
| + this.writer.writeln("$dynamicSetMetadata(table);");
|
| + this.writer.exitBlock("})();");
|
| }
|
| }
|
| WorldGenerator.prototype._orderValues = function(map) {
|
| @@ -2943,12 +2957,12 @@ BlockScope.prototype._isDefinedInParent = function(name) {
|
| BlockScope.prototype.create = function(name, type, span, isFinal, isParameter) {
|
| var jsName = $globals.world.toJsIdentifier(name);
|
| if (this._vars.containsKey(name)) {
|
| - $globals.world.error(('duplicate name "' + name + '"'), span);
|
| + $globals.world.error(("duplicate name \"" + name + "\""), span);
|
| }
|
| if (!isParameter) {
|
| var index = 0;
|
| while (this._isDefinedInParent(jsName)) {
|
| - jsName = ('' + name + (index++));
|
| + jsName = ("" + name + (index++));
|
| }
|
| }
|
| var ret = new Value(type, jsName, span, false);
|
| @@ -3015,7 +3029,7 @@ MethodGenerator.prototype.forceTemp = function(value) {
|
| name = this._freeTemps.removeLast();
|
| }
|
| else {
|
| - name = '\$' + this._usedTemps.get$length();
|
| + name = "$" + this._usedTemps.get$length();
|
| }
|
| this._usedTemps.add(name);
|
| return new Value(value.get$type(), name, value.span, false);
|
| @@ -3025,7 +3039,7 @@ MethodGenerator.prototype.assignTemp = function(tmp, v) {
|
| return v;
|
| }
|
| else {
|
| - return new Value(v.get$type(), ('(' + tmp.code + ' = ' + v.code + ')'), v.span, true);
|
| + return new Value(v.get$type(), ("(" + tmp.code + " = " + v.code + ")"), v.span, true);
|
| }
|
| }
|
| MethodGenerator.prototype.freeTemp = function(value) {
|
| @@ -3033,7 +3047,7 @@ MethodGenerator.prototype.freeTemp = function(value) {
|
| this._freeTemps.add(value.code);
|
| }
|
| else {
|
| - $globals.world.internalError(('tried to free unused value or non-temp "' + value.code + '"'));
|
| + $globals.world.internalError(("tried to free unused value or non-temp \"" + value.code + "\""));
|
| }
|
| }
|
| MethodGenerator.prototype.run = function() {
|
| @@ -3043,7 +3057,7 @@ MethodGenerator.prototype.run = function() {
|
| this.writeBody();
|
| if (this.method.get$definition().get$nativeBody() != null) {
|
| this.writer = new CodeWriter();
|
| - if ($eq(this.method.get$definition().get$nativeBody(), '')) {
|
| + if ($eq(this.method.get$definition().get$nativeBody(), "")) {
|
| this.method.generator = null;
|
| }
|
| else {
|
| @@ -3067,46 +3081,46 @@ MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) {
|
| paramCode = ListFactory.ListFactory$from$factory(names);
|
| paramCode.addAll$1(this._paramCode);
|
| }
|
| - var _params = ('(' + Strings.join(this._paramCode, ", ") + ')');
|
| - var params = ('(' + Strings.join(paramCode, ", ") + ')');
|
| + var _params = ("(" + Strings.join(this._paramCode, ", ") + ")");
|
| + var params = ("(" + Strings.join(paramCode, ", ") + ")");
|
| if (this.method.declaringType.get$isTop() && !this.get$isClosure()) {
|
| - defWriter.enterBlock(('function ' + this.method.get$jsname() + params + ' {'));
|
| + defWriter.enterBlock(("function " + this.method.get$jsname() + params + " {"));
|
| }
|
| else if (this.get$isClosure()) {
|
| - if (this.method.name == '') {
|
| - defWriter.enterBlock(('(function ' + params + ' {'));
|
| + if (this.method.name == "") {
|
| + defWriter.enterBlock(("(function " + params + " {"));
|
| }
|
| else if (names != null) {
|
| if (lambda == null) {
|
| - defWriter.enterBlock(('var ' + this.method.get$jsname() + ' = (function' + params + ' {'));
|
| + defWriter.enterBlock(("var " + this.method.get$jsname() + " = (function" + params + " {"));
|
| }
|
| else {
|
| - defWriter.enterBlock(('(function ' + this.method.get$jsname() + params + ' {'));
|
| + defWriter.enterBlock(("(function " + this.method.get$jsname() + params + " {"));
|
| }
|
| }
|
| else {
|
| - defWriter.enterBlock(('function ' + this.method.get$jsname() + params + ' {'));
|
| + defWriter.enterBlock(("function " + this.method.get$jsname() + params + " {"));
|
| }
|
| }
|
| else if (this.method.get$isConstructor()) {
|
| - if (this.method.get$constructorName() == '') {
|
| - defWriter.enterBlock(('function ' + this.method.declaringType.get$jsname() + params + ' {'));
|
| + if (this.method.get$constructorName() == "") {
|
| + defWriter.enterBlock(("function " + this.method.declaringType.get$jsname() + params + " {"));
|
| }
|
| else {
|
| - defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + this.method.get$constructorName() + '\$ctor = function' + params + ' {'));
|
| + defWriter.enterBlock(("" + this.method.declaringType.get$jsname() + "." + this.method.get$constructorName() + "$ctor = function" + params + " {"));
|
| }
|
| }
|
| else if (this.method.get$isFactory()) {
|
| - defWriter.enterBlock(('' + this.method.get$generatedFactoryName() + ' = function' + _params + ' {'));
|
| + defWriter.enterBlock(("" + this.method.get$generatedFactoryName() + " = function" + _params + " {"));
|
| }
|
| else if (this.method.get$isStatic()) {
|
| - defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + this.method.get$jsname() + ' = function' + _params + ' {'));
|
| + defWriter.enterBlock(("" + this.method.declaringType.get$jsname() + "." + this.method.get$jsname() + " = function" + _params + " {"));
|
| }
|
| else {
|
| - defWriter.enterBlock($globals.world.gen._prototypeOf(this.method.declaringType, this.method.get$jsname()) + (' = function' + _params + ' {'));
|
| + defWriter.enterBlock($globals.world.gen._prototypeOf(this.method.declaringType, this.method.get$jsname()) + (" = function" + _params + " {"));
|
| }
|
| if (this.needsThis) {
|
| - defWriter.writeln('var \$this = this; // closure support');
|
| + defWriter.writeln("var $this = this; // closure support");
|
| }
|
| if (this._usedTemps.get$length() > 0 || this._freeTemps.get$length() > 0) {
|
| this._freeTemps.addAll(this._usedTemps);
|
| @@ -3114,20 +3128,20 @@ MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) {
|
| return x.compareTo$1(y);
|
| })
|
| );
|
| - defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';'));
|
| + defWriter.writeln(("var " + Strings.join(this._freeTemps, ", ") + ";"));
|
| }
|
| defWriter.writeln(this.writer.get$text());
|
| if (names != null) {
|
| - defWriter.exitBlock(('}).bind(null, ' + Strings.join(names, ", ") + ')'));
|
| + defWriter.exitBlock(("}).bind(null, " + Strings.join(names, ", ") + ")"));
|
| }
|
| - else if (this.get$isClosure() && this.method.name == '') {
|
| - defWriter.exitBlock('})');
|
| + else if (this.get$isClosure() && this.method.name == "") {
|
| + defWriter.exitBlock("})");
|
| }
|
| else {
|
| - defWriter.exitBlock('}');
|
| + defWriter.exitBlock("}");
|
| }
|
| - 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;'));
|
| + 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;"));
|
| }
|
| this._provideOptionalParamInfo(defWriter);
|
| if ((this.method instanceof MethodMember)) {
|
| @@ -3136,11 +3150,11 @@ MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) {
|
| }
|
| MethodGenerator._maybeGenerateBoundGetter = function(m, defWriter) {
|
| if (m._providePropertySyntax) {
|
| - defWriter.enterBlock($globals.world.gen._prototypeOf(m.declaringType, "get\$" + m.get$jsname()) + ' = function() {');
|
| - defWriter.writeln(('return this.' + m.get$jsname() + '.bind(this);'));
|
| - defWriter.exitBlock('}');
|
| + defWriter.enterBlock($globals.world.gen._prototypeOf(m.declaringType, "get$" + m.get$jsname()) + " = function() {");
|
| + defWriter.writeln(("return this." + m.get$jsname() + ".bind(this);"));
|
| + defWriter.exitBlock("}");
|
| if (m._provideFieldSyntax) {
|
| - $globals.world.internalError(('bound "' + m.name + '" accessed with field syntax'), m.definition.span);
|
| + $globals.world.internalError(("bound \"" + m.name + "\" accessed with field syntax"), m.definition.span);
|
| }
|
| }
|
| }
|
| @@ -3160,18 +3174,18 @@ MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) {
|
| }
|
| }
|
| if (optNames.get$length() > 0) {
|
| - var start = '';
|
| + var start = "";
|
| if (meth.isStatic) {
|
| if (!meth.declaringType.get$isTop()) {
|
| - start = meth.declaringType.get$jsname() + '.';
|
| + start = meth.declaringType.get$jsname() + ".";
|
| }
|
| }
|
| else {
|
| - start = meth.declaringType.get$jsname() + '.prototype.';
|
| + start = meth.declaringType.get$jsname() + ".prototype.";
|
| }
|
| optNames.addAll$1(optValues);
|
| var optional = "['" + Strings.join(optNames, "', '") + "']";
|
| - defWriter.writeln(('' + start + meth.get$jsname() + '.\$optional = ' + optional));
|
| + defWriter.writeln(("" + start + meth.get$jsname() + ".$optional = " + optional));
|
| }
|
| }
|
| }
|
| @@ -3189,7 +3203,7 @@ MethodGenerator.prototype.writeBody = function() {
|
| if (f.get$isField() && !f.get$isStatic()) {
|
| var cv = f.computeValue$0();
|
| if (cv != null) {
|
| - initializers.add$1(('this.' + f.get$jsname() + ' = ' + cv.get$code()));
|
| + initializers.add$1(("this." + f.get$jsname() + " = " + cv.get$code()));
|
| initializedFields.add$1(f.get$name());
|
| }
|
| }
|
| @@ -3202,14 +3216,14 @@ MethodGenerator.prototype.writeBody = function() {
|
| if (initializers != null && p.get$isInitializer()) {
|
| var field = this.method.declaringType.getMember(p.get$name());
|
| if (field == null) {
|
| - $globals.world.error('bad this parameter - no matching field', p.get$definition().get$span());
|
| + $globals.world.error("bad this parameter - no matching field", p.get$definition().get$span());
|
| }
|
| if (!field.get$isField()) {
|
| - $globals.world.error(('"this.' + p.get$name() + '" does not refer to a field'), p.get$definition().get$span());
|
| + $globals.world.error(("\"this." + p.get$name() + "\" does not refer to a field"), p.get$definition().get$span());
|
| }
|
| var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$definition().get$span(), false);
|
| this._paramCode.add(paramValue.get$code());
|
| - initializers.add$1(('this.' + field.get$jsname() + ' = ' + paramValue.get$code() + ';'));
|
| + initializers.add$1(("this." + field.get$jsname() + " = " + paramValue.get$code() + ";"));
|
| initializedFields.add$1(p.get$name());
|
| }
|
| else {
|
| @@ -3219,7 +3233,7 @@ MethodGenerator.prototype.writeBody = function() {
|
| }
|
| var body = this.method.get$definition().get$body();
|
| if (body == null && !this.method.get$isConstructor() && !this.method.get$isNative()) {
|
| - $globals.world.error(('unexpected empty body for ' + this.method.name), this.method.get$definition().get$span());
|
| + $globals.world.error(("unexpected empty body for " + this.method.name), this.method.get$definition().get$span());
|
| }
|
| var initializerCall = null;
|
| var declaredInitializers = this.method.get$definition().get$initializers();
|
| @@ -3233,34 +3247,34 @@ MethodGenerator.prototype.writeBody = function() {
|
| var init = $$i.next$0();
|
| if ((init instanceof CallExpression)) {
|
| if (initializerCall != null) {
|
| - $globals.world.error('only one initializer redirecting call is allowed', init.get$span());
|
| + $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) {
|
| 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());
|
| + $globals.world.error("invalid left side of initializer", left.get$span());
|
| continue;
|
| }
|
| var f = this.method.declaringType.getMember(left.get$name().get$name());
|
| if (f == null) {
|
| - $globals.world.error('bad initializer - no matching field', left.get$span());
|
| + $globals.world.error("bad initializer - no matching field", left.get$span());
|
| continue;
|
| }
|
| else if (!f.get$isField()) {
|
| - $globals.world.error(('"' + left.get$name().get$name() + '" does not refer to a field'), left.get$span());
|
| + $globals.world.error(("\"" + left.get$name().get$name() + "\" does not refer to a field"), left.get$span());
|
| continue;
|
| }
|
| initializedFields.add$1(f.get$name());
|
| - this.writer.writeln(('this.' + f.get$jsname() + ' = ' + this.visitValue(init.get$y()).get$code() + ';'));
|
| + this.writer.writeln(("this." + f.get$jsname() + " = " + this.visitValue(init.get$y()).get$code() + ";"));
|
| }
|
| else {
|
| - $globals.world.error('invalid initializer', init.get$span());
|
| + $globals.world.error("invalid initializer", init.get$span());
|
| }
|
| }
|
| }
|
| - this.writer.comment('// Initializers done');
|
| + this.writer.comment("// Initializers done");
|
| }
|
| if (this.method.get$isConstructor() && initializerCall == null && !this.method.get$isNative()) {
|
| var parentType = this.method.declaringType.get$parent();
|
| @@ -3276,14 +3290,14 @@ MethodGenerator.prototype.writeBody = function() {
|
| for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
|
| var p = $$list.$index($$i);
|
| if (p.get$isInitializer()) {
|
| - $globals.world.error('no initialization allowed on redirecting constructors', p.get$definition().get$span());
|
| + $globals.world.error("no initialization allowed on redirecting constructors", p.get$definition().get$span());
|
| break;
|
| }
|
| }
|
| }
|
| if (declaredInitializers != null && declaredInitializers.get$length() > 1) {
|
| var init = $eq(declaredInitializers.$index(0), initializerCall) ? declaredInitializers.$index(1) : declaredInitializers.$index(0);
|
| - $globals.world.error('no initialization allowed on redirecting constructors', init.get$span());
|
| + $globals.world.error("no initialization allowed on redirecting constructors", init.get$span());
|
| }
|
| initializedFields = null;
|
| }
|
| @@ -3292,14 +3306,14 @@ MethodGenerator.prototype.writeBody = function() {
|
| for (var $$i = allMembers.iterator$0(); $$i.hasNext$0(); ) {
|
| var member = $$i.next$0();
|
| if (member.get$isField() && member.get$isFinal() && !member.get$isStatic() && !this.method.get$isNative() && !initializedFields.contains$1(member.get$name())) {
|
| - $globals.world.error(('Field "' + member.get$name() + '" is final and was not initialized'), this.method.get$definition().get$span());
|
| + $globals.world.error(("Field \"" + member.get$name() + "\" is final and was not initialized"), this.method.get$definition().get$span());
|
| }
|
| }
|
| }
|
| this.visitStatementsInBlock(body);
|
| }
|
| MethodGenerator.prototype._writeInitializerCall = function(node) {
|
| - var contructorName = '';
|
| + var contructorName = "";
|
| var targetExp = node.target;
|
| if ((targetExp instanceof DotExpression)) {
|
| var dot = targetExp;
|
| @@ -3314,18 +3328,18 @@ MethodGenerator.prototype._writeInitializerCall = function(node) {
|
| target = this._makeThisValue(targetExp);
|
| }
|
| else {
|
| - $globals.world.error('bad call in initializers', node.span);
|
| + $globals.world.error("bad call in initializers", node.span);
|
| }
|
| target.set$allowDynamic(false);
|
| var m = target.get$type().getConstructor$1(contructorName);
|
| if (m == null) {
|
| - $globals.world.error(('no matching constructor for ' + target.get$type().get$name()), node.span);
|
| + $globals.world.error(("no matching constructor for " + target.get$type().get$name()), node.span);
|
| }
|
| this.method.set$initDelegate(m);
|
| var other = m;
|
| while (other != null) {
|
| if ($eq(other, this.method)) {
|
| - $globals.world.error('initialization cycle', node.span);
|
| + $globals.world.error("initialization cycle", node.span);
|
| break;
|
| }
|
| other = other.get$initDelegate();
|
| @@ -3333,7 +3347,7 @@ MethodGenerator.prototype._writeInitializerCall = function(node) {
|
| $globals.world.gen.genMethod(m);
|
| var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments));
|
| if ($ne(target.get$type(), $globals.world.objectType)) {
|
| - this.writer.writeln(('' + value.get$code() + ';'));
|
| + this.writer.writeln(("" + value.get$code() + ";"));
|
| }
|
| return target;
|
| }
|
| @@ -3346,7 +3360,7 @@ MethodGenerator.prototype._makeArgs = function(arguments) {
|
| seenLabel = true;
|
| }
|
| else if (seenLabel) {
|
| - $globals.world.error('bare argument can not follow named arguments', arg.get$span());
|
| + $globals.world.error("bare argument can not follow named arguments", arg.get$span());
|
| }
|
| args.add$1(this.visitValue(arg.get$value()));
|
| }
|
| @@ -3361,7 +3375,7 @@ MethodGenerator.prototype._invokeNative = function(name, arguments) {
|
| return method.invoke$4(this, method.get$definition(), new Value($globals.world.corelib.topType, null, null, true), args);
|
| }
|
| MethodGenerator._escapeString = function(text) {
|
| - return text.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('\n', '\\n').replaceAll('\r', '\\r');
|
| + return text.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\n", "\\n").replaceAll("\r", "\\r");
|
| }
|
| MethodGenerator.prototype.visitStatementsInBlock = function(body) {
|
| if ((body instanceof BlockStatement)) {
|
| @@ -3426,19 +3440,19 @@ MethodGenerator.prototype.visitVariableDefinition = function(node) {
|
| if (node.modifiers != null && $eq(node.modifiers.$index(0).get$kind(), 98/*TokenKind.FINAL*/)) {
|
| isFinal = true;
|
| }
|
| - this.writer.write('var ');
|
| + this.writer.write("var ");
|
| var type = this.method.resolveType(node.type, false);
|
| for (var i = 0;
|
| i < node.names.get$length(); i++) {
|
| var thisType = type;
|
| if (i > 0) {
|
| - this.writer.write(', ');
|
| + this.writer.write(", ");
|
| }
|
| var name = node.names.$index(i).get$name();
|
| var value = this.visitValue(node.values.$index(i));
|
| if (isFinal) {
|
| if (value == null) {
|
| - $globals.world.error('no value specified for final variable', node.span);
|
| + $globals.world.error("no value specified for final variable", node.span);
|
| }
|
| else {
|
| if (thisType.get$isVar()) thisType = value.get$type();
|
| @@ -3447,18 +3461,18 @@ MethodGenerator.prototype.visitVariableDefinition = function(node) {
|
| var val = this._scope.create(name, thisType, node.names.$index(i).get$span(), isFinal, false);
|
| if (value == null) {
|
| if (this._scope.reentrant) {
|
| - this.writer.write(('' + val.get$code() + ' = null'));
|
| + this.writer.write(("" + val.get$code() + " = null"));
|
| }
|
| else {
|
| - this.writer.write(('' + val.get$code()));
|
| + this.writer.write(("" + val.get$code()));
|
| }
|
| }
|
| else {
|
| value = value.convertTo$2(this, type);
|
| - this.writer.write(('' + val.get$code() + ' = ' + value.get$code()));
|
| + this.writer.write(("" + val.get$code() + " = " + value.get$code()));
|
| }
|
| }
|
| - this.writer.writeln(';');
|
| + this.writer.writeln(";");
|
| return false;
|
| }
|
| MethodGenerator.prototype.visitFunctionDefinition = function(node) {
|
| @@ -3470,31 +3484,31 @@ MethodGenerator.prototype.visitFunctionDefinition = function(node) {
|
| }
|
| MethodGenerator.prototype.visitReturnStatement = function(node) {
|
| if (node.value == null) {
|
| - this.writer.writeln('return;');
|
| + this.writer.writeln("return;");
|
| }
|
| else {
|
| if (this.method.get$isConstructor()) {
|
| - $globals.world.error('return of value not allowed from constructor', node.span);
|
| + $globals.world.error("return of value not allowed from constructor", node.span);
|
| }
|
| var value = this.visitTypedValue(node.value, this.method.get$returnType());
|
| - this.writer.writeln(('return ' + value.get$code() + ';'));
|
| + this.writer.writeln(("return " + value.get$code() + ";"));
|
| }
|
| return true;
|
| }
|
| MethodGenerator.prototype.visitThrowStatement = function(node) {
|
| if (node.value != null) {
|
| var value = this.visitValue(node.value);
|
| - value.invoke$4(this, 'toString', node, Arguments.get$EMPTY());
|
| - this.writer.writeln(('\$throw(' + value.get$code() + ');'));
|
| + value.invoke$4(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) {
|
| - $globals.world.error('rethrow outside of catch', node.span);
|
| + $globals.world.error("rethrow outside of catch", node.span);
|
| }
|
| else {
|
| - this.writer.writeln(('throw ' + rethrow.get$code() + ';'));
|
| + this.writer.writeln(("throw " + rethrow.get$code() + ";"));
|
| }
|
| }
|
| return true;
|
| @@ -3505,38 +3519,38 @@ MethodGenerator.prototype.visitAssertStatement = function(node) {
|
| var span = node.test.span;
|
| var line = span.get$file().getLine$1(span.get$start()) + 1;
|
| var column = span.get$file().getColumn$2(line - 1, span.get$start()) + 1;
|
| - var args = [test, EvaluatedValue.EvaluatedValue$factory($globals.world.stringType, MethodGenerator._escapeString(span.get$text()), ('"' + MethodGenerator._escapeString(span.get$text()) + '"'), null), EvaluatedValue.EvaluatedValue$factory($globals.world.stringType, MethodGenerator._escapeString(span.get$file().get$filename()), ('"' + MethodGenerator._escapeString(span.get$file().get$filename()) + '"'), null), EvaluatedValue.EvaluatedValue$factory($globals.world.intType, line, line.toString$0(), null), EvaluatedValue.EvaluatedValue$factory($globals.world.intType, column, column.toString$0(), null)];
|
| + var args = [test, Value.fromString(span.get$text(), node.span), Value.fromString(span.get$file().get$filename(), node.span), Value.fromInt(line, node.span), Value.fromInt(column, node.span)];
|
| var tp = $globals.world.corelib.topType;
|
| - var f = tp.getMember$1('_assert');
|
| + var f = tp.getMember$1("_assert");
|
| var value = f.invoke(this, node, new Value.type$ctor(tp, null), new Arguments(null, args), false);
|
| - this.writer.writeln(('' + value.get$code() + ';'));
|
| + this.writer.writeln(("" + value.get$code() + ";"));
|
| }
|
| return false;
|
| }
|
| MethodGenerator.prototype.visitBreakStatement = function(node) {
|
| if (node.label == null) {
|
| - this.writer.writeln('break;');
|
| + this.writer.writeln("break;");
|
| }
|
| else {
|
| - this.writer.writeln(('break ' + node.label.name + ';'));
|
| + this.writer.writeln(("break " + node.label.name + ";"));
|
| }
|
| return true;
|
| }
|
| MethodGenerator.prototype.visitContinueStatement = function(node) {
|
| if (node.label == null) {
|
| - this.writer.writeln('continue;');
|
| + this.writer.writeln("continue;");
|
| }
|
| else {
|
| - this.writer.writeln(('continue ' + node.label.name + ';'));
|
| + this.writer.writeln(("continue " + node.label.name + ";"));
|
| }
|
| return true;
|
| }
|
| MethodGenerator.prototype.visitIfStatement = function(node) {
|
| var test = this.visitBool(node.test);
|
| - this.writer.write(('if (' + test.get$code() + ') '));
|
| + this.writer.write(("if (" + test.get$code() + ") "));
|
| var exit1 = node.trueBranch.visit(this);
|
| if (node.falseBranch != null) {
|
| - this.writer.write('else ');
|
| + this.writer.write("else ");
|
| if (node.falseBranch.visit(this) && exit1) {
|
| return true;
|
| }
|
| @@ -3545,43 +3559,43 @@ MethodGenerator.prototype.visitIfStatement = function(node) {
|
| }
|
| MethodGenerator.prototype.visitWhileStatement = function(node) {
|
| var test = this.visitBool(node.test);
|
| - this.writer.write(('while (' + test.get$code() + ') '));
|
| + this.writer.write(("while (" + test.get$code() + ") "));
|
| this._pushBlock(true);
|
| node.body.visit(this);
|
| this._popBlock();
|
| return false;
|
| }
|
| MethodGenerator.prototype.visitDoStatement = function(node) {
|
| - this.writer.write('do ');
|
| + this.writer.write("do ");
|
| this._pushBlock(true);
|
| node.body.visit(this);
|
| this._popBlock();
|
| var test = this.visitBool(node.test);
|
| - this.writer.writeln(('while (' + test.get$code() + ')'));
|
| + this.writer.writeln(("while (" + test.get$code() + ")"));
|
| return false;
|
| }
|
| MethodGenerator.prototype.visitForStatement = function(node) {
|
| this._pushBlock(false);
|
| - this.writer.write('for (');
|
| + this.writer.write("for (");
|
| if (node.init != null) node.init.visit(this);
|
| - else this.writer.write(';');
|
| + else this.writer.write(";");
|
| if (node.test != null) {
|
| var test = this.visitBool(node.test);
|
| - this.writer.write((' ' + test.get$code() + '; '));
|
| + this.writer.write((" " + test.get$code() + "; "));
|
| }
|
| else {
|
| - this.writer.write('; ');
|
| + this.writer.write("; ");
|
| }
|
| var needsComma = false;
|
| var $$list = node.step;
|
| for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
|
| var s = $$list.$index($$i);
|
| - if (needsComma) this.writer.write(', ');
|
| + if (needsComma) this.writer.write(", ");
|
| var sv = this.visitVoid(s);
|
| this.writer.write(sv.get$code());
|
| needsComma = true;
|
| }
|
| - this.writer.write(') ');
|
| + this.writer.write(") ");
|
| this._pushBlock(true);
|
| node.body.visit(this);
|
| this._popBlock();
|
| @@ -3603,39 +3617,39 @@ MethodGenerator.prototype.visitForInStatement = function(node) {
|
| var item = this._scope.create(itemName, itemType, node.item.name.span, isFinal, false);
|
| var listVar = list;
|
| if (list.get$needsTemp()) {
|
| - listVar = this._scope.create('\$list', list.get$type(), null, false, false);
|
| - this.writer.writeln(('var ' + listVar.code + ' = ' + list.get$code() + ';'));
|
| + listVar = this._scope.create("$list", list.get$type(), null, false, false);
|
| + this.writer.writeln(("var " + listVar.code + " = " + list.get$code() + ";"));
|
| }
|
| if (list.get$type().get$isList()) {
|
| - var tmpi = this._scope.create('\$i', $globals.world.numType, null, false, false);
|
| - var listLength = listVar.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 = listVar.invoke(this, ':index', node.list, new Arguments(null, [tmpi]), false);
|
| - this.writer.writeln(('var ' + item.get$code() + ' = ' + value.get$code() + ';'));
|
| + var tmpi = this._scope.create("$i", $globals.world.numType, null, false, false);
|
| + var listLength = listVar.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 = listVar.invoke(this, ":index", node.list, new Arguments(null, [tmpi]), false);
|
| + this.writer.writeln(("var " + item.get$code() + " = " + value.get$code() + ";"));
|
| }
|
| else {
|
| - var iterator = list.invoke$4(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());
|
| - this.writer.enterBlock(('for (var ' + tmpi.get$code() + ' = ' + iterator.get$code() + '; ' + hasNext.get$code() + '; ) {'));
|
| - this.writer.writeln(('var ' + item.get$code() + ' = ' + next.get$code() + ';'));
|
| + var iterator = list.invoke$4(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());
|
| + this.writer.enterBlock(("for (var " + tmpi.get$code() + " = " + iterator.get$code() + "; " + hasNext.get$code() + "; ) {"));
|
| + this.writer.writeln(("var " + item.get$code() + " = " + next.get$code() + ";"));
|
| }
|
| this.visitStatementsInBlock(node.body);
|
| - this.writer.exitBlock('}');
|
| + this.writer.exitBlock("}");
|
| this._popBlock();
|
| return false;
|
| }
|
| MethodGenerator.prototype._genToDartException = function(ex) {
|
| var result = this._invokeNative("_toDartException", [ex]);
|
| - this.writer.writeln(('' + ex.code + ' = ' + result.get$code() + ';'));
|
| + this.writer.writeln(("" + ex.code + " = " + result.get$code() + ";"));
|
| }
|
| MethodGenerator.prototype._genStackTraceOf = function(trace, ex) {
|
| var result = this._invokeNative("_stackTraceOf", [ex]);
|
| - this.writer.writeln(('var ' + trace.code + ' = ' + result.get$code() + ';'));
|
| + this.writer.writeln(("var " + trace.code + " = " + result.get$code() + ";"));
|
| }
|
| MethodGenerator.prototype.visitTryStatement = function(node) {
|
| - this.writer.enterBlock('try {');
|
| + this.writer.enterBlock("try {");
|
| this._pushBlock(false);
|
| this.visitStatementsInBlock(node.body);
|
| this._popBlock();
|
| @@ -3645,7 +3659,7 @@ MethodGenerator.prototype.visitTryStatement = function(node) {
|
| var exType = this.method.resolveType(catch_.get$exception().get$type(), false);
|
| var ex = this._scope.declare(catch_.get$exception());
|
| this._scope.rethrow = ex;
|
| - this.writer.nextBlock(('} catch (' + ex.get$code() + ') {'));
|
| + this.writer.nextBlock(("} catch (" + ex.get$code() + ") {"));
|
| if (catch_.get$trace() != null) {
|
| var trace = this._scope.declare(catch_.get$trace());
|
| this._genStackTraceOf(trace, ex);
|
| @@ -3653,22 +3667,22 @@ MethodGenerator.prototype.visitTryStatement = function(node) {
|
| this._genToDartException(ex);
|
| if (!exType.get$isVarOrObject()) {
|
| 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.writer.writeln(("if (" + test.get$code() + ") throw " + ex.get$code() + ";"));
|
| }
|
| this.visitStatementsInBlock(node.catches.$index(0).get$body());
|
| this._popBlock();
|
| }
|
| else if (node.catches.get$length() > 0) {
|
| this._pushBlock(false);
|
| - var ex = this._scope.create('\$ex', $globals.world.varType, null, false, false);
|
| + var ex = this._scope.create("$ex", $globals.world.varType, null, false, false);
|
| this._scope.rethrow = ex;
|
| - this.writer.nextBlock(('} catch (' + ex.get$code() + ') {'));
|
| + this.writer.nextBlock(("} catch (" + ex.get$code() + ") {"));
|
| var trace = null;
|
| if (node.catches.some((function (c) {
|
| return c.get$trace() != null;
|
| })
|
| )) {
|
| - trace = this._scope.create('\$trace', $globals.world.varType, null, false, false);
|
| + trace = this._scope.create("$trace", $globals.world.varType, null, false, false);
|
| this._genStackTraceOf(trace, ex);
|
| }
|
| this._genToDartException(ex);
|
| @@ -3682,57 +3696,57 @@ MethodGenerator.prototype.visitTryStatement = function(node) {
|
| if (!tmpType.get$isVarOrObject()) {
|
| var test = ex.instanceOf$3$isTrue$forceCheck(this, tmpType, catch_.get$exception().get$span(), true, true);
|
| if (i == 0) {
|
| - this.writer.enterBlock(('if (' + test.get$code() + ') {'));
|
| + this.writer.enterBlock(("if (" + test.get$code() + ") {"));
|
| }
|
| else {
|
| - this.writer.nextBlock(('} else if (' + test.get$code() + ') {'));
|
| + this.writer.nextBlock(("} else if (" + test.get$code() + ") {"));
|
| }
|
| }
|
| else if (i > 0) {
|
| - this.writer.nextBlock('} else {');
|
| + this.writer.nextBlock("} else {");
|
| }
|
| - this.writer.writeln(('var ' + tmp.get$code() + ' = ' + ex.get$code() + ';'));
|
| + this.writer.writeln(("var " + tmp.get$code() + " = " + ex.get$code() + ";"));
|
| if (catch_.get$trace() != null) {
|
| var tmptrace = this._scope.declare(catch_.get$trace());
|
| - this.writer.writeln(('var ' + tmptrace.get$code() + ' = ' + trace.get$code() + ';'));
|
| + this.writer.writeln(("var " + tmptrace.get$code() + " = " + trace.get$code() + ";"));
|
| }
|
| this.visitStatementsInBlock(catch_.get$body());
|
| this._popBlock();
|
| if (tmpType.get$isVarOrObject()) {
|
| if (i + 1 < node.catches.get$length()) {
|
| - $globals.world.error('Unreachable catch clause', node.catches.$index(i + 1).get$span());
|
| + $globals.world.error("Unreachable catch clause", node.catches.$index(i + 1).get$span());
|
| }
|
| if (i > 0) {
|
| - this.writer.exitBlock('}');
|
| + this.writer.exitBlock("}");
|
| }
|
| needsRethrow = false;
|
| break;
|
| }
|
| }
|
| if (needsRethrow) {
|
| - this.writer.nextBlock('} else {');
|
| - this.writer.writeln(('throw ' + ex.get$code() + ';'));
|
| - this.writer.exitBlock('}');
|
| + this.writer.nextBlock("} else {");
|
| + this.writer.writeln(("throw " + ex.get$code() + ";"));
|
| + this.writer.exitBlock("}");
|
| }
|
| this._popBlock();
|
| }
|
| if (node.finallyBlock != null) {
|
| - this.writer.nextBlock('} finally {');
|
| + this.writer.nextBlock("} finally {");
|
| this._pushBlock(false);
|
| this.visitStatementsInBlock(node.finallyBlock);
|
| this._popBlock();
|
| }
|
| - this.writer.exitBlock('}');
|
| + this.writer.exitBlock("}");
|
| return false;
|
| }
|
| MethodGenerator.prototype.visitSwitchStatement = function(node) {
|
| var test = this.visitValue(node.test);
|
| - this.writer.enterBlock(('switch (' + test.get$code() + ') {'));
|
| + this.writer.enterBlock(("switch (" + test.get$code() + ") {"));
|
| var $$list = node.cases;
|
| for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
|
| var case_ = $$list.$index($$i);
|
| if (case_.get$label() != null) {
|
| - $globals.world.error('unimplemented: labeled case statement', case_.get$span());
|
| + $globals.world.error("unimplemented: labeled case statement", case_.get$span());
|
| }
|
| this._pushBlock(false);
|
| for (var i = 0;
|
| @@ -3740,26 +3754,26 @@ MethodGenerator.prototype.visitSwitchStatement = function(node) {
|
| var expr = case_.get$cases().$index(i);
|
| if (expr == null) {
|
| if (i < case_.get$cases().get$length() - 1) {
|
| - $globals.world.error('default clause must be the last case', case_.get$span());
|
| + $globals.world.error("default clause must be the last case", case_.get$span());
|
| }
|
| - this.writer.writeln('default:');
|
| + this.writer.writeln("default:");
|
| }
|
| else {
|
| var value = this.visitValue(expr);
|
| - this.writer.writeln(('case ' + value.get$code() + ':'));
|
| + this.writer.writeln(("case " + value.get$code() + ":"));
|
| }
|
| }
|
| - this.writer.enterBlock('');
|
| + this.writer.enterBlock("");
|
| var caseExits = this._visitAllStatements(case_.get$statements(), false);
|
| if ($ne(case_, node.cases.$index(node.cases.get$length() - 1)) && !caseExits) {
|
| var span = case_.get$statements().$index(case_.get$statements().get$length() - 1).get$span();
|
| - this.writer.writeln('\$throw(new FallThroughError());');
|
| + this.writer.writeln("$throw(new FallThroughError());");
|
| $globals.world.gen.corejs.useThrow = true;
|
| }
|
| - this.writer.exitBlock('');
|
| + this.writer.exitBlock("");
|
| this._popBlock();
|
| }
|
| - this.writer.exitBlock('}');
|
| + this.writer.exitBlock("}");
|
| return false;
|
| }
|
| MethodGenerator.prototype._visitAllStatements = function(statementList, exits) {
|
| @@ -3768,48 +3782,48 @@ MethodGenerator.prototype._visitAllStatements = function(statementList, exits) {
|
| var stmt = statementList.$index(i);
|
| exits = stmt.visit$1(this);
|
| if ($ne(stmt, statementList.$index(statementList.get$length() - 1)) && exits) {
|
| - $globals.world.warning('unreachable code', statementList.$index(i + 1).get$span());
|
| + $globals.world.warning("unreachable code", statementList.$index(i + 1).get$span());
|
| }
|
| }
|
| return exits;
|
| }
|
| MethodGenerator.prototype.visitBlockStatement = function(node) {
|
| this._pushBlock(false);
|
| - this.writer.enterBlock('{');
|
| + this.writer.enterBlock("{");
|
| var exits = this._visitAllStatements(node.body, false);
|
| - this.writer.exitBlock('}');
|
| + this.writer.exitBlock("}");
|
| this._popBlock();
|
| return exits;
|
| }
|
| MethodGenerator.prototype.visitLabeledStatement = function(node) {
|
| - this.writer.writeln(('' + node.name.name + ':'));
|
| + this.writer.writeln(("" + node.name.name + ":"));
|
| node.body.visit(this);
|
| return false;
|
| }
|
| MethodGenerator.prototype.visitExpressionStatement = function(node) {
|
| if ((node.body instanceof VarExpression) || (node.body instanceof ThisExpression)) {
|
| - $globals.world.warning('variable used as statement', node.span);
|
| + $globals.world.warning("variable used as statement", node.span);
|
| }
|
| var value = this.visitVoid(node.body);
|
| - this.writer.writeln(('' + value.get$code() + ';'));
|
| + this.writer.writeln(("" + value.get$code() + ";"));
|
| return false;
|
| }
|
| MethodGenerator.prototype.visitEmptyStatement = function(node) {
|
| - this.writer.writeln(';');
|
| + this.writer.writeln(";");
|
| return false;
|
| }
|
| MethodGenerator.prototype._checkNonStatic = function(node) {
|
| if (this.get$isStatic()) {
|
| - $globals.world.warning('not allowed in static method', node.span);
|
| + $globals.world.warning("not allowed in static method", node.span);
|
| }
|
| }
|
| MethodGenerator.prototype._makeSuperValue = function(node) {
|
| var parentType = this.method.declaringType.get$parent();
|
| this._checkNonStatic(node);
|
| if (parentType == null) {
|
| - $globals.world.error('no super class', node.span);
|
| + $globals.world.error("no super class", node.span);
|
| }
|
| - var ret = new Value(parentType, 'this', node.span, false);
|
| + var ret = new Value(parentType, "this", node.span, false);
|
| ret.set$isSuper(true);
|
| return ret;
|
| }
|
| @@ -3823,10 +3837,10 @@ MethodGenerator.prototype._getOutermostMethod = function() {
|
| MethodGenerator.prototype._makeThisCode = function() {
|
| if (this.enclosingMethod != null) {
|
| this._getOutermostMethod().set$needsThis(true);
|
| - return '\$this';
|
| + return "$this";
|
| }
|
| else {
|
| - return 'this';
|
| + return "this";
|
| }
|
| }
|
| MethodGenerator.prototype._makeThisValue = function(node) {
|
| @@ -3834,18 +3848,18 @@ MethodGenerator.prototype._makeThisValue = function(node) {
|
| var outermostMethod = this._getOutermostMethod();
|
| outermostMethod._checkNonStatic$1(node);
|
| outermostMethod.set$needsThis(true);
|
| - return new Value(outermostMethod.get$method().get$declaringType(), '\$this', node != null ? node.span : null, false);
|
| + return new Value(outermostMethod.get$method().get$declaringType(), "$this", node != null ? node.span : null, false);
|
| }
|
| else {
|
| this._checkNonStatic(node);
|
| - return new Value(this.method.declaringType, 'this', node != null ? node.span : null, false);
|
| + return new Value(this.method.declaringType, "this", node != null ? node.span : null, false);
|
| }
|
| }
|
| MethodGenerator.prototype.visitLambdaExpression = function(node) {
|
| - var name = (node.func.name != null) ? node.func.name.name : '';
|
| + 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, '')) {
|
| + if ($ne(name, "")) {
|
| lambdaGen._scope.create(name, meth.get$functionType(), meth.definition.span, true, false);
|
| lambdaGen._pushBlock(false);
|
| }
|
| @@ -3857,7 +3871,7 @@ MethodGenerator.prototype.visitLambdaExpression = function(node) {
|
| MethodGenerator.prototype.visitCallExpression = function(node) {
|
| var target;
|
| var position = node.target;
|
| - var name = ':call';
|
| + var name = ":call";
|
| if ((node.target instanceof DotExpression)) {
|
| var dot = node.target;
|
| if ((dot.self instanceof LiteralExpression)) {
|
| @@ -3874,7 +3888,7 @@ MethodGenerator.prototype.visitCallExpression = function(node) {
|
| name = varExpr.name.name;
|
| target = this._scope.lookup(name);
|
| if (target != null) {
|
| - return target.invoke$4(this, ':call', node, this._makeArgs(node.arguments));
|
| + return target.invoke$4(this, ":call", node, this._makeArgs(node.arguments));
|
| }
|
| target = this._makeThisOrType(varExpr.span);
|
| return target.invoke$4(this, name, node, this._makeArgs(node.arguments));
|
| @@ -3887,7 +3901,7 @@ MethodGenerator.prototype.visitCallExpression = function(node) {
|
| 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$4(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));
|
| @@ -3897,10 +3911,10 @@ MethodGenerator.prototype.visitBinaryExpression = function(node, isVoid) {
|
| if (kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/) {
|
| var x = this.visitTypedValue(node.x, $globals.world.nonNullBool);
|
| var y = this.visitTypedValue(node.y, $globals.world.nonNullBool);
|
| - var code = ('' + x.get$code() + ' ' + node.op + ' ' + y.get$code());
|
| + var code = ("" + x.get$code() + " " + node.op + " " + y.get$code());
|
| if (x.get$isConst() && y.get$isConst()) {
|
| var value = (kind == 35/*TokenKind.AND*/) ? x.get$actualValue() && y.get$actualValue() : x.get$actualValue() || y.get$actualValue();
|
| - return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, value, ('' + value), node.span);
|
| + return Value.fromBool(value, node.span);
|
| }
|
| return new Value($globals.world.nonNullBool, code, node.span, true);
|
| }
|
| @@ -3910,25 +3924,15 @@ MethodGenerator.prototype.visitBinaryExpression = function(node, isVoid) {
|
| if (x.get$isConst() && y.get$isConst()) {
|
| var xVal = x.get$actualValue();
|
| var yVal = y.get$actualValue();
|
| - if (x.get$type().get$isString() && y.get$type().get$isString() && $ne(xVal.$index(0), yVal.$index(0))) {
|
| - if ($eq(xVal.$index(0), '"')) {
|
| - xVal = xVal.substring$2(1, xVal.get$length() - 1);
|
| - yVal = toDoubleQuote(yVal.substring$2(1, yVal.get$length() - 1));
|
| - }
|
| - else {
|
| - xVal = toDoubleQuote(xVal.substring$2(1, xVal.get$length() - 1));
|
| - yVal = yVal.substring$2(1, yVal.get$length() - 1);
|
| - }
|
| - }
|
| var value = kind == 50/*TokenKind.EQ_STRICT*/ ? $eq(xVal, yVal) : $ne(xVal, yVal);
|
| - return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, value, ("" + value), node.span);
|
| + return Value.fromBool(value, node.span);
|
| }
|
| - if ($eq(x.get$code(), 'null') || $eq(y.get$code(), 'null')) {
|
| + if ($eq(x.get$code(), "null") || $eq(y.get$code(), "null")) {
|
| var op = node.op.toString().substring(0, 2);
|
| - return new Value($globals.world.nonNullBool, ('' + x.get$code() + ' ' + op + ' ' + y.get$code()), node.span, true);
|
| + return new Value($globals.world.nonNullBool, ("" + x.get$code() + " " + op + " " + y.get$code()), node.span, true);
|
| }
|
| else {
|
| - return new Value($globals.world.nonNullBool, ('' + x.get$code() + ' ' + node.op + ' ' + y.get$code()), node.span, true);
|
| + return new Value($globals.world.nonNullBool, ("" + x.get$code() + " " + node.op + " " + y.get$code()), node.span, true);
|
| }
|
| }
|
| var assignKind = TokenKind.kindFromAssign(node.op.kind);
|
| @@ -3937,10 +3941,10 @@ MethodGenerator.prototype.visitBinaryExpression = function(node, isVoid) {
|
| var y = this.visitValue(node.y);
|
| var name = TokenKind.binaryMethodName(node.op.kind);
|
| if (node.op.kind == 49/*TokenKind.NE*/) {
|
| - name = ':ne';
|
| + name = ":ne";
|
| }
|
| if (name == null) {
|
| - $globals.world.internalError(('unimplemented binary op ' + node.op), node.span);
|
| + $globals.world.internalError(("unimplemented binary op " + node.op), node.span);
|
| return;
|
| }
|
| return x.invoke$4(this, name, node, new Arguments(null, [y]));
|
| @@ -3969,7 +3973,7 @@ MethodGenerator.prototype._visitAssign = function(kind, xn, yn, position, captur
|
| return this._visitDotAssign(kind, xn, yn, position, captureOriginal);
|
| }
|
| else {
|
| - $globals.world.error('illegal lhs', xn.span);
|
| + $globals.world.error("illegal lhs", xn.span);
|
| }
|
| }
|
| MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, captureOriginal) {
|
| @@ -3999,7 +4003,7 @@ MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap
|
| else {
|
| var member = this.get$library().lookup(name, xn.name.span);
|
| if (member == null) {
|
| - $globals.world.warning(('can not resolve ' + name), xn.span);
|
| + $globals.world.warning(("can not resolve " + name), xn.span);
|
| return this._makeMissingValue(name);
|
| }
|
| members = new MemberSet(member, false);
|
| @@ -4017,23 +4021,23 @@ MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap
|
| }
|
| }
|
| if (x.get$isFinal()) {
|
| - $globals.world.error(('final variable "' + x.get$code() + '" is not assignable'), position.span);
|
| + $globals.world.error(("final variable \"" + x.get$code() + "\" is not assignable"), position.span);
|
| }
|
| y = y.convertTo$2(this, x.get$type());
|
| if (kind == 0) {
|
| x = captureOriginal(x);
|
| - return new Value(y.get$type(), ('' + x.get$code() + ' = ' + y.get$code()), position.span, true);
|
| + return new Value(y.get$type(), ("" + x.get$code() + " = " + y.get$code()), position.span, true);
|
| }
|
| else if (x.get$type().get$isNum() && y.get$type().get$isNum() && (kind != 46/*TokenKind.TRUNCDIV*/)) {
|
| x = captureOriginal(x);
|
| var op = TokenKind.kindToString(kind);
|
| - return new Value(y.get$type(), ('' + x.get$code() + ' ' + op + '= ' + y.get$code()), position.span, true);
|
| + return new Value(y.get$type(), ("" + x.get$code() + " " + op + "= " + y.get$code()), position.span, true);
|
| }
|
| else {
|
| var right = x;
|
| right = captureOriginal(right);
|
| y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arguments(null, [y]));
|
| - return new Value(y.get$type(), ('' + x.get$code() + ' = ' + y.get$code()), position.span, true);
|
| + return new Value(y.get$type(), ("" + x.get$code() + " = " + y.get$code()), position.span, true);
|
| }
|
| }
|
| MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, captureOriginal, isVoid) {
|
| @@ -4046,7 +4050,7 @@ MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c
|
| tmptarget = this.getTemp(target);
|
| tmpindex = this.getTemp(index);
|
| index = this.assignTemp(tmpindex, index);
|
| - var right = tmptarget.invoke$4(this, ':index', position, new Arguments(null, [tmpindex]));
|
| + var right = tmptarget.invoke$4(this, ":index", position, new Arguments(null, [tmpindex]));
|
| right = captureOriginal(right);
|
| y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arguments(null, [y]));
|
| }
|
| @@ -4055,9 +4059,9 @@ MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c
|
| tmpy = this.getTemp(y);
|
| y = this.assignTemp(tmpy, y);
|
| }
|
| - var ret = this.assignTemp(tmptarget, target).invoke(this, ':setindex', position, new Arguments(null, [index, y]), false);
|
| + var ret = this.assignTemp(tmptarget, target).invoke(this, ":setindex", position, new Arguments(null, [index, y]), false);
|
| if (tmpy != null) {
|
| - ret = new Value(ret.get$type(), ('(' + ret.get$code() + ', ' + tmpy.get$code() + ')'), ret.get$span(), true);
|
| + ret = new Value(ret.get$type(), ("(" + ret.get$code() + ", " + tmpy.get$code() + ")"), ret.get$span(), true);
|
| if ($ne(tmpy, y)) this.freeTemp(tmpy);
|
| }
|
| if ($ne(tmptarget, target)) this.freeTemp(tmptarget);
|
| @@ -4085,24 +4089,24 @@ MethodGenerator.prototype.visitUnaryExpression = function(node) {
|
| case 17/*TokenKind.DECR*/:
|
|
|
| if (value.get$type().get$isNum()) {
|
| - return new Value(value.get$type(), ('' + node.op + value.get$code()), node.span, true);
|
| + return new Value(value.get$type(), ("" + node.op + value.get$code()), node.span, true);
|
| }
|
| else {
|
| var kind = (16/*TokenKind.INCR*/ == node.op.kind ? 42/*TokenKind.ADD*/ : 43/*TokenKind.SUB*/);
|
| - var operand = new LiteralExpression(1, new TypeReference(node.span, $globals.world.numType), '1', node.span);
|
| + var operand = new LiteralExpression(Value.fromInt(1, node.span), node.span);
|
| var assignValue = this._visitAssign(kind, node.self, operand, node, to$call$1(null), false);
|
| - return new Value(assignValue.get$type(), ('(' + assignValue.get$code() + ')'), node.span, true);
|
| + return new Value(assignValue.get$type(), ("(" + assignValue.get$code() + ")"), node.span, true);
|
| }
|
|
|
| case 19/*TokenKind.NOT*/:
|
|
|
| if (value.get$type().get$isBool() && value.get$isConst()) {
|
| var newVal = !value.get$actualValue();
|
| - return EvaluatedValue.EvaluatedValue$factory(value.get$type(), newVal, ('' + newVal), node.span);
|
| + return EvaluatedValue.EvaluatedValue$factory(value.get$type(), newVal, ("" + newVal), node.span);
|
| }
|
| else {
|
| var newVal = value.convertTo$2(this, $globals.world.nonNullBool);
|
| - return new Value(newVal.get$type(), ('!' + newVal.get$code()), node.span, true);
|
| + return new Value(newVal.get$type(), ("!" + newVal.get$code()), node.span, true);
|
| }
|
|
|
| case 42/*TokenKind.ADD*/:
|
| @@ -4113,36 +4117,36 @@ MethodGenerator.prototype.visitUnaryExpression = function(node) {
|
| case 18/*TokenKind.BIT_NOT*/:
|
|
|
| if (node.op.kind == 18/*TokenKind.BIT_NOT*/) {
|
| - return value.invoke$4(this, ':bit_not', node, Arguments.get$EMPTY());
|
| + return value.invoke$4(this, ":bit_not", node, Arguments.get$EMPTY());
|
| }
|
| else if (node.op.kind == 43/*TokenKind.SUB*/) {
|
| - return value.invoke$4(this, ':negate', node, Arguments.get$EMPTY());
|
| + return value.invoke$4(this, ":negate", node, Arguments.get$EMPTY());
|
| }
|
| else {
|
| - $globals.world.internalError(('unimplemented: unary ' + node.op), node.span);
|
| + $globals.world.internalError(("unimplemented: unary " + node.op), node.span);
|
| }
|
| $throw(new FallThroughError());
|
|
|
| default:
|
|
|
| - $globals.world.internalError(('unimplemented: ' + node.op), node.span);
|
| + $globals.world.internalError(("unimplemented: " + node.op), node.span);
|
|
|
| }
|
| }
|
| MethodGenerator.prototype.visitDeclaredIdentifier = function(node) {
|
| - $globals.world.error('Expected expression', node.span);
|
| + $globals.world.error("Expected expression", node.span);
|
| }
|
| MethodGenerator.prototype.visitAwaitExpression = function(node) {
|
| - $globals.world.internalError('Await expressions should have been eliminated before code generation', node.span);
|
| + $globals.world.internalError("Await expressions should have been eliminated before code generation", node.span);
|
| }
|
| MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) {
|
| var $this = this; // closure support
|
| var value = this.visitValue(node.body);
|
| if (value.get$type().get$isNum() && !value.get$isFinal()) {
|
| - return new Value(value.get$type(), ('' + value.get$code() + node.op), node.span, true);
|
| + return new Value(value.get$type(), ("" + value.get$code() + node.op), node.span, true);
|
| }
|
| var kind = (16/*TokenKind.INCR*/ == node.op.kind) ? 42/*TokenKind.ADD*/ : 43/*TokenKind.SUB*/;
|
| - var operand = new LiteralExpression(1, new TypeReference(node.span, $globals.world.numType), '1', node.span);
|
| + var operand = new LiteralExpression(Value.fromInt(1, node.span), node.span);
|
| var tmpleft = null, left = null;
|
| var ret = this._visitAssign(kind, node.body, operand, node, (function (l) {
|
| if (isVoid) {
|
| @@ -4165,11 +4169,11 @@ MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) {
|
| }
|
| MethodGenerator.prototype.visitNewExpression = function(node) {
|
| var typeRef = node.type;
|
| - var constructorName = '';
|
| + var constructorName = "";
|
| if (node.name != null) {
|
| constructorName = node.name.name;
|
| }
|
| - if ($eq(constructorName, '') && !(typeRef instanceof GenericTypeReference) && typeRef.get$names() != null) {
|
| + if ($eq(constructorName, "") && !(typeRef instanceof GenericTypeReference) && typeRef.get$names() != null) {
|
| var names = ListFactory.ListFactory$from$factory(typeRef.get$names());
|
| constructorName = names.removeLast$0().get$name();
|
| if ($eq(names.get$length(), 0)) names = null;
|
| @@ -4178,10 +4182,10 @@ MethodGenerator.prototype.visitNewExpression = function(node) {
|
| var type = this.method.resolveType(typeRef, true);
|
| if (type.get$isTop()) {
|
| type = type.get$library().findTypeByName$1(constructorName);
|
| - constructorName = '';
|
| + constructorName = "";
|
| }
|
| if ((type instanceof ParameterType)) {
|
| - $globals.world.error('cannot instantiate a type parameter', node.span);
|
| + $globals.world.error("cannot instantiate a type parameter", node.span);
|
| return this._makeMissingValue(constructorName);
|
| }
|
| var m = type.getConstructor$1(constructorName);
|
| @@ -4190,18 +4194,18 @@ MethodGenerator.prototype.visitNewExpression = function(node) {
|
| if (type.get$isVar()) {
|
| name = typeRef.get$name().get$name();
|
| }
|
| - $globals.world.error(('no matching constructor for ' + name), node.span);
|
| + $globals.world.error(("no matching constructor for " + name), node.span);
|
| return this._makeMissingValue(name);
|
| }
|
| if (node.isConst) {
|
| if (!m.get$isConst()) {
|
| - $globals.world.error('can\'t use const on a non-const constructor', node.span);
|
| + $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.$index($$i);
|
| if (!this.visitValue(arg.get$value()).get$isConst()) {
|
| - $globals.world.error('const constructor expects const arguments', arg.get$span());
|
| + $globals.world.error("const constructor expects const arguments", arg.get$span());
|
| }
|
| }
|
| }
|
| @@ -4215,7 +4219,7 @@ MethodGenerator.prototype.visitListExpression = function(node) {
|
| if (node.type != null) {
|
| type = this.method.resolveType(node.type, true).get$typeArgsInOrder().$index(0);
|
| if (node.isConst && ((type instanceof ParameterType) || type.get$hasTypeParams())) {
|
| - $globals.world.error('type parameter cannot be used in const list literals');
|
| + $globals.world.error("type parameter cannot be used in const list literals");
|
| }
|
| }
|
| var $$list = node.values;
|
| @@ -4225,7 +4229,7 @@ MethodGenerator.prototype.visitListExpression = function(node) {
|
| argValues.add$1(arg);
|
| if (node.isConst) {
|
| if (!arg.get$isConst()) {
|
| - $globals.world.error('const list can only contain const values', item.get$span());
|
| + $globals.world.error("const list can only contain const values", item.get$span());
|
| argsCode.add$1(arg.get$code());
|
| }
|
| else {
|
| @@ -4237,19 +4241,19 @@ MethodGenerator.prototype.visitListExpression = function(node) {
|
| }
|
| }
|
| $globals.world.listFactoryType.markUsed();
|
| - var code = ('[' + Strings.join(argsCode, ", ") + ']');
|
| + var code = ("[" + Strings.join(argsCode, ", ") + "]");
|
| var value = new Value($globals.world.listType, code, node.span, true);
|
| if (node.isConst) {
|
| var immutableList = $globals.world.immutableListType;
|
| - var immutableListCtor = immutableList.getConstructor('from');
|
| + var immutableListCtor = immutableList.getConstructor("from");
|
| var result = immutableListCtor.invoke$4(this, node, new Value.type$ctor(value.get$type(), node.span), new Arguments(null, [value]));
|
| - value = $globals.world.gen.globalForConst(ConstListValue.ConstListValue$factory(immutableList, argValues, ('const ' + code), result.get$code(), node.span), argValues);
|
| + value = $globals.world.gen.globalForConst(ConstListValue.ConstListValue$factory(immutableList, argValues, ("const " + code), result.get$code(), node.span), argValues);
|
| }
|
| return value;
|
| }
|
| MethodGenerator.prototype.visitMapExpression = function(node) {
|
| if (node.items.get$length() == 0 && !node.isConst) {
|
| - return $globals.world.mapType.getConstructor('').invoke$4(this, node, new Value.type$ctor($globals.world.mapType, node.span), Arguments.get$EMPTY());
|
| + return $globals.world.mapType.getConstructor("").invoke$4(this, node, new Value.type$ctor($globals.world.mapType, node.span), Arguments.get$EMPTY());
|
| }
|
| var argValues = [];
|
| var argsCode = [];
|
| @@ -4257,7 +4261,7 @@ MethodGenerator.prototype.visitMapExpression = function(node) {
|
| if (node.type != null) {
|
| type = this.method.resolveType(node.type, true).get$typeArgsInOrder().$index(1);
|
| if (node.isConst && ((type instanceof ParameterType) || type.get$hasTypeParams())) {
|
| - $globals.world.error('type parameter cannot be used in const map literals');
|
| + $globals.world.error("type parameter cannot be used in const map literals");
|
| }
|
| }
|
| for (var i = 0;
|
| @@ -4269,7 +4273,7 @@ MethodGenerator.prototype.visitMapExpression = function(node) {
|
| argValues.add$1(value);
|
| if (node.isConst) {
|
| if (!key.get$isConst() || !value.get$isConst()) {
|
| - $globals.world.error('const map can only contain const values', valueItem.get$span());
|
| + $globals.world.error("const map can only contain const values", valueItem.get$span());
|
| argsCode.add$1(key.get$code());
|
| argsCode.add$1(value.get$code());
|
| }
|
| @@ -4283,10 +4287,10 @@ MethodGenerator.prototype.visitMapExpression = function(node) {
|
| argsCode.add$1(value.get$code());
|
| }
|
| }
|
| - var argList = ('[' + Strings.join(argsCode, ", ") + ']');
|
| + var argList = ("[" + Strings.join(argsCode, ", ") + "]");
|
| var items = new Value($globals.world.listType, argList, node.span, true);
|
| var tp = $globals.world.corelib.topType;
|
| - var f = node.isConst ? tp.getMember$1('_constMap') : tp.getMember$1('_map');
|
| + var f = node.isConst ? tp.getMember$1("_constMap") : tp.getMember$1("_map");
|
| var value = f.invoke(this, node, new Value.type$ctor(tp, null), new Arguments(null, [items]), false);
|
| if (node.isConst) {
|
| value = ConstMapValue.ConstMapValue$factory(value.get$type(), argValues, value.get$code(), value.get$code(), value.get$span());
|
| @@ -4300,7 +4304,7 @@ MethodGenerator.prototype.visitConditionalExpression = function(node) {
|
| var test = this.visitBool(node.test);
|
| var trueBranch = this.visitValue(node.trueBranch);
|
| var falseBranch = this.visitValue(node.falseBranch);
|
| - var code = ('' + test.get$code() + ' ? ' + trueBranch.get$code() + ' : ' + falseBranch.get$code());
|
| + var code = ("" + test.get$code() + " ? " + trueBranch.get$code() + " : " + falseBranch.get$code());
|
| return new Value(Type.union(trueBranch.get$type(), falseBranch.get$type()), code, node.span, true);
|
| }
|
| MethodGenerator.prototype.visitIsExpression = function(node) {
|
| @@ -4311,9 +4315,9 @@ MethodGenerator.prototype.visitIsExpression = function(node) {
|
| MethodGenerator.prototype.visitParenExpression = function(node) {
|
| var body = this.visitValue(node.body);
|
| if (body.get$isConst()) {
|
| - return EvaluatedValue.EvaluatedValue$factory(body.get$type(), body.get$actualValue(), ('(' + body.get$canonicalCode() + ')'), node.span);
|
| + return EvaluatedValue.EvaluatedValue$factory(body.get$type(), body.get$actualValue(), ("(" + body.get$canonicalCode() + ")"), node.span);
|
| }
|
| - return new Value(body.get$type(), ('(' + body.get$code() + ')'), node.span, true);
|
| + return new Value(body.get$type(), ("(" + body.get$code() + ")"), node.span, true);
|
| }
|
| MethodGenerator.prototype.visitDotExpression = function(node) {
|
| var target = node.self.visit(this);
|
| @@ -4326,7 +4330,7 @@ MethodGenerator.prototype.visitVarExpression = function(node) {
|
| return this._makeThisOrType(node.span).get_$3(this, name, node);
|
| }
|
| MethodGenerator.prototype._makeMissingValue = function(name) {
|
| - return new Value($globals.world.varType, ('' + name + '()/*NotFound*/'), null, true);
|
| + return new Value($globals.world.varType, ("" + name + "()/*NotFound*/"), null, true);
|
| }
|
| MethodGenerator.prototype._makeThisOrType = function(span) {
|
| return new BareValue(this, this._getOutermostMethod(), span);
|
| @@ -4337,8 +4341,8 @@ MethodGenerator.prototype.visitThisExpression = function(node) {
|
| MethodGenerator.prototype.visitSuperExpression = function(node) {
|
| return this._makeSuperValue(node);
|
| }
|
| -MethodGenerator.prototype.visitNullExpression = function(node) {
|
| - return EvaluatedValue.EvaluatedValue$factory($globals.world.varType, null, 'null', null);
|
| +MethodGenerator.prototype.visitLiteralExpression = function(node) {
|
| + return node.value;
|
| }
|
| MethodGenerator.prototype._isUnaryIncrement = function(item) {
|
| if ((item instanceof UnaryExpression)) {
|
| @@ -4349,48 +4353,22 @@ MethodGenerator.prototype._isUnaryIncrement = function(item) {
|
| return false;
|
| }
|
| }
|
| -MethodGenerator.prototype.visitLiteralExpression = function(node) {
|
| - var $0;
|
| - var type = node.type.type;
|
| - if (!!(($0 = node.value) && $0.is$List())) {
|
| - var items = [];
|
| - var $$list = node.value;
|
| - for (var $$i = node.value.iterator$0(); $$i.hasNext$0(); ) {
|
| - var item = $$i.next$0();
|
| - var val = this.visitValue(item);
|
| - val.invoke$4(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);
|
| - }
|
| - }
|
| - return new Value(type, ('(' + Strings.join(items, " + ") + ')'), node.span, true);
|
| - }
|
| - if ((typeof(node.value) == 'number')) {
|
| - $globals.world.numImplType.markUsed();
|
| - }
|
| - var text = node.text;
|
| - if (type.get$isString()) {
|
| - $globals.world.stringImplType.markUsed();
|
| - if (text.startsWith$1('@')) {
|
| - text = MethodGenerator._escapeString(parseStringLiteral(text));
|
| - text = ('"' + text + '"');
|
| - }
|
| - else if (isMultilineString(text)) {
|
| - text = parseStringLiteral(text);
|
| - text = text.replaceAll$2('\n', '\\n');
|
| - text = toDoubleQuote(text);
|
| - text = ('"' + text + '"');
|
| +MethodGenerator.prototype.visitStringInterpExpression = function(node) {
|
| + var items = [];
|
| + var $$list = node.pieces;
|
| + for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
|
| + var item = $$list.$index($$i);
|
| + var val = this.visitValue(item);
|
| + val.invoke$4(this, "toString", item, Arguments.get$EMPTY());
|
| + var code = val.get$code();
|
| + if (this._expressionNeedsParens(item)) {
|
| + code = ("(" + code + ")");
|
| }
|
| - if (text !== node.text) {
|
| - node.value = text;
|
| - node.text = text;
|
| + if ($eq(items.get$length(), 0) || ($ne(code, "''") && $ne(code, "\"\""))) {
|
| + items.add$1(code);
|
| }
|
| }
|
| - return EvaluatedValue.EvaluatedValue$factory(type, node.value, node.text, null);
|
| + return new Value($globals.world.stringType, ("(" + Strings.join(items, " + ") + ")"), node.span, true);
|
| }
|
| MethodGenerator.prototype._checkNonStatic$1 = MethodGenerator.prototype._checkNonStatic;
|
| MethodGenerator.prototype.visitBinaryExpression$1 = function($0) {
|
| @@ -4410,7 +4388,7 @@ Arguments.Arguments$bare$factory = function(arity) {
|
| var values = [];
|
| for (var i = 0;
|
| i < arity; i++) {
|
| - values.add$1(new Value($globals.world.varType, ('\$' + i), null, false));
|
| + values.add$1(new Value($globals.world.varType, ("$" + i), null, false));
|
| }
|
| return new Arguments(null, values);
|
| }
|
| @@ -4472,7 +4450,7 @@ Arguments.prototype.getCode = function() {
|
| return Strings.join(argsCode, ", ");
|
| }
|
| Arguments.removeTrailingNulls = function(argsCode) {
|
| - while (argsCode.get$length() > 0 && $eq(argsCode.last(), 'null')) {
|
| + while (argsCode.get$length() > 0 && $eq(argsCode.last(), "null")) {
|
| argsCode.removeLast();
|
| }
|
| }
|
| @@ -4488,12 +4466,12 @@ Arguments.prototype.toCallStubArgs = function() {
|
| var result = [];
|
| for (var i = 0;
|
| i < this.get$bareCount(); i++) {
|
| - result.add$1(new Value($globals.world.varType, ('\$' + i), null, false));
|
| + result.add$1(new Value($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);
|
| + if (name == null) name = ("$" + i);
|
| result.add$1(new Value($globals.world.varType, name, null, false));
|
| }
|
| return new Arguments(this.nodes, result);
|
| @@ -4517,7 +4495,7 @@ function Library(baseSource) {
|
| Element.call(this, null, null);
|
| this.sourceDir = dirname(this.baseSource.filename);
|
| this.topType = new DefinedType(null, this, null, true);
|
| - this.types = _map(['', this.topType]);
|
| + this.types = _map(["", this.topType]);
|
| this.imports = [];
|
| this.natives = [];
|
| this.sources = [];
|
| @@ -4554,10 +4532,10 @@ Library.prototype.get$span = function() {
|
| return new SourceSpan(this.baseSource, 0, 0);
|
| }
|
| Library.prototype.makeFullPath = function(filename) {
|
| - if (filename.startsWith('dart:')) return filename;
|
| - if (filename.startsWith('/')) return filename;
|
| - if (filename.startsWith('file:///')) return filename;
|
| - if (filename.startsWith('http://')) return filename;
|
| + if (filename.startsWith("dart:")) return filename;
|
| + if (filename.startsWith("/")) return filename;
|
| + if (filename.startsWith("file:///")) return filename;
|
| + if (filename.startsWith("http://")) return filename;
|
| return joinPaths(this.sourceDir, filename);
|
| }
|
| Library.prototype.addImport = function(fullname, prefix) {
|
| @@ -4569,7 +4547,7 @@ Library.prototype.addNative = function(fullname) {
|
| this.natives.add($globals.world.reader.readFile(fullname));
|
| }
|
| Library.prototype._findMembers = function(name) {
|
| - if (name.startsWith('_')) {
|
| + if (name.startsWith("_")) {
|
| return this._privateMembers.$index(name);
|
| }
|
| else {
|
| @@ -4590,7 +4568,7 @@ Library.prototype._addMember = function(member) {
|
| for (var $$i = $globals.world.libraries.getValues().iterator$0(); $$i.hasNext$0(); ) {
|
| var lib = $$i.next$0();
|
| if (lib.get$_privateMembers().containsKey$1(member.get$jsname())) {
|
| - member._jsname = ('_' + this.get$jsname() + member.get$jsname());
|
| + member._jsname = ("_" + this.get$jsname() + member.get$jsname());
|
| break;
|
| }
|
| }
|
| @@ -4608,8 +4586,8 @@ Library.prototype._addMember = function(member) {
|
| Library.prototype.getOrAddFunctionType = function(enclosingElement, name, func) {
|
| var def = new FunctionTypeDefinition(func, null, func.span);
|
| var type = new DefinedType(name, this, def, false);
|
| - type.addMethod(':call', func);
|
| - var m = type.members.$index(':call');
|
| + type.addMethod(":call", func);
|
| + var m = type.members.$index(":call");
|
| m.set$enclosingElement(enclosingElement);
|
| m.resolve$0();
|
| type.interfaces = [$globals.world.functionType];
|
| @@ -4622,7 +4600,7 @@ Library.prototype.addType = function(name, definition, isClass) {
|
| existingType.setDefinition$1(definition);
|
| }
|
| else {
|
| - $globals.world.warning(('duplicate definition of ' + name), definition.span, existingType.get$span());
|
| + $globals.world.warning(("duplicate definition of " + name), definition.span, existingType.get$span());
|
| }
|
| }
|
| else {
|
| @@ -4658,7 +4636,7 @@ Library.prototype.findTypeByName = function(name) {
|
| }
|
| if (newRet != null) {
|
| if (ret != null && $ne(ret, newRet)) {
|
| - $globals.world.error(('conflicting types for "' + name + '"'), ret.get$span(), newRet.get$span());
|
| + $globals.world.error(("conflicting types for \"" + name + "\""), ret.get$span(), newRet.get$span());
|
| }
|
| else {
|
| ret = newRet;
|
| @@ -4672,7 +4650,7 @@ Library.prototype.resolveType = function(node, typeErrors) {
|
| if (node.type != null) return node.type;
|
| node.type = this.findType(node);
|
| if (node.type == null) {
|
| - var message = ('cannot find type ' + Library._getDottedName(node));
|
| + var message = ("cannot find type " + Library._getDottedName(node));
|
| if (typeErrors) {
|
| $globals.world.error(message, node.span);
|
| node.type = $globals.world.objectType;
|
| @@ -4690,7 +4668,7 @@ Library._getDottedName = function(type) {
|
| return n.get$name();
|
| })
|
| );
|
| - return type.name.name + '.' + Strings.join(names, '.');
|
| + return type.name.name + "." + Strings.join(names, ".");
|
| }
|
| else {
|
| return type.name.name;
|
| @@ -4705,7 +4683,7 @@ Library.prototype.lookup = function(name, span) {
|
| var newRet = this.topType.getMember(name);
|
| if (newRet != null) {
|
| if (ret != null && $ne(ret, newRet)) {
|
| - $globals.world.error(('conflicting members for "' + name + '"'), span, ret.get$span(), newRet.get$span());
|
| + $globals.world.error(("conflicting members for \"" + name + "\""), span, ret.get$span(), newRet.get$span());
|
| }
|
| else {
|
| ret = newRet;
|
| @@ -4718,7 +4696,7 @@ Library.prototype.lookup = function(name, span) {
|
| newRet = imported.get$library().get$topType().getMember$1(name);
|
| if (newRet != null) {
|
| if (ret != null && $ne(ret, newRet)) {
|
| - $globals.world.error(('conflicting members for "' + name + '"'), span, ret.get$span(), newRet.get$span());
|
| + $globals.world.error(("conflicting members for \"" + name + "\""), span, ret.get$span(), newRet.get$span());
|
| }
|
| else {
|
| ret = newRet;
|
| @@ -4731,16 +4709,16 @@ Library.prototype.lookup = function(name, span) {
|
| Library.prototype.resolve = function() {
|
| if (this.name == null) {
|
| this.name = this.baseSource.filename;
|
| - var index = this.name.lastIndexOf('/', this.name.length);
|
| + var index = this.name.lastIndexOf("/", this.name.length);
|
| if (index >= 0) {
|
| this.name = this.name.substring(index + 1);
|
| }
|
| - index = this.name.indexOf('.');
|
| + index = this.name.indexOf(".");
|
| if (index > 0) {
|
| this.name = this.name.substring(0, index);
|
| }
|
| }
|
| - this._jsname = this.name.replaceAll('.', '_').replaceAll(':', '_').replaceAll(' ', '_');
|
| + this._jsname = this.name.replaceAll(".", "_").replaceAll(":", "_").replaceAll(" ", "_");
|
| var $$list = this.types.getValues();
|
| for (var $$i = this.types.getValues().iterator$0(); $$i.hasNext$0(); ) {
|
| var type = $$i.next$0();
|
| @@ -4782,14 +4760,14 @@ _LibraryVisitor.prototype.set$isTop = function(value) { return this.isTop = valu
|
| _LibraryVisitor.prototype.addSourceFromName = function(name, span) {
|
| var filename = this.library.makeFullPath(name);
|
| if ($eq(filename, this.library.baseSource.filename)) {
|
| - $globals.world.error('library can not source itself', span);
|
| + $globals.world.error("library can not source itself", span);
|
| return;
|
| }
|
| else if (this.sources.some((function (s) {
|
| return $eq(s.get$filename(), filename);
|
| })
|
| )) {
|
| - $globals.world.error(('file "' + filename + '" has already been sourced'), span);
|
| + $globals.world.error(("file \"" + filename + "\" has already been sourced"), span);
|
| return;
|
| }
|
| var source = $globals.world.readFile(this.library.makeFullPath(name));
|
| @@ -4801,7 +4779,7 @@ _LibraryVisitor.prototype.addSource = function(source) {
|
| return $eq(s.get$filename(), source.filename);
|
| })
|
| )) {
|
| - $globals.world.error(('duplicate source file "' + source.filename + '"'));
|
| + $globals.world.error(("duplicate source file \"" + source.filename + "\""));
|
| return;
|
| }
|
| this.library.sources.add(source);
|
| @@ -4821,7 +4799,7 @@ _LibraryVisitor.prototype.addSource = function(source) {
|
| }
|
| _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) {
|
| if (!this.isTop) {
|
| - $globals.world.error('directives not allowed in sourced file', node.span);
|
| + $globals.world.error("directives not allowed in sourced file", node.span);
|
| return;
|
| }
|
| var name;
|
| @@ -4831,15 +4809,15 @@ _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) {
|
| name = this.getSingleStringArg(node);
|
| if (this.library.name == null) {
|
| this.library.name = name;
|
| - if ($eq(name, 'node') || $eq(name, 'dom')) {
|
| + if ($eq(name, "node") || $eq(name, "dom")) {
|
| this.library.topType.isNative = true;
|
| }
|
| if (this.seenImport || this.seenSource || this.seenResource) {
|
| - $globals.world.error('#library must be first directive in file', node.span);
|
| + $globals.world.error("#library must be first directive in file", node.span);
|
| }
|
| }
|
| else {
|
| - $globals.world.error('already specified library name', node.span);
|
| + $globals.world.error("already specified library name", node.span);
|
| }
|
| break;
|
|
|
| @@ -4847,23 +4825,23 @@ _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) {
|
|
|
| this.seenImport = true;
|
| name = this.getFirstStringArg(node);
|
| - var prefix = this.tryGetNamedStringArg(node, 'prefix');
|
| + 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);
|
| + $globals.world.error("expected at most one \"name\" argument and one optional \"prefix\"" + (" but found " + node.arguments.get$length()), node.span);
|
| }
|
| - else if (prefix != null && prefix.indexOf$1('.') >= 0) {
|
| - $globals.world.error('library prefix canot contain "."', node.span);
|
| + else if (prefix != null && prefix.indexOf$1(".") >= 0) {
|
| + $globals.world.error("library prefix canot contain \".\"", node.span);
|
| }
|
| else if (this.seenSource || this.seenResource) {
|
| - $globals.world.error('#imports must come before any #source or #resource', node.span);
|
| + $globals.world.error("#imports must come before any #source or #resource", node.span);
|
| }
|
| - if ($eq(prefix, '')) prefix = null;
|
| + 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);
|
| })
|
| )) {
|
| - $globals.world.error(('duplicate import of "' + name + '"'), node.span);
|
| + $globals.world.error(("duplicate import of \"" + name + "\""), node.span);
|
| return;
|
| }
|
| var newLib = this.library.addImport(filename, prefix);
|
| @@ -4875,7 +4853,7 @@ _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) {
|
| name = this.getSingleStringArg(node);
|
| this.addSourceFromName(name, node.span);
|
| if (this.seenResource) {
|
| - $globals.world.error('#sources must come before any #resource', node.span);
|
| + $globals.world.error("#sources must come before any #resource", node.span);
|
| }
|
| break;
|
|
|
| @@ -4893,23 +4871,23 @@ _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) {
|
|
|
| default:
|
|
|
| - $globals.world.error(('unknown directive: ' + node.name.name), node.span);
|
| + $globals.world.error(("unknown directive: " + node.name.name), node.span);
|
|
|
| }
|
| }
|
| _LibraryVisitor.prototype.getSingleStringArg = function(node) {
|
| if (node.arguments.get$length() != 1) {
|
| - $globals.world.error(('expected exactly one argument but found ' + node.arguments.get$length()), node.span);
|
| + $globals.world.error(("expected exactly one argument but found " + node.arguments.get$length()), node.span);
|
| }
|
| return this.getFirstStringArg(node);
|
| }
|
| _LibraryVisitor.prototype.getFirstStringArg = function(node) {
|
| if (node.arguments.get$length() < 1) {
|
| - $globals.world.error(('expected at least one argument but found ' + node.arguments.get$length()), node.span);
|
| + $globals.world.error(("expected at least one argument but found " + node.arguments.get$length()), node.span);
|
| }
|
| var arg = node.arguments.$index(0);
|
| if (arg.get$label() != null) {
|
| - $globals.world.error('label not allowed for directive', node.span);
|
| + $globals.world.error("label not allowed for directive", node.span);
|
| }
|
| return this._parseStringArgument(arg);
|
| }
|
| @@ -4922,7 +4900,7 @@ _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) {
|
| return null;
|
| }
|
| if (args.get$length() > 1) {
|
| - $globals.world.error(('expected at most one "' + argName + '" argument but found ') + node.arguments.get$length(), node.span);
|
| + $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();
|
| @@ -4931,10 +4909,10 @@ _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) {
|
| }
|
| _LibraryVisitor.prototype._parseStringArgument = function(arg) {
|
| var expr = arg.value;
|
| - if (!(expr instanceof LiteralExpression) || !expr.get$type().get$type().get$isString()) {
|
| - $globals.world.error('expected string', expr.get$span());
|
| + if (!(expr instanceof LiteralExpression) || !expr.get$value().get$type().get$isString()) {
|
| + $globals.world.error("expected string literal", expr.get$span());
|
| }
|
| - return parseStringLiteral(expr.get$value());
|
| + return expr.get$value().get$actualValue();
|
| }
|
| _LibraryVisitor.prototype.visitTypeDefinition = function(node) {
|
| var oldType = this.currentType;
|
| @@ -4954,7 +4932,7 @@ _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$2(":call", node.func);
|
| }
|
| _LibraryVisitor.prototype.addSource$1 = _LibraryVisitor.prototype.addSource;
|
| // ********** Code for Parameter **************
|
| @@ -4978,24 +4956,26 @@ Parameter.prototype.get$value = function() { return this.value; };
|
| Parameter.prototype.set$value = function(value) { return this.value = value; };
|
| Parameter.prototype.resolve = function() {
|
| this.name = this.definition.name.name;
|
| - if (this.name.startsWith('this.')) {
|
| + if (this.name.startsWith("this.")) {
|
| this.name = this.name.substring(5);
|
| this.isInitializer = true;
|
| }
|
| this.type = this.method.resolveType(this.definition.type, false);
|
| if (this.definition.value != null) {
|
| - if (!this.get$hasDefaultValue()) return;
|
| - if (this.method.name == ':call') {
|
| + if (this.definition.value.span.start == this.definition.span.start) {
|
| + return;
|
| + }
|
| + if (this.method.name == ":call") {
|
| if (this.method.get$definition().get$body() == null && !this.method.get$isNative()) {
|
| - $globals.world.error('default value not allowed on function type', this.definition.span);
|
| + $globals.world.error("default value not allowed on function type", this.definition.span);
|
| }
|
| }
|
| else if (this.method.get$isAbstract()) {
|
| - $globals.world.error('default value not allowed on abstract methods', this.definition.span);
|
| + $globals.world.error("default value not allowed on abstract methods", this.definition.span);
|
| }
|
| }
|
| else if (this.isInitializer && !this.method.get$isConstructor()) {
|
| - $globals.world.error('initializer parameters only allowed on constructors', this.definition.span);
|
| + $globals.world.error("initializer parameters only allowed on constructors", this.definition.span);
|
| }
|
| }
|
| Parameter.prototype.genValue = function(method, context) {
|
| @@ -5005,7 +4985,7 @@ Parameter.prototype.genValue = function(method, context) {
|
| }
|
| this.value = this.definition.value.visit(context);
|
| if (!this.value.get$isConst()) {
|
| - $globals.world.error('default parameter values must be constant', this.value.span);
|
| + $globals.world.error("default parameter values must be constant", this.value.span);
|
| }
|
| this.value = this.value.convertTo(context, this.type, false);
|
| }
|
| @@ -5019,9 +4999,6 @@ Parameter.prototype.copyWithNewType = function(newMethod, newType) {
|
| Parameter.prototype.get$isOptional = function() {
|
| return this.definition != null && this.definition.value != null;
|
| }
|
| -Parameter.prototype.get$hasDefaultValue = function() {
|
| - return !(this.definition.value instanceof NullExpression) || (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;
|
| @@ -5044,7 +5021,7 @@ Member.prototype.get$library = function() {
|
| return this.declaringType.get$library();
|
| }
|
| Member.prototype.get$isPrivate = function() {
|
| - return this.name.startsWith('_');
|
| + return this.name.startsWith("_");
|
| }
|
| Member.prototype.get$isConstructor = function() {
|
| return false;
|
| @@ -5071,10 +5048,10 @@ Member.prototype.get$isFactory = function() {
|
| return false;
|
| }
|
| Member.prototype.get$isOperator = function() {
|
| - return this.name.startsWith(':');
|
| + return this.name.startsWith(":");
|
| }
|
| Member.prototype.get$isCallMethod = function() {
|
| - return this.name == ':call';
|
| + return this.name == ":call";
|
| }
|
| Member.prototype.get$requiresPropertySyntax = function() {
|
| return false;
|
| @@ -5086,7 +5063,7 @@ Member.prototype.get$isNative = function() {
|
| return false;
|
| }
|
| Member.prototype.get$constructorName = function() {
|
| - $globals.world.internalError('can not be a constructor', this.get$span());
|
| + $globals.world.internalError("can not be a constructor", this.get$span());
|
| }
|
| Member.prototype.provideFieldSyntax = function() {
|
|
|
| @@ -5095,13 +5072,13 @@ Member.prototype.providePropertySyntax = function() {
|
|
|
| }
|
| Member.prototype.get$initDelegate = function() {
|
| - $globals.world.internalError('cannot have initializers', this.get$span());
|
| + $globals.world.internalError("cannot have initializers", this.get$span());
|
| }
|
| Member.prototype.set$initDelegate = function(ctor) {
|
| - $globals.world.internalError('cannot have initializers', this.get$span());
|
| + $globals.world.internalError("cannot have initializers", this.get$span());
|
| }
|
| Member.prototype.computeValue = function() {
|
| - $globals.world.internalError('cannot have value', this.get$span());
|
| + $globals.world.internalError("cannot have value", this.get$span());
|
| }
|
| Member.prototype.get$inferredResult = function() {
|
| var t = this.get$returnType();
|
| @@ -5117,30 +5094,30 @@ Member.prototype.get$parameters = function() {
|
| return [];
|
| }
|
| Member.prototype.canInvoke = function(context, args) {
|
| - return this.get$canGet() && new Value(this.get$returnType(), null, null, true).canInvoke(context, ':call', args);
|
| + return this.get$canGet() && new Value(this.get$returnType(), null, null, true).canInvoke(context, ":call", args);
|
| }
|
| 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);
|
| + return newTarget.invoke$5(context, ":call", node, args, isDynamic);
|
| }
|
| Member.prototype.override = function(other) {
|
| if (this.get$isStatic()) {
|
| - $globals.world.error('static members can not hide parent members', this.get$span(), other.get$span());
|
| + $globals.world.error("static members can not hide parent members", this.get$span(), other.get$span());
|
| return false;
|
| }
|
| else if (other.get$isStatic()) {
|
| - $globals.world.error('can not override static member', this.get$span(), other.get$span());
|
| + $globals.world.error("can not override static member", this.get$span(), other.get$span());
|
| return false;
|
| }
|
| return true;
|
| }
|
| Member.prototype.get$generatedFactoryName = function() {
|
| - var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructorName() + '\$');
|
| - if (this.name == '') {
|
| - return ('' + prefix + 'factory');
|
| + var prefix = ("" + this.declaringType.get$jsname() + "." + this.get$constructorName() + "$");
|
| + if (this.name == "") {
|
| + return ("" + prefix + "factory");
|
| }
|
| else {
|
| - return ('' + prefix + this.name + '\$factory');
|
| + return ("" + prefix + this.name + "$factory");
|
| }
|
| }
|
| Member.prototype.hashCode = function() {
|
| @@ -5200,10 +5177,10 @@ TypeMember.prototype._get = function(context, node, target, isDynamic) {
|
| return new Value.type$ctor(this.type, node.span);
|
| }
|
| TypeMember.prototype._set = function(context, node, target, value, isDynamic) {
|
| - $globals.world.error('cannot set type', node.span);
|
| + $globals.world.error("cannot set type", node.span);
|
| }
|
| TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) {
|
| - $globals.world.error('cannot invoke type', node.span);
|
| + $globals.world.error("cannot invoke type", node.span);
|
| }
|
| TypeMember.prototype._get$3 = function($0, $1, $2) {
|
| return this._get($0, $1, $2, false);
|
| @@ -5247,7 +5224,7 @@ FieldMember.prototype.override = function(other) {
|
| return true;
|
| }
|
| else {
|
| - $globals.world.error('field can not override anything but property', this.get$span(), other.get$span());
|
| + $globals.world.error("field can not override anything but property", this.get$span(), other.get$span());
|
| return false;
|
| }
|
| }
|
| @@ -5281,27 +5258,27 @@ FieldMember.prototype.resolve = function() {
|
| var mod = $$list.$index($$i);
|
| if ($eq(mod.get$kind(), 84/*TokenKind.STATIC*/)) {
|
| if (this.isStatic) {
|
| - $globals.world.error('duplicate static modifier', mod.get$span());
|
| + $globals.world.error("duplicate static modifier", mod.get$span());
|
| }
|
| this.isStatic = true;
|
| }
|
| else if ($eq(mod.get$kind(), 98/*TokenKind.FINAL*/)) {
|
| if (this.isFinal) {
|
| - $globals.world.error('duplicate final modifier', mod.get$span());
|
| + $globals.world.error("duplicate final modifier", mod.get$span());
|
| }
|
| this.isFinal = true;
|
| }
|
| else {
|
| - $globals.world.error(('' + mod + ' modifier not allowed on field'), mod.get$span());
|
| + $globals.world.error(("" + mod + " modifier not allowed on field"), mod.get$span());
|
| }
|
| }
|
| }
|
| this.type = this.resolveType(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);
|
| + $globals.world.error("using type parameter in static context", this.definition.type.span);
|
| }
|
| if (this.isStatic && this.isFinal && this.value == null) {
|
| - $globals.world.error('static final field is missing initializer', this.get$span());
|
| + $globals.world.error("static final field is missing initializer", this.get$span());
|
| }
|
| this.get$library()._addMember(this);
|
| }
|
| @@ -5309,20 +5286,20 @@ FieldMember.prototype.computeValue = function() {
|
| if (this.value == null) return null;
|
| if (this._computedValue == null) {
|
| if (this._computing) {
|
| - $globals.world.error('circular reference', this.value.span);
|
| + $globals.world.error("circular reference", this.value.span);
|
| return null;
|
| }
|
| this._computing = true;
|
| - var finalMethod = new MethodMember('final_context', this.declaringType, null);
|
| + var finalMethod = new MethodMember("final_context", this.declaringType, null);
|
| finalMethod.set$isStatic(true);
|
| var finalGen = new MethodGenerator(finalMethod, null);
|
| this._computedValue = this.value.visit(finalGen);
|
| if (!this._computedValue.get$isConst()) {
|
| if (this.isStatic) {
|
| - $globals.world.error('non constant static field must be initialized in functions', this.value.span);
|
| + $globals.world.error("non constant static field must be initialized in functions", this.value.span);
|
| }
|
| else {
|
| - $globals.world.error('non constant field must be initialized in constructor', this.value.span);
|
| + $globals.world.error("non constant field must be initialized in constructor", this.value.span);
|
| }
|
| }
|
| if (this.isStatic) {
|
| @@ -5351,20 +5328,20 @@ FieldMember.prototype._get = function(context, node, target, isDynamic) {
|
| $globals.world.gen.hasStatics = true;
|
| if (this.declaringType.get$isTop()) {
|
| if (this.declaringType.get$library().get$isDom()) {
|
| - return new Value(this.type, ('' + this.get$jsname()), node.span, true);
|
| + return new Value(this.type, ("" + this.get$jsname()), node.span, true);
|
| }
|
| else {
|
| - return new Value(this.type, ('\$globals.' + this.get$jsname()), node.span, true);
|
| + return new Value(this.type, ("$globals." + this.get$jsname()), node.span, true);
|
| }
|
| }
|
| else if (this.declaringType.get$isNative()) {
|
| if (this.declaringType.get$isHiddenNativeType()) {
|
| - $globals.world.error('static field of hidden native type is inaccessible', node.span);
|
| + $globals.world.error("static field of hidden native type is inaccessible", node.span);
|
| }
|
| - return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname()), node.span, true);
|
| + return new Value(this.type, ("" + this.declaringType.get$jsname() + "." + this.get$jsname()), node.span, true);
|
| }
|
| else {
|
| - return new Value(this.type, ('\$globals.' + this.declaringType.get$jsname() + '_' + this.get$jsname()), node.span, true);
|
| + return new Value(this.type, ("$globals." + this.declaringType.get$jsname() + "_" + this.get$jsname()), node.span, true);
|
| }
|
| }
|
| else if (target.get$isConst() && this.isFinal) {
|
| @@ -5372,16 +5349,16 @@ FieldMember.prototype._get = function(context, node, target, isDynamic) {
|
| if ((constTarget instanceof ConstObjectValue)) {
|
| return constTarget.get$fields().$index(this.name);
|
| }
|
| - else if ($eq(constTarget.get$type(), $globals.world.stringType) && this.name == 'length') {
|
| - return new Value(this.type, ('' + constTarget.get$actualValue().get$length()), node.span, true);
|
| + else if ($eq(constTarget.get$type(), $globals.world.stringType) && this.name == "length") {
|
| + return new Value(this.type, ("" + constTarget.get$actualValue().get$length()), node.span, true);
|
| }
|
| }
|
| - return new Value(this.type, ('' + target.code + '.' + this.get$jsname()), node.span, true);
|
| + return new Value(this.type, ("" + target.code + "." + this.get$jsname()), node.span, true);
|
| }
|
| FieldMember.prototype._set = function(context, node, target, value, isDynamic) {
|
| var lhs = this._get(context, node, target, isDynamic);
|
| value = value.convertTo(context, this.type, isDynamic);
|
| - return new Value(this.type, ('' + lhs.get$code() + ' = ' + value.code), node.span, true);
|
| + return new Value(this.type, ("" + lhs.get$code() + " = " + value.code), node.span, true);
|
| }
|
| FieldMember.prototype._get$3 = function($0, $1, $2) {
|
| return this._get($0, $1, $2, false);
|
| @@ -5444,7 +5421,7 @@ PropertyMember.prototype.override = function(other) {
|
| return true;
|
| }
|
| else {
|
| - $globals.world.error('property can only override field or property', this.get$span(), other.get$span());
|
| + $globals.world.error("property can only override field or property", this.get$span(), other.get$span());
|
| return false;
|
| }
|
| }
|
| @@ -5453,7 +5430,7 @@ PropertyMember.prototype._get = function(context, node, target, isDynamic) {
|
| if (this._overriddenField != null) {
|
| return this._overriddenField._get(context, node, target, isDynamic);
|
| }
|
| - return target.invokeNoSuchMethod(context, ('get:' + this.name), node);
|
| + return target.invokeNoSuchMethod(context, ("get:" + this.name), node);
|
| }
|
| return this.getter.invoke(context, node, target, Arguments.get$EMPTY(), false);
|
| }
|
| @@ -5462,7 +5439,7 @@ PropertyMember.prototype._set = function(context, node, target, value, isDynamic
|
| if (this._overriddenField != null) {
|
| return this._overriddenField._set(context, node, target, value, isDynamic);
|
| }
|
| - return target.invokeNoSuchMethod(context, ('set:' + this.name), node, new Arguments(null, [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);
|
| }
|
| @@ -5482,19 +5459,19 @@ PropertyMember.prototype.resolve = function() {
|
| if (this.getter != null) {
|
| this.getter.resolve();
|
| if (this.getter.parameters.get$length() != 0) {
|
| - $globals.world.error('getter methods should take no arguments', this.getter.definition.span);
|
| + $globals.world.error("getter methods should take no arguments", this.getter.definition.span);
|
| }
|
| if (this.getter.returnType.get$isVoid()) {
|
| - $globals.world.warning('getter methods should not be void', this.getter.definition.returnType.span);
|
| + $globals.world.warning("getter methods should not be void", this.getter.definition.returnType.span);
|
| }
|
| }
|
| if (this.setter != null) {
|
| this.setter.resolve();
|
| if (this.setter.parameters.get$length() != 1) {
|
| - $globals.world.error('setter methods should take a single argument', this.setter.definition.span);
|
| + $globals.world.error("setter methods should take a single argument", this.setter.definition.span);
|
| }
|
| if (!this.setter.returnType.get$isVoid() && this.setter.definition.returnType != null) {
|
| - $globals.world.warning('setter methods should be void', this.setter.definition.returnType.span);
|
| + $globals.world.warning("setter methods should be void", this.setter.definition.returnType.span);
|
| }
|
| }
|
| this.get$library()._addMember(this);
|
| @@ -5707,9 +5684,9 @@ MethodMember.prototype.get$span = function() {
|
| }
|
| MethodMember.prototype.get$constructorName = function() {
|
| var returnType = this.definition.returnType;
|
| - if (returnType == null) return '';
|
| + if (returnType == null) return "";
|
| if ((returnType instanceof GenericTypeReference)) {
|
| - return '';
|
| + return "";
|
| }
|
| if (returnType.get$names() != null) {
|
| return returnType.get$names().$index(0).get$name();
|
| @@ -5717,7 +5694,7 @@ MethodMember.prototype.get$constructorName = function() {
|
| else if (returnType.get$name() != null) {
|
| return returnType.get$name().get$name();
|
| }
|
| - $globals.world.internalError('no valid constructor name', this.definition.span);
|
| + $globals.world.internalError("no valid constructor name", this.definition.span);
|
| }
|
| MethodMember.prototype.get$functionType = function() {
|
| if (this._functionType == null) {
|
| @@ -5734,7 +5711,7 @@ MethodMember.prototype.override = function(other) {
|
| return true;
|
| }
|
| else {
|
| - $globals.world.error('method can only override methods', this.get$span(), other.get$span());
|
| + $globals.world.error("method can only override methods", this.get$span(), other.get$span());
|
| return false;
|
| }
|
| }
|
| @@ -5772,18 +5749,18 @@ MethodMember.prototype.providePropertySyntax = function() {
|
| this._providePropertySyntax = true;
|
| }
|
| MethodMember.prototype._set = function(context, node, target, value, isDynamic) {
|
| - $globals.world.error('cannot set method', node.span);
|
| + $globals.world.error("cannot set method", node.span);
|
| }
|
| MethodMember.prototype._get = function(context, node, target, isDynamic) {
|
| this.declaringType.genMethod(this);
|
| this._provideOptionalParamInfo = true;
|
| if (this.isStatic) {
|
| this.declaringType.markUsed();
|
| - var type = this.declaringType.get$isTop() ? '' : ('' + this.declaringType.get$jsname() + '.');
|
| - return new Value(this.get$functionType(), ('' + type + this.get$jsname()), node.span, true);
|
| + var type = this.declaringType.get$isTop() ? "" : ("" + this.declaringType.get$jsname() + ".");
|
| + return new Value(this.get$functionType(), ("" + type + this.get$jsname()), node.span, true);
|
| }
|
| this._providePropertySyntax = true;
|
| - return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this.get$jsname() + '()'), node.span, true);
|
| + return new Value(this.get$functionType(), ("" + target.code + ".get$" + this.get$jsname() + "()"), node.span, true);
|
| }
|
| MethodMember.prototype.namesInHomePositions = function(args) {
|
| if (!args.get$hasNames()) return true;
|
| @@ -5835,7 +5812,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 "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;
|
| @@ -5862,7 +5839,7 @@ MethodMember.prototype.genParameterValues = function() {
|
| }
|
| 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));
|
| + $globals.world.info(("surprised to need to resolve: " + this.declaringType.name + "." + this.name));
|
| this.resolve();
|
| }
|
| this.declaringType.genMethod(this);
|
| @@ -5875,7 +5852,7 @@ MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
|
| }
|
| var argsCode = [];
|
| if (!target.isType && (this.get$isConstructor() || target.isSuper)) {
|
| - argsCode.add$1('this');
|
| + argsCode.add$1("this");
|
| }
|
| var bareCount = args.get$bareCount();
|
| for (var i = 0;
|
| @@ -5922,55 +5899,55 @@ MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
|
| 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);
|
| + return this._argError(context, node, target, args, ("duplicate argument \"" + name + "\""), i);
|
| }
|
| seen.add$1(name);
|
| var p = this.indexOfParameter(name);
|
| if (p < 0) {
|
| - return this._argError(context, node, target, args, ('method does not have optional parameter "' + name + '"'), i);
|
| + return this._argError(context, node, target, args, ("method does not have optional parameter \"" + name + "\""), i);
|
| }
|
| else if (p < bareCount) {
|
| - return this._argError(context, node, target, args, ('argument "' + name + '" passed as positional and named'), p);
|
| + return this._argError(context, node, target, args, ("argument \"" + name + "\" passed as positional and named"), p);
|
| }
|
| }
|
| - $globals.world.internalError(('wrong named arguments calling ' + this.name), node.span);
|
| + $globals.world.internalError(("wrong named arguments calling " + this.name), node.span);
|
| }
|
| - var argsString = Strings.join(argsCode, ', ');
|
| + var argsString = Strings.join(argsCode, ", ");
|
| if (this.get$isConstructor()) {
|
| return this._invokeConstructor(context, node, target, args, argsString);
|
| }
|
| if (target.isSuper) {
|
| - return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsname() + '.prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.span, true);
|
| + return new Value(this.get$inferredResult(), ("" + this.declaringType.get$jsname() + ".prototype." + this.get$jsname() + ".call(" + argsString + ")"), node.span, true);
|
| }
|
| if (this.get$isOperator()) {
|
| return this._invokeBuiltin(context, node, target, args, argsCode, isDynamic);
|
| }
|
| if (this.isFactory) {
|
| - return new Value(target.get$type(), ('' + this.get$generatedFactoryName() + '(' + argsString + ')'), node.span, true);
|
| + return new Value(target.get$type(), ("" + this.get$generatedFactoryName() + "(" + argsString + ")"), node.span, true);
|
| }
|
| if (this.isStatic) {
|
| if (this.declaringType.get$isTop()) {
|
| - return new Value(this.get$inferredResult(), ('' + this.get$jsname() + '(' + argsString + ')'), node != null ? node.span : node, true);
|
| + return new Value(this.get$inferredResult(), ("" + this.get$jsname() + "(" + argsString + ")"), node != null ? node.span : node, true);
|
| }
|
| - return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, true);
|
| + return new Value(this.get$inferredResult(), ("" + this.declaringType.get$jsname() + "." + this.get$jsname() + "(" + argsString + ")"), node.span, true);
|
| }
|
| - var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')');
|
| + var code = ("" + target.code + "." + this.get$jsname() + "(" + argsString + ")");
|
| if (target.get$isConst()) {
|
| if ((target instanceof GlobalValue)) {
|
| target = target.get$dynamic().get$exp();
|
| }
|
| - if (this.name == 'get:length') {
|
| + if (this.name == "get:length") {
|
| if ((target instanceof ConstListValue) || (target instanceof ConstMapValue)) {
|
| - code = ('' + target.get$dynamic().get$values().get$length());
|
| + code = ("" + target.get$dynamic().get$values().get$length());
|
| }
|
| }
|
| - else if (this.name == 'isEmpty') {
|
| + else if (this.name == "isEmpty") {
|
| if ((target instanceof ConstListValue) || (target instanceof ConstMapValue)) {
|
| - code = ('' + target.get$dynamic().get$values().isEmpty$0());
|
| + code = ("" + target.get$dynamic().get$values().isEmpty$0());
|
| }
|
| }
|
| }
|
| - if (this.name == 'get:typeName' && this.declaringType.get$library().get$isDom()) {
|
| + if (this.name == "get:typeName" && this.declaringType.get$library().get$isDom()) {
|
| $globals.world.gen.corejs.ensureTypeNameOf();
|
| }
|
| return new Value(this.get$inferredResult(), code, node.span, true);
|
| @@ -5978,13 +5955,13 @@ MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
|
| MethodMember.prototype._invokeConstructor = function(context, node, target, args, argsString) {
|
| this.declaringType.markUsed();
|
| var ctor = this.get$constructorName();
|
| - if (ctor != '') ctor = ('.' + ctor + '\$ctor');
|
| + if (ctor != "") ctor = ("." + ctor + "$ctor");
|
| if (!target.isType) {
|
| - var code = ('' + this.declaringType.get$nativeName() + ctor + '.call(' + argsString + ')');
|
| + var code = ("" + this.declaringType.get$nativeName() + ctor + ".call(" + argsString + ")");
|
| return new Value(target.get$type(), code, node.span, true);
|
| }
|
| else {
|
| - var code = ('new ' + this.declaringType.get$nativeName() + ctor + '(' + argsString + ')');
|
| + var code = ("new " + this.declaringType.get$nativeName() + ctor + "(" + argsString + ")");
|
| if (this.isConst && (node instanceof NewExpression) && node.get$dynamic().get$isConst()) {
|
| return this._invokeConstConstructor(node, code, target, args);
|
| }
|
| @@ -6054,7 +6031,7 @@ MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar
|
| var fname = x.get$name().get$name();
|
| var val = this.generator.visitValue(assign.y);
|
| if (!val.get$isConst()) {
|
| - $globals.world.error('invalid non-const initializer in const constructor', assign.y.span);
|
| + $globals.world.error("invalid non-const initializer in const constructor", assign.y.span);
|
| }
|
| fields.$setindex(fname, val);
|
| }
|
| @@ -6066,7 +6043,7 @@ MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar
|
| var f = $$i.next$0();
|
| if ((f instanceof FieldMember) && !f.get$isStatic() && !fields.containsKey(f.get$name())) {
|
| if (!f.get$isFinal()) {
|
| - $globals.world.error(('const class "' + this.declaringType.name + '" has non-final ') + ('field "' + f.get$name() + '"'), f.get$span());
|
| + $globals.world.error(("const class \"" + this.declaringType.name + "\" has non-final ") + ("field \"" + f.get$name() + "\""), f.get$span());
|
| }
|
| if (f.get$value() != null) {
|
| fields.$setindex(f.get$name(), f.computeValue$0());
|
| @@ -6083,19 +6060,19 @@ MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
|
| if (this.declaringType.get$isNum()) {
|
| if (!allConst) {
|
| var code;
|
| - if (this.name == ':negate') {
|
| - code = ('-' + target.code);
|
| + if (this.name == ":negate") {
|
| + code = ("-" + target.code);
|
| }
|
| - else if (this.name == ':bit_not') {
|
| - code = ('~' + target.code);
|
| + else if (this.name == ":bit_not") {
|
| + code = ("~" + target.code);
|
| }
|
| - else if (this.name == ':truncdiv' || this.name == ':mod') {
|
| + else if (this.name == ":truncdiv" || this.name == ":mod") {
|
| $globals.world.gen.corejs.useOperator(this.name);
|
| - code = ('' + this.get$jsname() + '(' + target.code + ', ' + argsCode.$index(0) + ')');
|
| + code = ("" + this.get$jsname() + "(" + target.code + ", " + argsCode.$index(0) + ")");
|
| }
|
| else {
|
| var op = TokenKind.rawOperatorFromMethod(this.name);
|
| - code = ('' + target.code + ' ' + op + ' ' + argsCode.$index(0));
|
| + code = ("" + target.code + " " + op + " " + argsCode.$index(0));
|
| }
|
| return new Value(this.get$inferredResult(), code, node.span, true);
|
| }
|
| @@ -6109,102 +6086,102 @@ MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
|
| ival1 = val1.toInt();
|
| }
|
| switch (this.name) {
|
| - case ':negate':
|
| + case ":negate":
|
|
|
| value = -val0;
|
| break;
|
|
|
| - case ':add':
|
| + case ":add":
|
|
|
| value = val0 + val1;
|
| break;
|
|
|
| - case ':sub':
|
| + case ":sub":
|
|
|
| value = val0 - val1;
|
| break;
|
|
|
| - case ':mul':
|
| + case ":mul":
|
|
|
| value = val0 * val1;
|
| break;
|
|
|
| - case ':div':
|
| + case ":div":
|
|
|
| value = val0 / val1;
|
| break;
|
|
|
| - case ':truncdiv':
|
| + case ":truncdiv":
|
|
|
| value = $truncdiv(val0, val1);
|
| break;
|
|
|
| - case ':mod':
|
| + case ":mod":
|
|
|
| value = $mod(val0, val1);
|
| break;
|
|
|
| - case ':eq':
|
| + case ":eq":
|
|
|
| value = val0 == val1;
|
| break;
|
|
|
| - case ':lt':
|
| + case ":lt":
|
|
|
| value = val0 < val1;
|
| break;
|
|
|
| - case ':gt':
|
| + case ":gt":
|
|
|
| value = val0 > val1;
|
| break;
|
|
|
| - case ':lte':
|
| + case ":lte":
|
|
|
| value = val0 <= val1;
|
| break;
|
|
|
| - case ':gte':
|
| + case ":gte":
|
|
|
| value = val0 >= val1;
|
| break;
|
|
|
| - case ':ne':
|
| + case ":ne":
|
|
|
| value = val0 != val1;
|
| break;
|
|
|
| - case ':bit_not':
|
| + case ":bit_not":
|
|
|
| value = (~ival0).toDouble();
|
| break;
|
|
|
| - case ':bit_or':
|
| + case ":bit_or":
|
|
|
| value = (ival0 | ival1).toDouble();
|
| break;
|
|
|
| - case ':bit_xor':
|
| + case ":bit_xor":
|
|
|
| value = (ival0 ^ ival1).toDouble();
|
| break;
|
|
|
| - case ':bit_and':
|
| + case ":bit_and":
|
|
|
| value = (ival0 & ival1).toDouble();
|
| break;
|
|
|
| - case ':shl':
|
| + case ":shl":
|
|
|
| value = (ival0 << ival1).toDouble();
|
| break;
|
|
|
| - case ':sar':
|
| + case ":sar":
|
|
|
| value = (ival0 >> ival1).toDouble();
|
| break;
|
|
|
| - case ':shr':
|
| + case ":shr":
|
|
|
| value = (ival0 >>> ival1).toDouble();
|
| break;
|
| @@ -6214,79 +6191,57 @@ MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
|
| }
|
| }
|
| else if (this.declaringType.get$isString()) {
|
| - if (this.name == ':index') {
|
| - return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$index(0) + ']'), node.span, true);
|
| + if (this.name == ":index") {
|
| + return new Value(this.declaringType, ("" + target.code + "[" + argsCode.$index(0) + "]"), node.span, true);
|
| }
|
| - else if (this.name == ':add') {
|
| + else if (this.name == ":add") {
|
| if (allConst) {
|
| - var value = this._normConcat(target, args.values.$index(0));
|
| - return EvaluatedValue.EvaluatedValue$factory($globals.world.stringType, value, value, node.span);
|
| + var value = target.get$dynamic().get$actualValue() + args.values.$index(0).get$dynamic().get$actualValue();
|
| + return Value.fromString(value, node.span);
|
| }
|
| - return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode.$index(0)), node.span, true);
|
| + return new Value(this.declaringType, ("" + target.code + " + " + argsCode.$index(0)), node.span, true);
|
| }
|
| }
|
| else if (this.declaringType.get$isNative()) {
|
| - if (this.name == ':index') {
|
| - return new Value(this.returnType, ('' + target.code + '[' + argsCode.$index(0) + ']'), node.span, true);
|
| + if (this.name == ":index") {
|
| + return new Value(this.returnType, ("" + target.code + "[" + argsCode.$index(0) + "]"), node.span, true);
|
| }
|
| - else if (this.name == ':setindex') {
|
| - return new Value(this.returnType, ('' + target.code + '[' + argsCode.$index(0) + '] = ' + argsCode.$index(1)), node.span, true);
|
| + else if (this.name == ":setindex") {
|
| + return new Value(this.returnType, ("" + target.code + "[" + argsCode.$index(0) + "] = " + argsCode.$index(1)), node.span, true);
|
| }
|
| }
|
| - if (this.name == ':eq' || this.name == ':ne') {
|
| - var op = this.name == ':eq' ? '==' : '!=';
|
| - if (this.name == ':ne') {
|
| - target.invoke(context, ':eq', node, args, isDynamic);
|
| + if (this.name == ":eq" || this.name == ":ne") {
|
| + var op = this.name == ":eq" ? "==" : "!=";
|
| + if (this.name == ":ne") {
|
| + target.invoke(context, ":eq", node, args, isDynamic);
|
| }
|
| if (allConst) {
|
| var val0 = target.get$dynamic().get$actualValue();
|
| var val1 = args.values.$index(0).get$dynamic().get$actualValue();
|
| - var newVal = this.name == ':eq' ? $eq(val0, val1) : $ne(val0, val1);
|
| + var newVal = this.name == ":eq" ? $eq(val0, val1) : $ne(val0, val1);
|
| return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, newVal, ("" + newVal), node.span);
|
| }
|
| - if ($eq(argsCode.$index(0), 'null')) {
|
| - return new Value(this.get$inferredResult(), ('' + target.code + ' ' + op + ' null'), node.span, true);
|
| + if ($eq(argsCode.$index(0), "null")) {
|
| + return new Value(this.get$inferredResult(), ("" + target.code + " " + op + " null"), node.span, true);
|
| }
|
| else if (target.get$type().get$isNum() || target.get$type().get$isString()) {
|
| - return new Value(this.get$inferredResult(), ('' + target.code + ' ' + op + ' ' + argsCode.$index(0)), node.span, true);
|
| + return new Value(this.get$inferredResult(), ("" + target.code + " " + op + " " + argsCode.$index(0)), node.span, true);
|
| }
|
| $globals.world.gen.corejs.useOperator(this.name);
|
| - return new Value(this.get$inferredResult(), ('' + this.get$jsname() + '(' + target.code + ', ' + argsCode.$index(0) + ')'), node.span, true);
|
| + return new Value(this.get$inferredResult(), ("" + this.get$jsname() + "(" + target.code + ", " + argsCode.$index(0) + ")"), node.span, true);
|
| }
|
| if (this.get$isCallMethod()) {
|
| this.declaringType.markUsed();
|
| - return new Value(this.get$inferredResult(), ('' + target.code + '(' + Strings.join(argsCode, ", ") + ')'), node.span, true);
|
| + return new Value(this.get$inferredResult(), ("" + target.code + "(" + Strings.join(argsCode, ", ") + ")"), node.span, true);
|
| }
|
| - if (this.name == ':index') {
|
| + if (this.name == ":index") {
|
| $globals.world.gen.corejs.useIndex = true;
|
| }
|
| - else if (this.name == ':setindex') {
|
| + else if (this.name == ":setindex") {
|
| $globals.world.gen.corejs.useSetIndex = true;
|
| }
|
| - var argsString = Strings.join(argsCode, ', ');
|
| - return new Value(this.get$inferredResult(), ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, true);
|
| -}
|
| -MethodMember.prototype._normConcat = function(a, b) {
|
| - var val0 = a.get$dynamic().get$actualValue();
|
| - var quote0 = val0.$index(0);
|
| - val0 = val0.substring$2(1, val0.get$length() - 1);
|
| - var val1 = b.get$dynamic().get$actualValue();
|
| - var quote1 = null;
|
| - if (b.get$type().get$isString()) {
|
| - quote1 = val1.$index(0);
|
| - val1 = val1.substring$2(1, val1.get$length() - 1);
|
| - }
|
| - var value;
|
| - if ($eq(quote0, quote1) || quote1 == null) {
|
| - value = ('' + quote0 + val0 + val1 + quote0);
|
| - }
|
| - else if ($eq(quote0, '"')) {
|
| - value = ('' + quote0 + val0 + toDoubleQuote(val1) + quote0);
|
| - }
|
| - else {
|
| - value = ('' + quote1 + toDoubleQuote(val0) + val1 + quote1);
|
| - }
|
| - return value;
|
| + var argsString = Strings.join(argsCode, ", ");
|
| + return new Value(this.get$inferredResult(), ("" + target.code + "." + this.get$jsname() + "(" + argsString + ")"), node.span, true);
|
| }
|
| MethodMember.prototype.resolve = function() {
|
| this.isStatic = this.declaringType.get$isTop();
|
| @@ -6299,35 +6254,35 @@ MethodMember.prototype.resolve = function() {
|
| var mod = $$list.$index($$i);
|
| if ($eq(mod.get$kind(), 84/*TokenKind.STATIC*/)) {
|
| if (this.isStatic) {
|
| - $globals.world.error('duplicate static modifier', mod.get$span());
|
| + $globals.world.error("duplicate static modifier", mod.get$span());
|
| }
|
| this.isStatic = true;
|
| }
|
| else if (this.get$isConstructor() && $eq(mod.get$kind(), 91/*TokenKind.CONST*/)) {
|
| if (this.isConst) {
|
| - $globals.world.error('duplicate const modifier', mod.get$span());
|
| + $globals.world.error("duplicate const modifier", mod.get$span());
|
| }
|
| this.isConst = true;
|
| }
|
| else if ($eq(mod.get$kind(), 73/*TokenKind.FACTORY*/)) {
|
| if (this.isFactory) {
|
| - $globals.world.error('duplicate factory modifier', mod.get$span());
|
| + $globals.world.error("duplicate factory modifier", mod.get$span());
|
| }
|
| this.isFactory = true;
|
| }
|
| else if ($eq(mod.get$kind(), 71/*TokenKind.ABSTRACT*/)) {
|
| if (this.isAbstract) {
|
| if (this.declaringType.get$isClass()) {
|
| - $globals.world.error('duplicate abstract modifier', mod.get$span());
|
| + $globals.world.error("duplicate abstract modifier", mod.get$span());
|
| }
|
| else if (!this.get$isCallMethod()) {
|
| - $globals.world.error('abstract modifier not allowed on interface members', mod.get$span());
|
| + $globals.world.error("abstract modifier not allowed on interface members", mod.get$span());
|
| }
|
| }
|
| this.isAbstract = true;
|
| }
|
| else {
|
| - $globals.world.error(('' + mod + ' modifier not allowed on method'), mod.get$span());
|
| + $globals.world.error(("" + mod + " modifier not allowed on method"), mod.get$span());
|
| }
|
| }
|
| }
|
| @@ -6335,19 +6290,19 @@ MethodMember.prototype.resolve = function() {
|
| this.isStatic = true;
|
| }
|
| if (this.get$isOperator() && this.isStatic && !this.get$isCallMethod()) {
|
| - $globals.world.error(('operator method may not be static "' + this.name + '"'), this.get$span());
|
| + $globals.world.error(("operator method may not be static \"" + this.name + "\""), this.get$span());
|
| }
|
| if (this.isAbstract) {
|
| if (this.definition.body != null && !(this.declaringType.get$definition() instanceof FunctionTypeDefinition)) {
|
| - $globals.world.error('abstract method can not have a body', this.get$span());
|
| + $globals.world.error("abstract method can not have a body", this.get$span());
|
| }
|
| if (this.isStatic && !(this.declaringType.get$definition() instanceof FunctionTypeDefinition)) {
|
| - $globals.world.error('static method can not be abstract', this.get$span());
|
| + $globals.world.error("static method can not be abstract", this.get$span());
|
| }
|
| }
|
| else {
|
| if (this.definition.body == null && !this.get$isConstructor() && !this.get$isNative()) {
|
| - $globals.world.error('method needs a body', this.get$span());
|
| + $globals.world.error("method needs a body", this.get$span());
|
| }
|
| }
|
| if (this.get$isConstructor() && !this.isFactory) {
|
| @@ -6371,7 +6326,7 @@ MethodMember.prototype.resolve = function() {
|
| MethodMember.prototype.resolveType = function(node, typeErrors) {
|
| 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);
|
| + $globals.world.error("using type parameter in static context.", node.span);
|
| }
|
| return t;
|
| }
|
| @@ -6408,7 +6363,7 @@ MemberSet.prototype.get$members = function() { return this.members; };
|
| MemberSet.prototype.get$jsname = function() { return this.jsname; };
|
| MemberSet.prototype.get$isVar = function() { return this.isVar; };
|
| MemberSet.prototype.toString = function() {
|
| - return ('' + this.name + ':' + this.members.get$length());
|
| + return ("" + this.name + ":" + this.members.get$length());
|
| }
|
| MemberSet.prototype.get$containsMethods = function() {
|
| return this.members.some((function (m) {
|
| @@ -6433,9 +6388,9 @@ MemberSet.prototype.canInvoke = function(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);
|
| + $globals.world.warning(("could not find applicable " + action + " for \"" + this.name + "\""), node.span);
|
| }
|
| - return new Value($globals.world.varType, ('' + target.code + '.' + this.jsname + '() /*no applicable ' + action + '*/'), node.span, true);
|
| + return new Value($globals.world.varType, ("" + target.code + "." + this.jsname + "() /*no applicable " + action + "*/"), node.span, true);
|
| }
|
| MemberSet.prototype.get$treatAsField = function() {
|
| if (this._treatAsField == null) {
|
| @@ -6485,15 +6440,15 @@ MemberSet.prototype._get = function(context, node, target, isDynamic) {
|
| returnValue = this._tryUnion(returnValue, value, node);
|
| }
|
| if (returnValue == null) {
|
| - return this._makeError(node, target, 'getter');
|
| + return this._makeError(node, target, "getter");
|
| }
|
| }
|
| if (returnValue.code == null) {
|
| if (this.get$treatAsField()) {
|
| - return new Value(returnValue.get$type(), ('' + target.code + '.' + this.jsname), node.span, true);
|
| + return new Value(returnValue.get$type(), ("" + target.code + "." + this.jsname), node.span, true);
|
| }
|
| else {
|
| - return new Value(returnValue.get$type(), ('' + target.code + '.get\$' + this.jsname + '()'), node.span, true);
|
| + return new Value(returnValue.get$type(), ("" + target.code + ".get$" + this.jsname + "()"), node.span, true);
|
| }
|
| }
|
| return returnValue;
|
| @@ -6524,15 +6479,15 @@ MemberSet.prototype._set = function(context, node, target, value, isDynamic) {
|
| returnValue = this._tryUnion(returnValue, res, node);
|
| }
|
| if (returnValue == null) {
|
| - return this._makeError(node, target, 'setter');
|
| + return this._makeError(node, target, "setter");
|
| }
|
| }
|
| if (returnValue.code == null) {
|
| if (this.get$treatAsField()) {
|
| - return new Value(returnValue.get$type(), ('' + target.code + '.' + this.jsname + ' = ' + value.code), node.span, true);
|
| + return new Value(returnValue.get$type(), ("" + target.code + "." + this.jsname + " = " + value.code), node.span, true);
|
| }
|
| else {
|
| - return new Value(returnValue.get$type(), ('' + target.code + '.set\$' + this.jsname + '(' + value.code + ')'), node.span, true);
|
| + return new Value(returnValue.get$type(), ("" + target.code + ".set$" + this.jsname + "(" + value.code + ")"), node.span, true);
|
| }
|
| }
|
| return returnValue;
|
| @@ -6558,10 +6513,10 @@ MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) {
|
| returnValue = this._tryUnion(returnValue, res, node);
|
| }
|
| if (returnValue == null) {
|
| - return this._makeError(node, target, 'method');
|
| + return this._makeError(node, target, "method");
|
| }
|
| if (returnValue.code == null) {
|
| - if (this.name == ':call') {
|
| + if (this.name == ":call") {
|
| return target._varCall(context, node, args);
|
| }
|
| else if (this.get$isOperator()) {
|
| @@ -6575,13 +6530,13 @@ MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) {
|
| }
|
| MemberSet.prototype.invokeSpecial = function(target, args, returnType) {
|
| var argsString = args.getCode();
|
| - if (this.name == ':index' || this.name == ':setindex') {
|
| - return new Value(returnType, ('' + target.code + '.' + this.jsname + '(' + argsString + ')'), target.span, true);
|
| + if (this.name == ":index" || this.name == ":setindex") {
|
| + return new Value(returnType, ("" + target.code + "." + this.jsname + "(" + argsString + ")"), target.span, true);
|
| }
|
| else {
|
| - if (argsString.get$length() > 0) argsString = (', ' + argsString);
|
| + if (argsString.get$length() > 0) argsString = (", " + argsString);
|
| $globals.world.gen.corejs.useOperator(this.name);
|
| - return new Value(returnType, ('' + this.jsname + '(' + target.code + argsString + ')'), target.span, true);
|
| + return new Value(returnType, ("" + this.jsname + "(" + target.code + argsString + ")"), target.span, true);
|
| }
|
| }
|
| MemberSet.prototype.invokeOnVar = function(context, node, target, args) {
|
| @@ -6702,9 +6657,9 @@ Token.prototype.toString = function() {
|
| var actualText = this.get$text();
|
| if ($ne(kindText, actualText)) {
|
| if (actualText.get$length() > 10) {
|
| - actualText = actualText.substring$2(0, 8) + '...';
|
| + actualText = actualText.substring$2(0, 8) + "...";
|
| }
|
| - return ('' + kindText + '(' + actualText + ')');
|
| + return ("" + kindText + "(" + actualText + ")");
|
| }
|
| else {
|
| return kindText;
|
| @@ -6714,12 +6669,21 @@ Token.prototype.get$span = function() {
|
| return new SourceSpan(this.source, this.start, this.end);
|
| }
|
| Token.prototype.end$0 = function() {
|
| - return this.end();
|
| + return this.end.call$0();
|
| };
|
| Token.prototype.start$0 = function() {
|
| - return this.start();
|
| + return this.start.call$0();
|
| };
|
| Token.prototype.toString$0 = Token.prototype.toString;
|
| +// ********** Code for LiteralToken **************
|
| +$inherits(LiteralToken, Token);
|
| +function LiteralToken(kind, source, start, end, value) {
|
| + this.value = value;
|
| + // Initializers done
|
| + Token.call(this, kind, source, start, end);
|
| +}
|
| +LiteralToken.prototype.get$value = function() { return this.value; };
|
| +LiteralToken.prototype.set$value = function(value) { return this.value = value; };
|
| // ********** Code for ErrorToken **************
|
| $inherits(ErrorToken, Token);
|
| function ErrorToken(kind, source, start, end, message) {
|
| @@ -6746,7 +6710,7 @@ SourceFile.prototype.get$lineStarts = function() {
|
| var starts = [0];
|
| var index = 0;
|
| while (index < this.get$text().length) {
|
| - index = this.get$text().indexOf('\n', index) + 1;
|
| + index = this.get$text().indexOf("\n", index) + 1;
|
| if (index <= 0) break;
|
| starts.add$1(index);
|
| }
|
| @@ -6761,7 +6725,7 @@ SourceFile.prototype.getLine = function(position) {
|
| i < starts.get$length(); i++) {
|
| if (starts.$index(i) > position) return i - 1;
|
| }
|
| - $globals.world.internalError('bad position');
|
| + $globals.world.internalError("bad position");
|
| }
|
| SourceFile.prototype.getColumn = function(line, position) {
|
| return position - this.get$lineStarts().$index(line);
|
| @@ -6769,15 +6733,15 @@ SourceFile.prototype.getColumn = function(line, position) {
|
| SourceFile.prototype.getLocationMessage = function(message, start, end, includeText) {
|
| var line = this.getLine(start);
|
| var column = this.getColumn(line, start);
|
| - var buf = new StringBufferImpl(('' + this.filename + ':' + (line + 1) + ':' + (column + 1) + ': ' + message));
|
| + var buf = new StringBufferImpl(("" + this.filename + ":" + (line + 1) + ":" + (column + 1) + ": " + message));
|
| if (includeText) {
|
| - buf.add$1('\n');
|
| + buf.add$1("\n");
|
| var textLine;
|
| if ((line + 2) < this._lineStarts.get$length()) {
|
| textLine = this.get$text().substring(this._lineStarts.$index(line), this._lineStarts.$index(line + 1));
|
| }
|
| else {
|
| - textLine = this.get$text().substring(this._lineStarts.$index(line)) + '\n';
|
| + textLine = this.get$text().substring(this._lineStarts.$index(line)) + "\n";
|
| }
|
| var toColumn = Math.min(column + (end - start), textLine.get$length());
|
| if ($globals.options.useColors) {
|
| @@ -6792,11 +6756,11 @@ SourceFile.prototype.getLocationMessage = function(message, start, end, includeT
|
| }
|
| var i = 0;
|
| for (; i < column; i++) {
|
| - buf.add$1(' ');
|
| + buf.add$1(" ");
|
| }
|
| if ($globals.options.useColors) buf.add$1($globals._RED_COLOR);
|
| for (; i < toColumn; i++) {
|
| - buf.add$1('^');
|
| + buf.add$1("^");
|
| }
|
| if ($globals.options.useColors) buf.add$1($globals._NO_COLOR);
|
| }
|
| @@ -6832,7 +6796,7 @@ SourceSpan.prototype.toMessageString = function(message) {
|
| SourceSpan.prototype.get$locationText = function() {
|
| var line = this.file.getLine(this.start);
|
| var column = this.file.getColumn(line, this.start);
|
| - return ('' + this.file.filename + ':' + (line + 1) + ':' + (column + 1));
|
| + return ("" + this.file.filename + ":" + (line + 1) + ":" + (column + 1));
|
| }
|
| SourceSpan.prototype.compareTo = function(other) {
|
| if ($eq(this.file, other.file)) {
|
| @@ -6843,10 +6807,10 @@ SourceSpan.prototype.compareTo = function(other) {
|
| }
|
| SourceSpan.prototype.compareTo$1 = SourceSpan.prototype.compareTo;
|
| SourceSpan.prototype.end$0 = function() {
|
| - return this.end();
|
| + return this.end.call$0();
|
| };
|
| SourceSpan.prototype.start$0 = function() {
|
| - return this.start();
|
| + return this.start.call$0();
|
| };
|
| // ********** Code for InterpStack **************
|
| function InterpStack(previous, quote, isMultiline) {
|
| @@ -6883,9 +6847,6 @@ TokenizerHelpers.isIdentifierStart = function(c) {
|
| TokenizerHelpers.isDigit = function(c) {
|
| return (c >= 48 && c <= 57);
|
| }
|
| -TokenizerHelpers.isHexDigit = function(c) {
|
| - return (TokenizerHelpers.isDigit(c) || (c >= 97 && c <= 102) || (c >= 65 && c <= 70));
|
| -}
|
| TokenizerHelpers.isIdentifierPart = function(c) {
|
| return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c) || c == 36);
|
| }
|
| @@ -6987,7 +6948,7 @@ TokenizerBase.prototype.finishMultiLineComment = function() {
|
| do {
|
| var ch = this._nextChar();
|
| if (ch == 0) {
|
| - return this._finishToken(67/*TokenKind.INCOMPLETE_COMMENT*/);
|
| + return this._errorToken();
|
| }
|
| else if (ch == 42) {
|
| if (this._maybeEatChar(47)) {
|
| @@ -7018,26 +6979,49 @@ TokenizerBase.prototype.eatDigits = function() {
|
| }
|
| }
|
| }
|
| -TokenizerBase.prototype.eatHexDigits = function() {
|
| - while (this._lang_index < this._text.length) {
|
| - if (TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._lang_index))) {
|
| - this._lang_index++;
|
| - }
|
| - else {
|
| - return;
|
| - }
|
| +TokenizerBase._hexDigit = function(c) {
|
| + if (c >= 48 && c <= 57) {
|
| + return c - 48;
|
| + }
|
| + else if (c >= 97 && c <= 102) {
|
| + return c - 87;
|
| + }
|
| + else if (c >= 65 && c <= 70) {
|
| + return c - 55;
|
| + }
|
| + else {
|
| + return -1;
|
| }
|
| }
|
| -TokenizerBase.prototype.maybeEatHexDigit = function() {
|
| - if (this._lang_index < this._text.length && TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._lang_index))) {
|
| +TokenizerBase.prototype.readHex = function(hexLength) {
|
| + var maxIndex;
|
| + if (hexLength == null) {
|
| + maxIndex = this._text.length - 1;
|
| + }
|
| + else {
|
| + maxIndex = this._lang_index + hexLength;
|
| + if (maxIndex >= this._text.length) return -1;
|
| + }
|
| + var result = 0;
|
| + while (this._lang_index < maxIndex) {
|
| + var digit = TokenizerBase._hexDigit(this._text.charCodeAt(this._lang_index));
|
| + if (digit == -1) {
|
| + if (hexLength == null) {
|
| + return result;
|
| + }
|
| + else {
|
| + return -1;
|
| + }
|
| + }
|
| + TokenizerBase._hexDigit(this._text.charCodeAt(this._lang_index));
|
| + result = (result * 16) + digit;
|
| this._lang_index++;
|
| - return true;
|
| }
|
| - return false;
|
| + return result;
|
| }
|
| TokenizerBase.prototype.finishHex = function() {
|
| - this.eatHexDigits();
|
| - return this._finishToken(61/*TokenKind.HEX_INTEGER*/);
|
| + var value = this.readHex();
|
| + return new LiteralToken(61/*TokenKind.HEX_INTEGER*/, this._source, this._startIndex, this._lang_index, value);
|
| }
|
| TokenizerBase.prototype.finishNumber = function() {
|
| this.eatDigits();
|
| @@ -7066,28 +7050,57 @@ TokenizerBase.prototype.finishNumberExtra = function(kind) {
|
| }
|
| return this._finishToken(kind);
|
| }
|
| +TokenizerBase.prototype._makeStringToken = function(buf, isPart) {
|
| + var s = Strings.String$fromCharCodes$factory(buf);
|
| + var kind = isPart ? 59/*TokenKind.STRING_PART*/ : 58/*TokenKind.STRING*/;
|
| + return new LiteralToken(kind, this._source, this._startIndex, this._lang_index, s);
|
| +}
|
| +TokenizerBase.prototype._makeRawStringToken = function(isMultiline) {
|
| + var s;
|
| + if (isMultiline) {
|
| + if (this._source.get$text()[this._startIndex + 4] == "\n") {
|
| + s = this._source.get$text().substring(this._startIndex + 5, this._lang_index - 3);
|
| + }
|
| + else {
|
| + s = this._source.get$text().substring(this._startIndex + 4, this._lang_index - 3);
|
| + }
|
| + }
|
| + else {
|
| + s = this._source.get$text().substring(this._startIndex + 2, this._lang_index - 1);
|
| + }
|
| + return new LiteralToken(58/*TokenKind.STRING*/, this._source, this._startIndex, this._lang_index, s);
|
| +}
|
| TokenizerBase.prototype.finishMultilineString = function(quote) {
|
| + var buf = new Array();
|
| while (true) {
|
| var ch = this._nextChar();
|
| if (ch == 0) {
|
| - var kind = quote == 34 ? 68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/ : 69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/;
|
| - return this._finishToken(kind);
|
| + return this._errorToken();
|
| }
|
| else if (ch == quote) {
|
| if (this._maybeEatChar(quote)) {
|
| if (this._maybeEatChar(quote)) {
|
| - return this._finishToken(58/*TokenKind.STRING*/);
|
| + return this._makeStringToken(buf, false);
|
| }
|
| + buf.add$1(quote);
|
| }
|
| + buf.add$1(quote);
|
| }
|
| else if (ch == 36) {
|
| this._interpStack = InterpStack.push(this._interpStack, quote, true);
|
| - return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/);
|
| + return this._makeStringToken(buf, true);
|
| }
|
| else if (ch == 92) {
|
| - if (!this.eatEscapeSequence()) {
|
| + var escapeVal = this.readEscapeSequence();
|
| + if ($eq(escapeVal, -1)) {
|
| return this._errorToken("invalid hex escape sequence");
|
| }
|
| + else {
|
| + buf.add$1(escapeVal);
|
| + }
|
| + }
|
| + else {
|
| + buf.add$1(ch);
|
| }
|
| }
|
| }
|
| @@ -7113,10 +7126,11 @@ TokenizerBase.prototype._finishCloseBrace = function() {
|
| TokenizerBase.prototype.finishString = function(quote) {
|
| if (this._maybeEatChar(quote)) {
|
| if (this._maybeEatChar(quote)) {
|
| + this._maybeEatChar(10);
|
| return this.finishMultilineString(quote);
|
| }
|
| else {
|
| - return this._finishToken(58/*TokenKind.STRING*/);
|
| + return this._makeStringToken(new Array(), false);
|
| }
|
| }
|
| return this.finishStringBody(quote);
|
| @@ -7127,16 +7141,16 @@ TokenizerBase.prototype.finishRawString = function(quote) {
|
| return this.finishMultilineRawString(quote);
|
| }
|
| else {
|
| - return this._finishToken(58/*TokenKind.STRING*/);
|
| + return this._makeStringToken(new Array(), false);
|
| }
|
| }
|
| while (true) {
|
| var ch = this._nextChar();
|
| if (ch == quote) {
|
| - return this._finishToken(58/*TokenKind.STRING*/);
|
| + return this._makeRawStringToken(false);
|
| }
|
| else if (ch == 0) {
|
| - return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/);
|
| + return this._errorToken();
|
| }
|
| }
|
| }
|
| @@ -7144,72 +7158,106 @@ TokenizerBase.prototype.finishMultilineRawString = function(quote) {
|
| while (true) {
|
| var ch = this._nextChar();
|
| if (ch == 0) {
|
| - var kind = quote == 34 ? 68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/ : 69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/;
|
| - return this._finishToken(kind);
|
| + return this._errorToken();
|
| }
|
| else if (ch == quote && this._maybeEatChar(quote) && this._maybeEatChar(quote)) {
|
| - return this._finishToken(58/*TokenKind.STRING*/);
|
| + return this._makeRawStringToken(true);
|
| }
|
| }
|
| }
|
| TokenizerBase.prototype.finishStringBody = function(quote) {
|
| + var buf = new Array();
|
| while (true) {
|
| var ch = this._nextChar();
|
| if (ch == quote) {
|
| - return this._finishToken(58/*TokenKind.STRING*/);
|
| + return this._makeStringToken(buf, false);
|
| }
|
| else if (ch == 36) {
|
| this._interpStack = InterpStack.push(this._interpStack, quote, false);
|
| - return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/);
|
| + return this._makeStringToken(buf, true);
|
| }
|
| else if (ch == 0) {
|
| - return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/);
|
| + return this._errorToken();
|
| }
|
| else if (ch == 92) {
|
| - if (!this.eatEscapeSequence()) {
|
| + var escapeVal = this.readEscapeSequence();
|
| + if ($eq(escapeVal, -1)) {
|
| return this._errorToken("invalid hex escape sequence");
|
| }
|
| + else {
|
| + buf.add$1(escapeVal);
|
| + }
|
| + }
|
| + else {
|
| + buf.add$1(ch);
|
| }
|
| }
|
| }
|
| -TokenizerBase.prototype.eatEscapeSequence = function() {
|
| - var hex;
|
| - switch (this._nextChar()) {
|
| +TokenizerBase.prototype.readEscapeSequence = function() {
|
| + var ch = this._nextChar();
|
| + var hexValue;
|
| + switch (ch) {
|
| + case 110:
|
| +
|
| + return 10;
|
| +
|
| + case 114:
|
| +
|
| + return 13;
|
| +
|
| + case 102:
|
| +
|
| + return 12;
|
| +
|
| + case 98:
|
| +
|
| + return 8;
|
| +
|
| + case 116:
|
| +
|
| + return 9;
|
| +
|
| + case 118:
|
| +
|
| + return 11;
|
| +
|
| case 120:
|
|
|
| - return this.maybeEatHexDigit() && this.maybeEatHexDigit();
|
| + hexValue = this.readHex(2);
|
| + break;
|
|
|
| case 117:
|
|
|
| if (this._maybeEatChar(123)) {
|
| - var start = this._lang_index;
|
| - this.eatHexDigits();
|
| - var chars = this._lang_index - start;
|
| - if (chars > 0 && chars <= 6 && this._maybeEatChar(125)) {
|
| - hex = this._text.substring(start, start + chars);
|
| - break;
|
| + hexValue = this.readHex();
|
| + if (!this._maybeEatChar(125)) {
|
| + return -1;
|
| }
|
| else {
|
| - return false;
|
| + break;
|
| }
|
| }
|
| else {
|
| - if (this.maybeEatHexDigit() && this.maybeEatHexDigit() && this.maybeEatHexDigit() && this.maybeEatHexDigit()) {
|
| - hex = this._text.substring(this._lang_index - 4, this._lang_index);
|
| - break;
|
| - }
|
| - else {
|
| - return false;
|
| - }
|
| + hexValue = this.readHex(4);
|
| + break;
|
| }
|
|
|
| default:
|
|
|
| - return true;
|
| + return ch;
|
|
|
| }
|
| - var n = Parser.parseHex(hex);
|
| - return n < 0xD800 || n > 0xDFFF && n <= 0x10FFFF;
|
| + if (hexValue == -1) return -1;
|
| + if (hexValue < 55296 || hexValue > 57343 && hexValue <= 65535) {
|
| + return hexValue;
|
| + }
|
| + else if (hexValue <= 1114111) {
|
| + $globals.world.fatal("unicode values greater than 2 bytes not implemented yet");
|
| + return -1;
|
| + }
|
| + else {
|
| + return -1;
|
| + }
|
| }
|
| TokenizerBase.prototype.finishDot = function() {
|
| if (TokenizerHelpers.isDigit(this._peekChar())) {
|
| @@ -8427,89 +8475,89 @@ TokenKind.infixPrecedence = function(kind) {
|
| }
|
| TokenKind.rawOperatorFromMethod = function(name) {
|
| switch (name) {
|
| - case ':bit_not':
|
| + case ":bit_not":
|
|
|
| - return '~';
|
| + return "~";
|
|
|
| - case ':bit_or':
|
| + case ":bit_or":
|
|
|
| - return '|';
|
| + return "|";
|
|
|
| - case ':bit_xor':
|
| + case ":bit_xor":
|
|
|
| - return '^';
|
| + return "^";
|
|
|
| - case ':bit_and':
|
| + case ":bit_and":
|
|
|
| - return '&';
|
| + return "&";
|
|
|
| - case ':shl':
|
| + case ":shl":
|
|
|
| - return '<<';
|
| + return "<<";
|
|
|
| - case ':sar':
|
| + case ":sar":
|
|
|
| - return '>>';
|
| + return ">>";
|
|
|
| - case ':shr':
|
| + case ":shr":
|
|
|
| - return '>>>';
|
| + return ">>>";
|
|
|
| - case ':add':
|
| + case ":add":
|
|
|
| - return '+';
|
| + return "+";
|
|
|
| - case ':sub':
|
| + case ":sub":
|
|
|
| - return '-';
|
| + return "-";
|
|
|
| - case ':mul':
|
| + case ":mul":
|
|
|
| - return '*';
|
| + return "*";
|
|
|
| - case ':div':
|
| + case ":div":
|
|
|
| - return '/';
|
| + return "/";
|
|
|
| - case ':truncdiv':
|
| + case ":truncdiv":
|
|
|
| - return '~/';
|
| + return "~/";
|
|
|
| - case ':mod':
|
| + case ":mod":
|
|
|
| - return '%';
|
| + return "%";
|
|
|
| - case ':eq':
|
| + case ":eq":
|
|
|
| - return '==';
|
| + return "==";
|
|
|
| - case ':lt':
|
| + case ":lt":
|
|
|
| - return '<';
|
| + return "<";
|
|
|
| - case ':gt':
|
| + case ":gt":
|
|
|
| - return '>';
|
| + return ">";
|
|
|
| - case ':lte':
|
| + case ":lte":
|
|
|
| - return '<=';
|
| + return "<=";
|
|
|
| - case ':gte':
|
| + case ":gte":
|
|
|
| - return '>=';
|
| + return ">=";
|
|
|
| - case ':index':
|
| + case ":index":
|
|
|
| - return '[]';
|
| + return "[]";
|
|
|
| - case ':setindex':
|
| + case ":setindex":
|
|
|
| - return '[]=';
|
| + return "[]=";
|
|
|
| - case ':ne':
|
| + case ":ne":
|
|
|
| - return '!=';
|
| + return "!=";
|
|
|
| }
|
| }
|
| @@ -8517,90 +8565,90 @@ TokenKind.binaryMethodName = function(kind) {
|
| switch (kind) {
|
| case 18/*TokenKind.BIT_NOT*/:
|
|
|
| - return ':bit_not';
|
| + return ":bit_not";
|
|
|
| case 36/*TokenKind.BIT_OR*/:
|
|
|
| - return ':bit_or';
|
| + return ":bit_or";
|
|
|
| case 37/*TokenKind.BIT_XOR*/:
|
|
|
| - return ':bit_xor';
|
| + return ":bit_xor";
|
|
|
| case 38/*TokenKind.BIT_AND*/:
|
|
|
| - return ':bit_and';
|
| + return ":bit_and";
|
|
|
| case 39/*TokenKind.SHL*/:
|
|
|
| - return ':shl';
|
| + return ":shl";
|
|
|
| case 40/*TokenKind.SAR*/:
|
|
|
| - return ':sar';
|
| + return ":sar";
|
|
|
| case 41/*TokenKind.SHR*/:
|
|
|
| - return ':shr';
|
| + return ":shr";
|
|
|
| case 42/*TokenKind.ADD*/:
|
|
|
| - return ':add';
|
| + return ":add";
|
|
|
| case 43/*TokenKind.SUB*/:
|
|
|
| - return ':sub';
|
| + return ":sub";
|
|
|
| case 44/*TokenKind.MUL*/:
|
|
|
| - return ':mul';
|
| + return ":mul";
|
|
|
| case 45/*TokenKind.DIV*/:
|
|
|
| - return ':div';
|
| + return ":div";
|
|
|
| case 46/*TokenKind.TRUNCDIV*/:
|
|
|
| - return ':truncdiv';
|
| + return ":truncdiv";
|
|
|
| case 47/*TokenKind.MOD*/:
|
|
|
| - return ':mod';
|
| + return ":mod";
|
|
|
| case 48/*TokenKind.EQ*/:
|
|
|
| - return ':eq';
|
| + return ":eq";
|
|
|
| case 52/*TokenKind.LT*/:
|
|
|
| - return ':lt';
|
| + return ":lt";
|
|
|
| case 53/*TokenKind.GT*/:
|
|
|
| - return ':gt';
|
| + return ":gt";
|
|
|
| case 54/*TokenKind.LTE*/:
|
|
|
| - return ':lte';
|
| + return ":lte";
|
|
|
| case 55/*TokenKind.GTE*/:
|
|
|
| - return ':gte';
|
| + return ":gte";
|
|
|
| case 56/*TokenKind.INDEX*/:
|
|
|
| - return ':index';
|
| + return ":index";
|
|
|
| case 57/*TokenKind.SETINDEX*/:
|
|
|
| - return ':setindex';
|
| + return ":setindex";
|
|
|
| }
|
| }
|
| TokenKind.kindFromAssign = function(kind) {
|
| if (kind == 20/*TokenKind.ASSIGN*/) return 0;
|
| if (kind > 20/*TokenKind.ASSIGN*/ && kind <= 32/*TokenKind.ASSIGN_MOD*/) {
|
| - return kind + (15)/*(ADD - ASSIGN_ADD)*/;
|
| + return kind + (15);
|
| }
|
| return -1;
|
| }
|
| @@ -8622,11 +8670,11 @@ Parser.prototype.get$enableAwait = function() {
|
| return $globals.experimentalAwaitPhase != null;
|
| }
|
| Parser.prototype.isPrematureEndOfFile = function() {
|
| - if (this.throwOnIncomplete && this._maybeEat(1/*TokenKind.END_OF_FILE*/) || this._maybeEat(68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/) || this._maybeEat(69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/)) {
|
| + if (this.throwOnIncomplete && this._maybeEat(1/*TokenKind.END_OF_FILE*/)) {
|
| $throw(new IncompleteSourceException(this._previousToken));
|
| }
|
| else if (this._maybeEat(1/*TokenKind.END_OF_FILE*/)) {
|
| - this._lang_error('unexpected end of file', this._peekToken.get$span());
|
| + this._lang_error("unexpected end of file", this._peekToken.get$span());
|
| return true;
|
| }
|
| else {
|
| @@ -8687,7 +8735,7 @@ Parser.prototype._errorExpected = function(expected) {
|
| this._lang_error(tok.get$message(), tok.get$span());
|
| }
|
| else {
|
| - this._lang_error(('expected ' + expected + ', but found ' + tok), tok.get$span());
|
| + this._lang_error(("expected " + expected + ", but found " + tok), tok.get$span());
|
| }
|
| }
|
| Parser.prototype._lang_error = function(message, location) {
|
| @@ -8711,7 +8759,7 @@ Parser.prototype._skipBlock = function() {
|
| if (depth == 0) return;
|
| }
|
| else if ($eq(tok.get$kind(), 1/*TokenKind.END_OF_FILE*/)) {
|
| - this._lang_error('unexpected end of file during diet parse', tok.get$span());
|
| + this._lang_error("unexpected end of file during diet parse", tok.get$span());
|
| return;
|
| }
|
| }
|
| @@ -8785,7 +8833,7 @@ Parser.prototype.classDefinition = function(kind) {
|
| var defaultType = null;
|
| if (oldFactory || this._maybeEat(93/*TokenKind.DEFAULT*/)) {
|
| if (oldFactory) {
|
| - $globals.world.warning('factory no longer supported, use "default" instead', this._previousToken.get$span());
|
| + $globals.world.warning("factory no longer supported, use \"default\" instead", this._previousToken.get$span());
|
| }
|
| var baseType = this.nameTypeReference();
|
| var typeParams0 = null;
|
| @@ -8805,7 +8853,7 @@ Parser.prototype.classDefinition = function(kind) {
|
| }
|
| }
|
| else {
|
| - this._errorExpected('block starting with "{" or ";"');
|
| + this._errorExpected("block starting with \"{\" or \";\"");
|
| }
|
| return new TypeDefinition(kind == 90/*TokenKind.CLASS*/, name, typeParams, _extends, _implements, _native, defaultType, body, this._makeSpan(start));
|
| }
|
| @@ -8858,7 +8906,7 @@ Parser.prototype.functionBody = function(inExpression) {
|
| return null;
|
| }
|
| }
|
| - this._lang_error('Expected function body (neither { nor => found)');
|
| + this._lang_error("Expected function body (neither { nor => found)");
|
| }
|
| Parser.prototype.finishField = function(start, modifiers, type, name, value) {
|
| var names = [name];
|
| @@ -8886,7 +8934,7 @@ Parser.prototype.finishDefinition = function(start, modifiers, di) {
|
| }
|
| if (this._maybeEat(79/*TokenKind.NATIVE*/)) {
|
| native_ = this.maybeStringLiteral();
|
| - if (native_ == null) native_ = '';
|
| + if (native_ == null) native_ = "";
|
| }
|
| var body = this.functionBody(false);
|
| if (di.get$name() == null) {
|
| @@ -8907,7 +8955,7 @@ Parser.prototype.finishDefinition = function(start, modifiers, di) {
|
|
|
| default:
|
|
|
| - this._errorExpected('declaration');
|
| + this._errorExpected("declaration");
|
| return null;
|
|
|
| }
|
| @@ -8929,8 +8977,7 @@ Parser.prototype.factoryConstructorDeclaration = function() {
|
| }
|
| if (this._peekKind(52/*TokenKind.LT*/)) {
|
| var tp = this.typeParameters();
|
| - $globals.world.warning('type parameters on factories are no longer supported, place them on the class instead'/*'type parameters on factories are no longer supported, '
|
| - + 'place them on the class instead'*/, this._makeSpan(tp.$index(0).get$span().get$start()));
|
| + $globals.world.warning("type parameters on factories are no longer supported, place them on the class instead", this._makeSpan(tp.$index(0).get$span().get$start()));
|
| }
|
| var name = null;
|
| var type = null;
|
| @@ -8942,11 +8989,11 @@ Parser.prototype.factoryConstructorDeclaration = function() {
|
| name = names.removeLast$0();
|
| }
|
| else {
|
| - name = new Identifier('', names.$index(0).get$span());
|
| + name = new Identifier("", names.$index(0).get$span());
|
| }
|
| }
|
| if (names.get$length() > 1) {
|
| - this._lang_error('unsupported qualified name for factory', names.$index(0).get$span());
|
| + this._lang_error("unsupported qualified name for factory", names.$index(0).get$span());
|
| }
|
| type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get$span());
|
| var di = new DeclaredIdentifier(type, name, this._makeSpan(start));
|
| @@ -9225,7 +9272,7 @@ Parser.prototype.caseNode = function() {
|
| }
|
| }
|
| if ($eq(cases.get$length(), 0)) {
|
| - this._lang_error('case or default');
|
| + this._lang_error("case or default");
|
| }
|
| var stmts = [];
|
| while (!this._peekCaseEnd()) {
|
| @@ -9310,7 +9357,7 @@ Parser.prototype._makeType = function(expr) {
|
| return type;
|
| }
|
| else {
|
| - this._lang_error('expected type reference');
|
| + this._lang_error("expected type reference");
|
| return null;
|
| }
|
| }
|
| @@ -9414,7 +9461,7 @@ Parser.prototype.argument = function() {
|
| var expr;
|
| var label = null;
|
| if (this._maybeEat(15/*TokenKind.ELLIPSIS*/)) {
|
| - label = new Identifier('...', this._makeSpan(start));
|
| + label = new Identifier("...", this._makeSpan(start));
|
| }
|
| expr = this.expression();
|
| if (label == null && this._maybeEat(8/*TokenKind.COLON*/)) {
|
| @@ -9491,7 +9538,7 @@ Parser.prototype.finishCallOrLambdaExpression = function(expr) {
|
| }
|
| else {
|
| if ((expr instanceof DeclaredIdentifier)) {
|
| - this._lang_error('illegal target for call, did you mean to declare a function?', expr.get$span());
|
| + 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())));
|
| @@ -9500,17 +9547,8 @@ Parser.prototype.finishCallOrLambdaExpression = function(expr) {
|
| Parser.prototype._isBin = function(expr, kind) {
|
| return (expr instanceof BinaryExpression) && $eq(expr.get$op().get$kind(), kind);
|
| }
|
| -Parser.prototype._boolTypeRef = function(span) {
|
| - return new TypeReference(span, $globals.world.nonNullBool);
|
| -}
|
| -Parser.prototype._intTypeRef = function(span) {
|
| - return new TypeReference(span, $globals.world.intType);
|
| -}
|
| -Parser.prototype._doubleTypeRef = function(span) {
|
| - return new TypeReference(span, $globals.world.doubleType);
|
| -}
|
| -Parser.prototype._stringTypeRef = function(span) {
|
| - return new TypeReference(span, $globals.world.stringType);
|
| +Parser.prototype._makeLiteral = function(value) {
|
| + return new LiteralExpression(value, value.span);
|
| }
|
| Parser.prototype.primary = function() {
|
| var start = this._peekToken.start;
|
| @@ -9562,38 +9600,39 @@ Parser.prototype.primary = function() {
|
| case 105/*TokenKind.NULL*/:
|
|
|
| this._eat(105/*TokenKind.NULL*/);
|
| - return new NullExpression(this._makeSpan(start));
|
| + return this._makeLiteral(Value.fromNull(this._makeSpan(start)));
|
|
|
| case 111/*TokenKind.TRUE*/:
|
|
|
| this._eat(111/*TokenKind.TRUE*/);
|
| - return new LiteralExpression(true, this._boolTypeRef(this._makeSpan(start)), 'true', this._makeSpan(start));
|
| + return this._makeLiteral(Value.fromBool(true, this._makeSpan(start)));
|
|
|
| case 97/*TokenKind.FALSE*/:
|
|
|
| this._eat(97/*TokenKind.FALSE*/);
|
| - return new LiteralExpression(false, this._boolTypeRef(this._makeSpan(start)), 'false', this._makeSpan(start));
|
| + return this._makeLiteral(Value.fromBool(false, this._makeSpan(start)));
|
|
|
| case 61/*TokenKind.HEX_INTEGER*/:
|
|
|
| var t = this._lang_next();
|
| - return new LiteralExpression(Parser.parseHex(t.get$text().substring$1(2)), this._intTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start));
|
| + return this._makeLiteral(Value.fromInt(t.get$value(), t.get$span()));
|
|
|
| case 60/*TokenKind.INTEGER*/:
|
|
|
| var t = this._lang_next();
|
| - return new LiteralExpression(Math.parseInt(t.get$text()), this._intTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start));
|
| + return this._makeLiteral(Value.fromInt(Math.parseInt(t.get$text()), t.get$span()));
|
|
|
| case 62/*TokenKind.DOUBLE*/:
|
|
|
| var t = this._lang_next();
|
| - return new LiteralExpression(Math.parseDouble(t.get$text()), this._doubleTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start));
|
| + return this._makeLiteral(Value.fromDouble(Math.parseDouble(t.get$text()), t.get$span()));
|
|
|
| case 58/*TokenKind.STRING*/:
|
|
|
| - return this.stringLiteralExpr();
|
| + var t = this._lang_next();
|
| + return this._makeLiteral(Value.fromString(t.get$value(), t.get$span()));
|
|
|
| - case 66/*TokenKind.INCOMPLETE_STRING*/:
|
| + case 59/*TokenKind.STRING_PART*/:
|
|
|
| return this.stringInterpolation();
|
|
|
| @@ -9610,7 +9649,7 @@ Parser.prototype.primary = function() {
|
| default:
|
|
|
| if (!this._peekIdentifier()) {
|
| - this._errorExpected('expression');
|
| + this._errorExpected("expression");
|
| }
|
| return new VarExpression(this.identifier(), this._makeSpan(start));
|
|
|
| @@ -9618,65 +9657,40 @@ Parser.prototype.primary = function() {
|
| }
|
| Parser.prototype.stringInterpolation = function() {
|
| var start = this._peekToken.start;
|
| - var lits = [];
|
| + var pieces = new Array();
|
| var startQuote = null, endQuote = null;
|
| - while (this._peekKind(66/*TokenKind.INCOMPLETE_STRING*/)) {
|
| + while (this._peekKind(59/*TokenKind.STRING_PART*/)) {
|
| var token = this._lang_next();
|
| - var text = token.get$text();
|
| - if (startQuote == null) {
|
| - if (isMultilineString(text)) {
|
| - endQuote = text.substring$2(0, 3);
|
| - startQuote = endQuote + '\n';
|
| - }
|
| - else {
|
| - startQuote = endQuote = text.$index(0);
|
| - }
|
| - text = text.substring$2(0, text.get$length() - 1) + endQuote;
|
| - }
|
| - else {
|
| - text = startQuote + text.substring$2(0, text.get$length() - 1) + endQuote;
|
| - }
|
| - lits.add$1(this.makeStringLiteral(text, token.get$span()));
|
| + pieces.add$1(this._makeLiteral(Value.fromString(token.get$value(), token.get$span())));
|
| if (this._maybeEat(6/*TokenKind.LBRACE*/)) {
|
| - lits.add$1(this.expression());
|
| + pieces.add$1(this.expression());
|
| this._eat(7/*TokenKind.RBRACE*/);
|
| }
|
| else if (this._maybeEat(109/*TokenKind.THIS*/)) {
|
| - lits.add$1(new ThisExpression(this._previousToken.get$span()));
|
| + pieces.add$1(new ThisExpression(this._previousToken.get$span()));
|
| }
|
| else {
|
| var id = this.identifier();
|
| - lits.add$1(new VarExpression(id, id.get$span()));
|
| + pieces.add$1(new VarExpression(id, id.get$span()));
|
| }
|
| }
|
| var tok = this._lang_next();
|
| if ($ne(tok.get$kind(), 58/*TokenKind.STRING*/)) {
|
| - this._errorExpected('interpolated string');
|
| + this._errorExpected("interpolated string");
|
| }
|
| - var text = startQuote + tok.get$text();
|
| - lits.add$1(this.makeStringLiteral(text, tok.get$span()));
|
| + pieces.add$1(this._makeLiteral(Value.fromString(tok.get$value(), tok.get$span())));
|
| var span = this._makeSpan(start);
|
| - return new LiteralExpression(lits, this._stringTypeRef(span), '\$\$\$', span);
|
| -}
|
| -Parser.prototype.makeStringLiteral = function(text, span) {
|
| - return new LiteralExpression(text, this._stringTypeRef(span), text, span);
|
| -}
|
| -Parser.prototype.stringLiteralExpr = function() {
|
| - var token = this._lang_next();
|
| - return this.makeStringLiteral(token.get$text(), token.get$span());
|
| + return new StringInterpExpression(pieces, span);
|
| }
|
| Parser.prototype.maybeStringLiteral = function() {
|
| var kind = this._peek();
|
| if ($eq(kind, 58/*TokenKind.STRING*/)) {
|
| - return parseStringLiteral(this._lang_next().get$text());
|
| + var t = this._lang_next();
|
| + return t.get$value();
|
| }
|
| else if ($eq(kind, 59/*TokenKind.STRING_PART*/)) {
|
| this._lang_next();
|
| - this._errorExpected('string literal, but found interpolated string start');
|
| - }
|
| - else if ($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/)) {
|
| - this._lang_next();
|
| - this._errorExpected('string literal, but found incomplete string');
|
| + this._errorExpected("string literal, but found interpolated string start");
|
| }
|
| return null;
|
| }
|
| @@ -9747,7 +9761,7 @@ Parser.prototype._specialIdentifier = function(includeOperators) {
|
| case 15/*TokenKind.ELLIPSIS*/:
|
|
|
| this._eat(15/*TokenKind.ELLIPSIS*/);
|
| - this._lang_error('rest no longer supported', this._previousToken.get$span());
|
| + this._lang_error("rest no longer supported", this._previousToken.get$span());
|
| name = this.identifier().get$name();
|
| break;
|
|
|
| @@ -9755,7 +9769,7 @@ Parser.prototype._specialIdentifier = function(includeOperators) {
|
|
|
| this._eat(109/*TokenKind.THIS*/);
|
| this._eat(14/*TokenKind.DOT*/);
|
| - name = ('this.' + this.identifier().get$name());
|
| + name = ("this." + this.identifier().get$name());
|
| break;
|
|
|
| case 74/*TokenKind.GET*/:
|
| @@ -9763,10 +9777,10 @@ Parser.prototype._specialIdentifier = function(includeOperators) {
|
| if (!includeOperators) return null;
|
| this._eat(74/*TokenKind.GET*/);
|
| if (this._peekIdentifier()) {
|
| - name = ('get:' + this.identifier().get$name());
|
| + name = ("get:" + this.identifier().get$name());
|
| }
|
| else {
|
| - name = 'get';
|
| + name = "get";
|
| }
|
| break;
|
|
|
| @@ -9775,10 +9789,10 @@ Parser.prototype._specialIdentifier = function(includeOperators) {
|
| if (!includeOperators) return null;
|
| this._eat(82/*TokenKind.SET*/);
|
| if (this._peekIdentifier()) {
|
| - name = ('set:' + this.identifier().get$name());
|
| + name = ("set:" + this.identifier().get$name());
|
| }
|
| else {
|
| - name = 'set';
|
| + name = "set";
|
| }
|
| break;
|
|
|
| @@ -9788,13 +9802,13 @@ Parser.prototype._specialIdentifier = function(includeOperators) {
|
| this._eat(81/*TokenKind.OPERATOR*/);
|
| var kind = this._peek();
|
| if ($eq(kind, 80/*TokenKind.NEGATE*/)) {
|
| - name = ':negate';
|
| + name = ":negate";
|
| this._lang_next();
|
| }
|
| else {
|
| name = TokenKind.binaryMethodName(kind);
|
| if (name == null) {
|
| - name = 'operator';
|
| + name = "operator";
|
| }
|
| else {
|
| this._lang_next();
|
| @@ -9830,29 +9844,6 @@ Parser.prototype.declaredIdentifier = function(includeOperators) {
|
| }
|
| return new DeclaredIdentifier(myType, name, this._makeSpan(start));
|
| }
|
| -Parser._hexDigit = function(c) {
|
| - if (c >= 48 && c <= 57) {
|
| - return c - 48;
|
| - }
|
| - else if (c >= 97 && c <= 102) {
|
| - return c - 87;
|
| - }
|
| - else if (c >= 65 && c <= 70) {
|
| - return c - 55;
|
| - }
|
| - else {
|
| - return -1;
|
| - }
|
| -}
|
| -Parser.parseHex = function(hex) {
|
| - var result = 0;
|
| - for (var i = 0;
|
| - i < hex.length; i++) {
|
| - var digit = Parser._hexDigit(hex.charCodeAt(i));
|
| - result = (result * 16) + digit;
|
| - }
|
| - return result;
|
| -}
|
| Parser.prototype.finishNewExpression = function(start, isConst) {
|
| var type = this.type(0);
|
| var name = null;
|
| @@ -9910,16 +9901,16 @@ Parser.prototype.finishTypedLiteral = function(start, isConst) {
|
| else if ($eq(typeArgs.get$length(), 2)) {
|
| var keyType = typeArgs.$index(0);
|
| if (!(keyType instanceof NameTypeReference) || $ne(keyType.get$name().get$name(), "String")) {
|
| - $globals.world.error('the key type of a map literal is implicitly "String"', keyType.get$span());
|
| + $globals.world.error("the key type of a map literal is implicitly \"String\"", keyType.get$span());
|
| }
|
| else {
|
| - $globals.world.warning('a map literal takes one type argument specifying the value type', keyType.get$span());
|
| + $globals.world.warning("a map literal takes one type argument specifying the value type", keyType.get$span());
|
| }
|
| }
|
| return this.finishMapLiteral(start, isConst, genericType);
|
| }
|
| else {
|
| - this._errorExpected('array or map literal');
|
| + this._errorExpected("array or map literal");
|
| }
|
| }
|
| Parser.prototype._readModifiers = function() {
|
| @@ -9989,7 +9980,7 @@ Parser.prototype._eatClosingAngle = function(depth) {
|
| return depth - 2;
|
| }
|
| else {
|
| - this._errorExpected('>');
|
| + this._errorExpected(">");
|
| return depth;
|
| }
|
| }
|
| @@ -10080,12 +10071,12 @@ Parser.prototype.formalParameter = function(inOptionalBlock) {
|
| var type = di.get$type();
|
| var name = di.get$name();
|
| if (name == null) {
|
| - this._lang_error('Formal parameter invalid', this._makeSpan(start));
|
| + this._lang_error("Formal parameter invalid", this._makeSpan(start));
|
| }
|
| var value = null;
|
| if (this._maybeEat(20/*TokenKind.ASSIGN*/)) {
|
| if (!inOptionalBlock) {
|
| - this._lang_error('default values only allowed inside [optional] section');
|
| + this._lang_error("default values only allowed inside [optional] section");
|
| }
|
| value = this.expression();
|
| }
|
| @@ -10095,7 +10086,7 @@ Parser.prototype.formalParameter = function(inOptionalBlock) {
|
| type = new FunctionTypeReference(false, func, func.get$span());
|
| }
|
| if (inOptionalBlock && value == null) {
|
| - value = new NullExpression(this._makeSpan(start));
|
| + value = this._makeLiteral(Value.fromNull(this._makeSpan(start)));
|
| }
|
| return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start));
|
| }
|
| @@ -10111,7 +10102,7 @@ Parser.prototype.formalParameterList = function() {
|
| while (this._maybeEat(11/*TokenKind.COMMA*/)) {
|
| if (this._maybeEat(4/*TokenKind.LBRACK*/)) {
|
| if (inOptionalBlock) {
|
| - this._lang_error('already inside an optional block', this._previousToken.get$span());
|
| + this._lang_error("already inside an optional block", this._previousToken.get$span());
|
| }
|
| inOptionalBlock = true;
|
| }
|
| @@ -10127,7 +10118,7 @@ Parser.prototype.formalParameterList = function() {
|
| Parser.prototype.identifier = function() {
|
| var tok = this._lang_next();
|
| if (!this._isIdentifier(tok.get$kind())) {
|
| - this._lang_error(('expected identifier, but found ' + tok), tok.get$span());
|
| + this._lang_error(("expected identifier, but found " + tok), tok.get$span());
|
| }
|
| return new Identifier(tok.get$text(), this._makeSpan(tok.get$start()));
|
| }
|
| @@ -10142,7 +10133,7 @@ Parser.prototype._makeFunction = function(expr, formals, body) {
|
| type = expr.get$type();
|
| }
|
| else {
|
| - this._lang_error('bad function body', expr.get$span());
|
| + 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 func = new FunctionDefinition(null, type, name, formals, null, null, body, span);
|
| @@ -10156,7 +10147,7 @@ Parser.prototype._makeDeclaredIdentifier = function(e) {
|
| return e;
|
| }
|
| else {
|
| - this._lang_error('expected declared identifier');
|
| + this._lang_error("expected declared identifier");
|
| return new DeclaredIdentifier(null, null, e.get$span());
|
| }
|
| }
|
| @@ -10165,7 +10156,7 @@ Parser.prototype._makeLabel = function(expr) {
|
| return expr.get$name();
|
| }
|
| else {
|
| - this._errorExpected('label');
|
| + this._errorExpected("label");
|
| return null;
|
| }
|
| }
|
| @@ -10176,8 +10167,8 @@ function IncompleteSourceException(token) {
|
| // Initializers done
|
| }
|
| IncompleteSourceException.prototype.toString = function() {
|
| - if (this.token.get$span() == null) return ('Unexpected ' + this.token);
|
| - return this.token.get$span().toMessageString(('Unexpected ' + this.token));
|
| + if (this.token.get$span() == null) return ("Unexpected " + this.token);
|
| + return this.token.get$span().toMessageString(("Unexpected " + this.token));
|
| }
|
| IncompleteSourceException.prototype.toString$0 = IncompleteSourceException.prototype.toString;
|
| // ********** Code for DivertedTokenSource **************
|
| @@ -10835,35 +10826,30 @@ SuperExpression.prototype.visit = function(visitor) {
|
| return visitor.visitSuperExpression(this);
|
| }
|
| SuperExpression.prototype.visit$1 = SuperExpression.prototype.visit;
|
| -// ********** Code for NullExpression **************
|
| -$inherits(NullExpression, Expression);
|
| -function NullExpression(span) {
|
| - // Initializers done
|
| - Expression.call(this, span);
|
| -}
|
| -NullExpression.prototype.visit = function(visitor) {
|
| - return visitor.visitNullExpression(this);
|
| -}
|
| -NullExpression.prototype.visit$1 = NullExpression.prototype.visit;
|
| // ********** Code for LiteralExpression **************
|
| $inherits(LiteralExpression, Expression);
|
| -function LiteralExpression(value, type, text, span) {
|
| +function LiteralExpression(value, span) {
|
| this.value = value;
|
| - this.type = type;
|
| - this.text = text;
|
| // Initializers done
|
| Expression.call(this, span);
|
| }
|
| LiteralExpression.prototype.get$value = function() { return this.value; };
|
| LiteralExpression.prototype.set$value = function(value) { return this.value = value; };
|
| -LiteralExpression.prototype.get$type = function() { return this.type; };
|
| -LiteralExpression.prototype.set$type = function(value) { return this.type = value; };
|
| -LiteralExpression.prototype.get$text = function() { return this.text; };
|
| -LiteralExpression.prototype.set$text = function(value) { return this.text = value; };
|
| LiteralExpression.prototype.visit = function(visitor) {
|
| return visitor.visitLiteralExpression(this);
|
| }
|
| LiteralExpression.prototype.visit$1 = LiteralExpression.prototype.visit;
|
| +// ********** Code for StringInterpExpression **************
|
| +$inherits(StringInterpExpression, Expression);
|
| +function StringInterpExpression(pieces, span) {
|
| + this.pieces = pieces;
|
| + // Initializers done
|
| + Expression.call(this, span);
|
| +}
|
| +StringInterpExpression.prototype.visit = function(visitor) {
|
| + return visitor.visitStringInterpExpression(this);
|
| +}
|
| +StringInterpExpression.prototype.visit$1 = StringInterpExpression.prototype.visit;
|
| // ********** Code for NameTypeReference **************
|
| $inherits(NameTypeReference, TypeReference);
|
| function NameTypeReference(isFinal, name, names, span) {
|
| @@ -11220,17 +11206,17 @@ Type.prototype._checkOverride = function(member) {
|
| }
|
| }
|
| Type.prototype._createNotEqualMember = function() {
|
| - var eq = this.get$members().$index(':eq');
|
| + var eq = this.get$members().$index(":eq");
|
| if (eq == null) {
|
| return;
|
| }
|
| - var ne = new MethodMember(':ne', this, eq.definition);
|
| + var ne = new MethodMember(":ne", this, eq.definition);
|
| ne.isGenerated = true;
|
| ne.returnType = eq.returnType;
|
| ne.parameters = eq.parameters;
|
| ne.isStatic = eq.isStatic;
|
| ne.isAbstract = eq.isAbstract;
|
| - this.get$members().$setindex(':ne', ne);
|
| + this.get$members().$setindex(":ne", ne);
|
| }
|
| Type.prototype._getMemberInParents = function(memberName) {
|
| if (this.get$isClass()) {
|
| @@ -11287,7 +11273,7 @@ Type.prototype.resolveMember = function(memberName) {
|
| }
|
| Type.prototype.ensureSubtypeOf = function(other, span, typeErrors) {
|
| if (!this.isSubtypeOf(other)) {
|
| - var msg = ('type ' + this.name + ' is not a subtype of ' + other.name);
|
| + var msg = ("type " + this.name + " is not a subtype of " + other.name);
|
| if (typeErrors) {
|
| $globals.world.error(msg, span);
|
| }
|
| @@ -11423,7 +11409,7 @@ ParameterType.prototype.get$span = function() {
|
| return this.typeParameter.span;
|
| }
|
| ParameterType.prototype.get$constructors = function() {
|
| - $globals.world.internalError('no constructors on type parameters yet');
|
| + $globals.world.internalError("no constructors on type parameters yet");
|
| }
|
| ParameterType.prototype.getCallMethod = function() {
|
| return this.extendsType.getCallMethod();
|
| @@ -11438,16 +11424,16 @@ ParameterType.prototype.resolveMember = function(memberName) {
|
| return this.extendsType.resolveMember(memberName);
|
| }
|
| ParameterType.prototype.getConstructor = function(constructorName) {
|
| - $globals.world.internalError('no constructors on type parameters yet');
|
| + $globals.world.internalError("no constructors on type parameters yet");
|
| }
|
| ParameterType.prototype.getOrMakeConcreteType = function(typeArgs) {
|
| - $globals.world.internalError('no concrete types of type parameters yet', this.get$span());
|
| + $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());
|
| + $globals.world.internalError("no subtypes of type parameters yet", this.get$span());
|
| }
|
| ParameterType.prototype.resolve = function() {
|
| if (this.typeParameter.extendsType != null) {
|
| @@ -11819,19 +11805,19 @@ DefinedType.prototype.get$isTop = function() {
|
| return this.name == null;
|
| }
|
| DefinedType.prototype.get$isObject = function() {
|
| - return this.library.get$isCore() && this.name == 'Object';
|
| + return this.library.get$isCore() && this.name == "Object";
|
| }
|
| DefinedType.prototype.get$isString = function() {
|
| - return this.library.get$isCore() && this.name == 'String' || this.library.get$isCoreImpl() && this.name == 'StringImplementation';
|
| + return this.library.get$isCore() && this.name == "String" || this.library.get$isCoreImpl() && this.name == "StringImplementation";
|
| }
|
| DefinedType.prototype.get$isBool = function() {
|
| - return this.library.get$isCore() && this.name == 'bool';
|
| + return this.library.get$isCore() && this.name == "bool";
|
| }
|
| DefinedType.prototype.get$isFunction = function() {
|
| - return this.library.get$isCore() && this.name == 'Function';
|
| + return this.library.get$isCore() && this.name == "Function";
|
| }
|
| DefinedType.prototype.get$isList = function() {
|
| - return this.library.get$isCore() && this.name == 'List';
|
| + return this.library.get$isCore() && this.name == "List";
|
| }
|
| DefinedType.prototype.get$isGeneric = function() {
|
| return this.typeParameters != null;
|
| @@ -11841,17 +11827,17 @@ DefinedType.prototype.get$span = function() {
|
| }
|
| DefinedType.prototype.get$typeofName = function() {
|
| if (!this.library.get$isCore()) return null;
|
| - if (this.get$isBool()) return 'boolean';
|
| - else if (this.get$isNum()) return 'number';
|
| - else if (this.get$isString()) return 'string';
|
| - else if (this.get$isFunction()) return 'function';
|
| + if (this.get$isBool()) return "boolean";
|
| + else if (this.get$isNum()) return "number";
|
| + else if (this.get$isString()) return "string";
|
| + else if (this.get$isFunction()) return "function";
|
| else return null;
|
| }
|
| DefinedType.prototype.get$isNum = function() {
|
| - return this.library != null && this.library.get$isCore() && (this.name == 'num' || this.name == 'int' || this.name == 'double');
|
| + return this.library != null && this.library.get$isCore() && (this.name == "num" || this.name == "int" || this.name == "double");
|
| }
|
| DefinedType.prototype.getCallMethod = function() {
|
| - return this.members.$index(':call');
|
| + return this.members.$index(":call");
|
| }
|
| DefinedType.prototype.getAllMembers = function() {
|
| return HashMapImplementation.HashMapImplementation$from$factory(this.members);
|
| @@ -11886,7 +11872,7 @@ DefinedType.prototype._resolveInterfaces = function(types) {
|
| var type = types.$index($$i);
|
| var resolvedInterface = this.resolveType(type, 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(("can not implement \"" + resolvedInterface.get$name() + "\": ") + "only native implementation allowed", type.get$span());
|
| }
|
| resolvedInterface.addDirectSubtype$1(this);
|
| interfaces.add$1(resolvedInterface);
|
| @@ -11956,7 +11942,7 @@ 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.$index(1).get$span());
|
| + $globals.world.error("more than one base class", typeDef.extendsTypes.$index(1).get$span());
|
| }
|
| var extendsTypeRef = typeDef.extendsTypes.$index(0);
|
| if ((extendsTypeRef instanceof GenericTypeReference)) {
|
| @@ -11965,11 +11951,11 @@ DefinedType.prototype.resolve = function() {
|
| }
|
| this.set$parent(this.resolveType(extendsTypeRef, true));
|
| if (!this.get$parent().get$isClass()) {
|
| - $globals.world.error('class may not extend an interface - use implements', typeDef.extendsTypes.$index(0).get$span());
|
| + $globals.world.error("class may not extend an interface - use implements", typeDef.extendsTypes.$index(0).get$span());
|
| }
|
| this.get$parent().addDirectSubtype(this);
|
| if (this._cycleInClassExtends()) {
|
| - $globals.world.error(('class "' + this.name + '" has a cycle in its inheritance chain'), extendsTypeRef.get$span());
|
| + $globals.world.error(("class \"" + this.name + "\" has a cycle in its inheritance chain"), extendsTypeRef.get$span());
|
| }
|
| }
|
| else {
|
| @@ -11980,22 +11966,22 @@ DefinedType.prototype.resolve = function() {
|
| }
|
| this.interfaces = this._resolveInterfaces(typeDef.implementsTypes);
|
| if (typeDef.defaultType != null) {
|
| - $globals.world.error('default not allowed on classes', typeDef.defaultType.span);
|
| + $globals.world.error("default not allowed on classes", typeDef.defaultType.span);
|
| }
|
| }
|
| else {
|
| if (typeDef.implementsTypes != null && typeDef.implementsTypes.get$length() > 0) {
|
| - $globals.world.error('implements not allowed on interfaces (use extends)', typeDef.implementsTypes.$index(0).get$span());
|
| + $globals.world.error("implements not allowed on interfaces (use extends)", typeDef.implementsTypes.$index(0).get$span());
|
| }
|
| this.interfaces = this._resolveInterfaces(typeDef.extendsTypes);
|
| var res = this._cycleInInterfaceExtends();
|
| if (res >= 0) {
|
| - $globals.world.error(('interface "' + this.name + '" has a cycle in its inheritance chain'), typeDef.extendsTypes.$index(res).get$span());
|
| + $globals.world.error(("interface \"" + this.name + "\" has a cycle in its inheritance chain"), typeDef.extendsTypes.$index(res).get$span());
|
| }
|
| if (typeDef.defaultType != null) {
|
| this.defaultType = this.resolveType(typeDef.defaultType.baseType, true);
|
| if (this.defaultType == null) {
|
| - $globals.world.warning('unresolved default class', typeDef.defaultType.span);
|
| + $globals.world.warning("unresolved default class", typeDef.defaultType.span);
|
| }
|
| else {
|
| this.defaultType._resolveTypeParams(typeDef.defaultType.typeParameters);
|
| @@ -12044,7 +12030,7 @@ DefinedType.prototype.addMethod = function(methodName, definition) {
|
| var method = new MethodMember(methodName, this, definition);
|
| if (method.get$isConstructor()) {
|
| if (this.constructors.containsKey(method.get$constructorName())) {
|
| - $globals.world.error(('duplicate constructor definition of ' + method.get$name()), definition.span);
|
| + $globals.world.error(("duplicate constructor definition of " + method.get$name()), definition.span);
|
| return;
|
| }
|
| this.constructors.$setindex(method.get$constructorName(), method);
|
| @@ -12052,13 +12038,13 @@ DefinedType.prototype.addMethod = function(methodName, definition) {
|
| }
|
| if (definition.modifiers != null && definition.modifiers.get$length() == 1 && $eq(definition.modifiers.$index(0).get$kind(), 73/*TokenKind.FACTORY*/)) {
|
| if (this.factories.getFactory(method.get$constructorName(), method.get$name()) != null) {
|
| - $globals.world.error(('duplicate factory definition of "' + method.get$name() + '"'), definition.span);
|
| + $globals.world.error(("duplicate factory definition of \"" + method.get$name() + "\""), definition.span);
|
| return;
|
| }
|
| this.factories.addFactory(method.get$constructorName(), method.get$name(), method);
|
| return;
|
| }
|
| - if (methodName.startsWith('get:') || methodName.startsWith('set:')) {
|
| + if (methodName.startsWith("get:") || methodName.startsWith("set:")) {
|
| var propName = methodName.substring(4);
|
| var prop = this.members.$index(propName);
|
| if (prop == null) {
|
| @@ -12066,25 +12052,25 @@ DefinedType.prototype.addMethod = function(methodName, definition) {
|
| this.members.$setindex(propName, prop);
|
| }
|
| if (!(prop instanceof PropertyMember)) {
|
| - $globals.world.error(('property conflicts with field "' + propName + '"'), definition.span);
|
| + $globals.world.error(("property conflicts with field \"" + propName + "\""), definition.span);
|
| return;
|
| }
|
| - if (methodName[0] == 'g') {
|
| + if (methodName[0] == "g") {
|
| if (prop.get$getter() != null) {
|
| - $globals.world.error(('duplicate getter definition for "' + propName + '"'), definition.span);
|
| + $globals.world.error(("duplicate getter definition for \"" + propName + "\""), definition.span);
|
| }
|
| prop.set$getter(method);
|
| }
|
| else {
|
| if (prop.get$setter() != null) {
|
| - $globals.world.error(('duplicate setter definition for "' + propName + '"'), definition.span);
|
| + $globals.world.error(("duplicate setter definition for \"" + propName + "\""), definition.span);
|
| }
|
| prop.set$setter(method);
|
| }
|
| return;
|
| }
|
| if (this.members.containsKey(methodName)) {
|
| - $globals.world.error(('duplicate method definition of "' + method.get$name() + '"'), definition.span);
|
| + $globals.world.error(("duplicate method definition of \"" + method.get$name() + "\""), definition.span);
|
| return;
|
| }
|
| this.members.$setindex(methodName, method);
|
| @@ -12094,7 +12080,7 @@ DefinedType.prototype.addField = function(definition) {
|
| i < definition.names.get$length(); i++) {
|
| var name = definition.names.$index(i).get$name();
|
| if (this.members.containsKey(name)) {
|
| - $globals.world.error(('duplicate field definition of "' + name + '"'), definition.span);
|
| + $globals.world.error(("duplicate field definition of \"" + name + "\""), definition.span);
|
| return;
|
| }
|
| var value = null;
|
| @@ -12142,8 +12128,7 @@ DefinedType.prototype._checkDefaultTypeParams = function() {
|
| var defaultParams = toList(typeDef.defaultType.typeParameters);
|
| var classParams = toList(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'/*'"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());
|
| + $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;
|
| @@ -12153,25 +12138,22 @@ DefinedType.prototype._checkDefaultTypeParams = function() {
|
| 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'/*'default class must have the same type parameter names as '
|
| - + 'the class and interface'*/, ip.get$span(), dp.get$span(), cp.get$span());
|
| + $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'/*'default class type parameters must have the same extends '
|
| - + 'as the class does'*/, dp.get$span(), cp.get$span());
|
| + $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'/*'"default" can only have tighter type parameter "extends"'
|
| - + ' than the interface'*/, dp.get$span(), ip.get$span());
|
| + $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) {
|
| + if (name == "" && this.definition != null && this.isClass && this.constructors.get$length() == 0) {
|
| var span = this.definition.span;
|
| var inits = null, native_ = null, body = null;
|
| if (this.isNative) {
|
| - native_ = '';
|
| + native_ = "";
|
| inits = null;
|
| }
|
| else {
|
| @@ -12181,8 +12163,8 @@ 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();
|
| - return this.constructors.$index('');
|
| + this.constructors.$index("").resolve$0();
|
| + return this.constructors.$index("");
|
| }
|
| return null;
|
| }
|
| @@ -12214,9 +12196,9 @@ DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) {
|
| names.add$1(typeArgs.$index(i).get$name());
|
| jsnames.add$1(typeArgs.$index(i).get$jsname());
|
| }
|
| - var jsname = ('' + this.get$jsname() + '_' + Strings.join(jsnames, '\$'));
|
| - var simpleName = ('' + this.name + '<' + Strings.join(names, ', ') + '>');
|
| - var key = Strings.join(names, '\$');
|
| + 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);
|
| @@ -12226,7 +12208,7 @@ DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) {
|
| return ret;
|
| }
|
| DefinedType.prototype.getCallStub = function(args) {
|
| - var name = _getCallStubName('call', args);
|
| + var name = _getCallStubName("call", args);
|
| var stub = this.varStubs.$index(name);
|
| if (stub == null) {
|
| stub = new VarFunctionStub(name, args);
|
| @@ -12252,11 +12234,11 @@ function NativeType(name) {
|
| this.name = name;
|
| // Initializers done
|
| while (true) {
|
| - if (this.name.startsWith('@')) {
|
| + if (this.name.startsWith("@")) {
|
| this.name = this.name.substring(1);
|
| this.isJsGlobalObject = true;
|
| }
|
| - else if (this.name.startsWith('*')) {
|
| + else if (this.name.startsWith("*")) {
|
| this.name = this.name.substring(1);
|
| this.isConstructorHidden = true;
|
| }
|
| @@ -12264,7 +12246,7 @@ function NativeType(name) {
|
| break;
|
| }
|
| }
|
| - if (this.name.startsWith('=')) {
|
| + if (this.name.startsWith("=")) {
|
| this.name = this.name.substring(1);
|
| this.isSingleton = true;
|
| }
|
| @@ -12355,7 +12337,7 @@ function Value(_type, code, span, needsTemp) {
|
| this.span = span;
|
| this.needsTemp = needsTemp;
|
| // Initializers done
|
| - if (this._type == null) $globals.world.internalError('type passed as null', this.span);
|
| + if (this._type == null) $globals.world.internalError("type passed as null", this.span);
|
| }
|
| Value.type$ctor = function(_type, span) {
|
| this.isSuper = false
|
| @@ -12368,7 +12350,7 @@ Value.type$ctor = function(_type, span) {
|
| this.needsTemp = false;
|
| this.isType = true;
|
| // Initializers done
|
| - if (this._type == null) $globals.world.internalError('type passed as null', this.span);
|
| + if (this._type == null) $globals.world.internalError("type passed as null", this.span);
|
| }
|
| Value.type$ctor.prototype = Value.prototype;
|
| Value.prototype.get$code = function() { return this.code; };
|
| @@ -12411,7 +12393,7 @@ Value.prototype.get_ = function(context, name, node) {
|
| return member._get$3(context, node, this);
|
| }
|
| else {
|
| - return this.invokeNoSuchMethod(context, ('get:' + name), node);
|
| + return this.invokeNoSuchMethod(context, ("get:" + name), node);
|
| }
|
| }
|
| Value.prototype.set_ = function(context, name, node, value, isDynamic) {
|
| @@ -12420,13 +12402,13 @@ Value.prototype.set_ = function(context, name, node, value, isDynamic) {
|
| return member._set$5(context, node, this, value, isDynamic);
|
| }
|
| else {
|
| - return this.invokeNoSuchMethod(context, ('set:' + name), node, new Arguments(null, [value]));
|
| + return this.invokeNoSuchMethod(context, ("set:" + name), node, new Arguments(null, [value]));
|
| }
|
| }
|
| Value.prototype.invoke = function(context, name, node, args, isDynamic) {
|
| - if (name == ':call') {
|
| + if (name == ":call") {
|
| if (this.isType) {
|
| - $globals.world.error('must use "new" or "const" to construct a new instance', node.span);
|
| + $globals.world.error("must use \"new\" or \"const\" to construct a new instance", node.span);
|
| }
|
| if (this.get$type().needsVarCall(args)) {
|
| return this._varCall(context, node, args);
|
| @@ -12441,7 +12423,7 @@ Value.prototype.invoke = function(context, name, node, args, isDynamic) {
|
| }
|
| }
|
| Value.prototype.canInvoke = function(context, name, args) {
|
| - if (this.get$type().get$isVarOrFunction() && name == ':call') {
|
| + if (this.get$type().get$isVarOrFunction() && name == ":call") {
|
| return true;
|
| }
|
| var member = this._resolveMember(context, name, null, true);
|
| @@ -12449,11 +12431,11 @@ Value.prototype.canInvoke = function(context, name, args) {
|
| }
|
| Value.prototype._hasOverriddenNoSuchMethod = function() {
|
| if (this.isSuper) {
|
| - var m = this.get$type().getMember('noSuchMethod');
|
| + var m = this.get$type().getMember("noSuchMethod");
|
| return m != null && !m.get$declaringType().get$isObject();
|
| }
|
| else {
|
| - var m = this.get$type().resolveMember('noSuchMethod');
|
| + var m = this.get$type().resolveMember("noSuchMethod");
|
| return m != null && m.get$members().get$length() > 1;
|
| }
|
| }
|
| @@ -12471,13 +12453,13 @@ Value.prototype._resolveMember = function(context, name, node, isDynamic) {
|
| member = this._tryResolveMember(context, name);
|
| if (member != null && this.isType && !member.get$isStatic()) {
|
| if (!isDynamic) {
|
| - $globals.world.error('can not refer to instance member as static', node.span);
|
| + $globals.world.error("can not refer to instance member as static", node.span);
|
| }
|
| return null;
|
| }
|
| if (member == null && !isDynamic && !this._hasOverriddenNoSuchMethod()) {
|
| var typeName = this.get$type().name == null ? this.get$type().get$library().name : this.get$type().name;
|
| - var message = ('can not resolve "' + name + '" on "' + typeName + '"');
|
| + var message = ("can not resolve \"" + name + "\" on \"" + typeName + "\"");
|
| if (this.isType) {
|
| $globals.world.error(message, node.span);
|
| }
|
| @@ -12489,18 +12471,18 @@ Value.prototype._resolveMember = function(context, name, node, isDynamic) {
|
| if (member == null && !this.isSuper && !this.isType) {
|
| member = context.findMembers(name);
|
| if (member == null && !isDynamic) {
|
| - var where = 'the world';
|
| - if (name.startsWith('_')) {
|
| - where = ('library "' + context.get$library().name + '"');
|
| + var where = "the world";
|
| + if (name.startsWith("_")) {
|
| + where = ("library \"" + context.get$library().name + "\"");
|
| }
|
| - $globals.world.warning(('' + name + ' is not defined anywhere in ' + where + '.'), node.span);
|
| + $globals.world.warning(("" + name + " is not defined anywhere in " + where + "."), node.span);
|
| }
|
| }
|
| return member;
|
| }
|
| Value.prototype.checkFirstClass = function(span) {
|
| if (this.isType) {
|
| - $globals.world.error('Types are not first class', span);
|
| + $globals.world.error("Types are not first class", span);
|
| }
|
| }
|
| Value.prototype._varCall = function(context, node, args) {
|
| @@ -12520,7 +12502,7 @@ Value.prototype.convertTo = function(context, toType, isDynamic) {
|
| return this._maybeWrapFunction(toType, callMethod);
|
| }
|
| var fromType = this.get$type();
|
| - if (this.get$type().get$isVar() && (this.code != 'null' || !toType.get$isNullable())) {
|
| + if (this.get$type().get$isVar() && (this.code != "null" || !toType.get$isNullable())) {
|
| fromType = $globals.world.objectType;
|
| }
|
| var bothNum = this.get$type().get$isNum() && toType.get$isNum();
|
| @@ -12546,7 +12528,7 @@ Value.prototype._maybeWrapFunction = function(toType, callMethod) {
|
| var result = this;
|
| if (myCall == null || $ne(myCall.get$parameters().get$length(), arity)) {
|
| var stub = $globals.world.functionType.getCallStub(Arguments.Arguments$bare$factory(arity));
|
| - result = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), this.span, true);
|
| + result = new Value(toType, ("to$" + stub.name + "(" + this.code + ")"), this.span, true);
|
| }
|
| if (toType.get$library().get$isDom() && !this.get$type().get$library().get$isDom()) {
|
| if (arity == 0) {
|
| @@ -12555,7 +12537,7 @@ Value.prototype._maybeWrapFunction = function(toType, callMethod) {
|
| else {
|
| $globals.world.gen.corejs.useWrap1 = true;
|
| }
|
| - result = new Value(toType, ('\$wrap_call\$' + arity + '(' + result.code + ')'), this.span, true);
|
| + result = new Value(toType, ("$wrap_call$" + arity + "(" + result.code + ")"), this.span, true);
|
| }
|
| return result;
|
| }
|
| @@ -12565,45 +12547,45 @@ Value.prototype._typeAssert = function(context, toType, isDynamic) {
|
| toType = p.extendsType;
|
| }
|
| if (toType.get$isObject() || toType.get$isVar()) {
|
| - $globals.world.internalError(('We thought ' + this.get$type().name + ' is not a subtype of ' + toType.name + '?'));
|
| + $globals.world.internalError(("We thought " + this.get$type().name + " is not a subtype of " + toType.name + "?"));
|
| }
|
| function throwTypeError(paramName) {
|
| return $globals.world.withoutForceDynamic((function () {
|
| - var typeErrorCtor = $globals.world.typeErrorType.getConstructor('_internal');
|
| + var typeErrorCtor = $globals.world.typeErrorType.getConstructor("_internal");
|
| $globals.world.gen.corejs.ensureTypeNameOf();
|
| - var result = typeErrorCtor.invoke$5(context, null, new Value.type$ctor($globals.world.typeErrorType, null), new Arguments(null, [new Value($globals.world.objectType, paramName, null, true), new Value($globals.world.stringType, ('"' + toType.name + '"'), null, true)]), isDynamic);
|
| + var result = typeErrorCtor.invoke$5(context, null, new Value.type$ctor($globals.world.typeErrorType, null), new Arguments(null, [new Value($globals.world.objectType, paramName, null, true), new Value($globals.world.stringType, ("\"" + toType.name + "\""), null, true)]), isDynamic);
|
| $globals.world.gen.corejs.useThrow = true;
|
| - return ('\$throw(' + result.get$code() + ')');
|
| + return ("$throw(" + result.get$code() + ")");
|
| })
|
| );
|
| }
|
| if (toType.get$isNum()) toType = $globals.world.numType;
|
| var check;
|
| if (toType.get$isVoid()) {
|
| - check = ('\$assert_void(' + this.code + ')');
|
| + check = ("$assert_void(" + this.code + ")");
|
| if (toType.typeCheckCode == null) {
|
| toType.typeCheckCode = ("function $assert_void(x) {\n if (x == null) return null;\n " + throwTypeError("x") + "\n}");
|
| }
|
| }
|
| else if ($eq(toType, $globals.world.nonNullBool)) {
|
| $globals.world.gen.corejs.useNotNullBool = true;
|
| - check = ('\$notnull_bool(' + this.code + ')');
|
| + check = ("$notnull_bool(" + this.code + ")");
|
| }
|
| else if (toType.get$library().get$isCore() && toType.get$typeofName() != null) {
|
| - check = ('\$assert_' + toType.name + '(' + this.code + ')');
|
| + check = ("$assert_" + toType.name + "(" + this.code + ")");
|
| if (toType.typeCheckCode == null) {
|
| toType.typeCheckCode = ("function $assert_" + toType.name + "(x) {\n if (x == null || typeof(x) == \"" + toType.get$typeofName() + "\") return x;\n " + throwTypeError("x") + "\n}");
|
| }
|
| }
|
| else {
|
| toType.isChecked = true;
|
| - var checkName = 'assert\$' + toType.get$jsname();
|
| + var checkName = "assert$" + toType.get$jsname();
|
| var temp = context.getTemp(this);
|
| - check = ('(' + context.assignTemp(temp, this).code + ' == null ? null :');
|
| - check = check + (' ' + temp.get$code() + '.' + checkName + '())');
|
| + check = ("(" + context.assignTemp(temp, this).code + " == null ? null :");
|
| + check = 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('this'));
|
| + return new VarMethodStub(checkName, null, Arguments.get$EMPTY(), throwTypeError("this"));
|
| })
|
| );
|
| }
|
| @@ -12611,54 +12593,54 @@ Value.prototype._typeAssert = function(context, toType, isDynamic) {
|
| }
|
| Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) {
|
| if (toType.get$isVar()) {
|
| - $globals.world.error('can not resolve type', span);
|
| + $globals.world.error("can not resolve type", span);
|
| }
|
| var testCode = null;
|
| if (toType.get$isVar() || toType.get$isObject() || (toType instanceof ParameterType)) {
|
| if (this.needsTemp) {
|
| - return new Value($globals.world.nonNullBool, ('(' + this.code + ', true)'), span, true);
|
| + return new Value($globals.world.nonNullBool, ("(" + this.code + ", true)"), span, true);
|
| }
|
| else {
|
| - return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, true, 'true', null);
|
| + return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, true, "true", null);
|
| }
|
| }
|
| if (toType.get$library().get$isCore()) {
|
| var typeofName = toType.get$typeofName();
|
| if (typeofName != null) {
|
| - testCode = ("(typeof(" + this.code + ") " + (isTrue ? '==' : '!=') + " '" + typeofName + "')");
|
| + testCode = ("(typeof(" + this.code + ") " + (isTrue ? "==" : "!=") + " '" + typeofName + "')");
|
| }
|
| }
|
| if (toType.get$isClass() && !(toType instanceof ConcreteType) && !toType.get$isHiddenNativeType()) {
|
| toType.markUsed();
|
| - testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')');
|
| + testCode = ("(" + this.code + " instanceof " + toType.get$jsname() + ")");
|
| if (!isTrue) {
|
| - testCode = '!' + testCode;
|
| + testCode = "!" + testCode;
|
| }
|
| }
|
| if (testCode == null) {
|
| toType.isTested = true;
|
| var temp = context.getTemp(this);
|
| - var checkName = ('is\$' + toType.get$jsname());
|
| - testCode = ('(' + context.assignTemp(temp, this).code + ' &&');
|
| - testCode = testCode + (' ' + temp.get$code() + '.' + checkName + '())');
|
| + var checkName = ("is$" + toType.get$jsname());
|
| + testCode = ("(" + context.assignTemp(temp, this).code + " &&");
|
| + testCode = testCode + (" " + temp.get$code() + "." + checkName + "())");
|
| if (isTrue) {
|
| - testCode = '!!' + testCode;
|
| + testCode = "!!" + testCode;
|
| }
|
| else {
|
| - testCode = '!' + testCode;
|
| + testCode = "!" + testCode;
|
| }
|
| if ($ne(this, temp)) context.freeTemp(temp);
|
| if (!$globals.world.objectType.varStubs.containsKey(checkName)) {
|
| - $globals.world.objectType.varStubs.$setindex(checkName, new VarMethodStub(checkName, null, Arguments.get$EMPTY(), 'return false'));
|
| + $globals.world.objectType.varStubs.$setindex(checkName, new VarMethodStub(checkName, null, Arguments.get$EMPTY(), "return false"));
|
| }
|
| }
|
| return new Value($globals.world.nonNullBool, testCode, span, true);
|
| }
|
| Value.prototype.convertWarning = function(toType) {
|
| - $globals.world.warning(('type "' + this.get$type().name + '" is not assignable to "' + toType.name + '"'), this.span);
|
| + $globals.world.warning(("type \"" + this.get$type().name + "\" is not assignable to \"" + toType.name + "\""), this.span);
|
| }
|
| Value.prototype.invokeNoSuchMethod = function(context, name, node, args) {
|
| - var pos = '';
|
| + var pos = "";
|
| if (args != null) {
|
| var argsCode = [];
|
| for (var i = 0;
|
| @@ -12667,8 +12649,103 @@ Value.prototype.invokeNoSuchMethod = function(context, name, node, args) {
|
| }
|
| pos = Strings.join(argsCode, ", ");
|
| }
|
| - var noSuchArgs = [new Value($globals.world.stringType, ('"' + name + '"'), node.span, true), new Value($globals.world.listType, ('[' + pos + ']'), node.span, true)];
|
| - return this._resolveMember(context, 'noSuchMethod', node, false).invoke$4(context, node, this, new Arguments(null, noSuchArgs));
|
| + var noSuchArgs = [new Value($globals.world.stringType, ("\"" + name + "\""), node.span, true), new Value($globals.world.listType, ("[" + pos + "]"), node.span, true)];
|
| + return this._resolveMember(context, "noSuchMethod", node, false).invoke$4(context, node, this, new Arguments(null, noSuchArgs));
|
| +}
|
| +Value.fromBool = function(value, span) {
|
| + return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, value, value.toString(), span);
|
| +}
|
| +Value.fromInt = function(value, span) {
|
| + var strValue = value.toString();
|
| + return EvaluatedValue.EvaluatedValue$factory($globals.world.numType, value, strValue, span);
|
| +}
|
| +Value.fromDouble = function(value, span) {
|
| + var strValue = value.toString();
|
| + if ($eq(strValue.indexOf$1("."), -1) && $eq(strValue.indexOf$1("e"), -1)) {
|
| + strValue = strValue + ".0";
|
| + }
|
| + return EvaluatedValue.EvaluatedValue$factory($globals.world.numType, value, strValue, span);
|
| +}
|
| +Value.fromString = function(value, span) {
|
| + var buf = new StringBufferImpl("");
|
| + buf.add("\"");
|
| + for (var i = 0;
|
| + i < value.length; i++) {
|
| + var ch = value.charCodeAt(i);
|
| + switch (ch) {
|
| + case 9:
|
| +
|
| + buf.add("\\t");
|
| + break;
|
| +
|
| + case 10:
|
| +
|
| + buf.add("\\n");
|
| + break;
|
| +
|
| + case 13:
|
| +
|
| + buf.add("\\r");
|
| + break;
|
| +
|
| + case 34:
|
| +
|
| + buf.add("\\\"");
|
| + break;
|
| +
|
| + case 92:
|
| +
|
| + buf.add("\\\\");
|
| + break;
|
| +
|
| + default:
|
| +
|
| + if (ch >= 32 && ch <= 126) {
|
| + buf.add(value[i]);
|
| + }
|
| + else {
|
| + var hex = ch.toRadixString$1(16);
|
| + switch (hex.get$length()) {
|
| + case 1:
|
| +
|
| + buf.add("\\x0");
|
| + buf.add(hex);
|
| + break;
|
| +
|
| + case 2:
|
| +
|
| + buf.add("\\x");
|
| + buf.add(hex);
|
| + break;
|
| +
|
| + case 3:
|
| +
|
| + buf.add("\\u0");
|
| + buf.add(hex);
|
| + break;
|
| +
|
| + case 4:
|
| +
|
| + buf.add("\\u");
|
| + buf.add(hex);
|
| + break;
|
| +
|
| + default:
|
| +
|
| + $globals.world.internalError("unicode values greater than 2 bytes not implemented");
|
| + break;
|
| +
|
| + }
|
| + }
|
| + break;
|
| +
|
| + }
|
| + }
|
| + buf.add("\"");
|
| + return EvaluatedValue.EvaluatedValue$factory($globals.world.stringType, value, buf.toString(), span);
|
| +}
|
| +Value.fromNull = function(span) {
|
| + return EvaluatedValue.EvaluatedValue$factory($globals.world.varType, null, "null", span);
|
| }
|
| Value.prototype.checkFirstClass$1 = Value.prototype.checkFirstClass;
|
| Value.prototype.convertTo$2 = function($0, $1) {
|
| @@ -12713,7 +12790,7 @@ EvaluatedValue.prototype.get$constValue = function() {
|
| EvaluatedValue.prototype.get$canonicalCode = function() { return this.canonicalCode; };
|
| EvaluatedValue.prototype.set$canonicalCode = function(value) { return this.canonicalCode = value; };
|
| EvaluatedValue.codeWithComments = function(canonicalCode, span) {
|
| - return (span != null && span.get$text() != canonicalCode) ? ('' + canonicalCode + '/*' + _escapeForComment(span.get$text()) + '*/') : canonicalCode;
|
| + return canonicalCode;
|
| }
|
| // ********** Code for ConstListValue **************
|
| $inherits(ConstListValue, EvaluatedValue);
|
| @@ -12762,13 +12839,13 @@ ConstObjectValue.ConstObjectValue$factory = function(type, fields, canonicalCode
|
| var $$list = fields.getKeys();
|
| for (var $$i = fields.getKeys().iterator$0(); $$i.hasNext$0(); ) {
|
| var f = $$i.next$0();
|
| - fieldValues.add(('' + f + ' = ' + fields.$index(f).get$actualValue()));
|
| + fieldValues.add(("" + f + " = " + fields.$index(f).get$actualValue()));
|
| }
|
| fieldValues.sort((function (a, b) {
|
| return a.compareTo$1(b);
|
| })
|
| );
|
| - var actualValue = ('const ' + type.get$jsname() + ' [') + Strings.join(fieldValues, ',') + ']';
|
| + var actualValue = ("const " + type.get$jsname() + " [") + Strings.join(fieldValues, ",") + "]";
|
| return new ConstObjectValue._internal$ctor(type, fields, actualValue, canonicalCode, span, EvaluatedValue.codeWithComments(canonicalCode, span));
|
| }
|
| ConstObjectValue.prototype.get$fields = function() { return this.fields; };
|
| @@ -12791,14 +12868,14 @@ function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span,
|
| }
|
| GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies) {
|
| var code = (exp.get$isConst() ? exp.get$canonicalCode() : exp.code);
|
| - var codeWithComment = ('' + code + '/*' + field.get$declaringType().get$name() + '.' + field.get$name() + '*/');
|
| + var codeWithComment = ("" + code + "/*" + field.get$declaringType().get$name() + "." + field.get$name() + "*/");
|
| return new GlobalValue(exp.get$type(), codeWithComment, field.get$isFinal(), field, null, exp, code, exp.span, dependencies.filter$1((function (d) {
|
| return (d instanceof GlobalValue);
|
| })
|
| ));
|
| }
|
| GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies) {
|
| - var name = ("const\$" + uniqueId);
|
| + var name = ("const$" + uniqueId);
|
| var codeWithComment = ("" + name + "/*" + _escapeForComment(exp.span.get$text()) + "*/");
|
| return new GlobalValue(exp.get$type(), codeWithComment, true, null, name, exp, name, exp.span, dependencies.filter$1((function (d) {
|
| return (d instanceof GlobalValue);
|
| @@ -12898,10 +12975,10 @@ function CompilerException(_message, _location) {
|
| }
|
| CompilerException.prototype.toString = function() {
|
| if (this._location != null) {
|
| - return ('CompilerException: ' + this._location.toMessageString(this._lang_message));
|
| + return ("CompilerException: " + this._location.toMessageString(this._lang_message));
|
| }
|
| else {
|
| - return ('CompilerException: ' + this._lang_message);
|
| + return ("CompilerException: " + this._lang_message);
|
| }
|
| }
|
| CompilerException.prototype.toString$0 = CompilerException.prototype.toString;
|
| @@ -12923,28 +13000,28 @@ function World(files) {
|
| World.prototype.get$functionType = function() { return this.functionType; };
|
| World.prototype.set$functionType = function(value) { return this.functionType = value; };
|
| World.prototype.init = function() {
|
| - this.corelib = new Library(this.readFile('dart:core'));
|
| - this.libraries.$setindex('dart:core', this.corelib);
|
| + this.corelib = new Library(this.readFile("dart:core"));
|
| + this.libraries.$setindex("dart:core", this.corelib);
|
| this._todo.add(this.corelib);
|
| - this.coreimpl = this.getOrAddLibrary('dart:coreimpl');
|
| - this.voidType = this.corelib.addType('void', null, false);
|
| - this.dynamicType = this.corelib.addType('Dynamic', null, false);
|
| + this.coreimpl = this.getOrAddLibrary("dart:coreimpl");
|
| + this.voidType = this.corelib.addType("void", null, false);
|
| + this.dynamicType = this.corelib.addType("Dynamic", null, false);
|
| this.varType = this.dynamicType;
|
| - this.objectType = this.corelib.addType('Object', null, true);
|
| - this.numType = this.corelib.addType('num', null, false);
|
| - this.intType = this.corelib.addType('int', null, false);
|
| - this.doubleType = this.corelib.addType('double', null, false);
|
| - this.boolType = this.corelib.addType('bool', null, false);
|
| - this.stringType = this.corelib.addType('String', null, false);
|
| - this.listType = this.corelib.addType('List', null, false);
|
| - this.mapType = this.corelib.addType('Map', null, false);
|
| - this.functionType = this.corelib.addType('Function', null, false);
|
| - this.typeErrorType = this.corelib.addType('TypeError', null, false);
|
| - this.numImplType = this.coreimpl.addType('NumImplementation', null, true);
|
| - this.stringImplType = this.coreimpl.addType('StringImplementation', null, true);
|
| - this.immutableListType = this.coreimpl.addType('ImmutableList', null, true);
|
| - this.listFactoryType = this.coreimpl.addType('ListFactory', null, true);
|
| - this.functionImplType = this.coreimpl.addType('_FunctionImplementation', null, true);
|
| + this.objectType = this.corelib.addType("Object", null, true);
|
| + this.numType = this.corelib.addType("num", null, false);
|
| + this.intType = this.corelib.addType("int", null, false);
|
| + this.doubleType = this.corelib.addType("double", null, false);
|
| + this.boolType = this.corelib.addType("bool", null, false);
|
| + this.stringType = this.corelib.addType("String", null, false);
|
| + this.listType = this.corelib.addType("List", null, false);
|
| + this.mapType = this.corelib.addType("Map", null, false);
|
| + this.functionType = this.corelib.addType("Function", null, false);
|
| + this.typeErrorType = this.corelib.addType("TypeError", null, false);
|
| + this.numImplType = this.coreimpl.addType("NumImplementation", null, true);
|
| + this.stringImplType = this.coreimpl.addType("StringImplementation", null, true);
|
| + this.immutableListType = this.coreimpl.addType("ImmutableList", null, true);
|
| + this.listFactoryType = this.coreimpl.addType("ListFactory", null, true);
|
| + this.functionImplType = this.coreimpl.addType("_FunctionImplementation", null, true);
|
| this.nonNullBool = new NonNullableType(this.boolType);
|
| }
|
| World.prototype._addMember = function(member) {
|
| @@ -12977,7 +13054,7 @@ World.prototype._addJavascriptTopName = function(named, name) {
|
| }
|
| }
|
| else if (existing != null) {
|
| - 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(("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) {
|
| @@ -12987,7 +13064,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 = ("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());
|
| }
|
| @@ -13001,10 +13078,10 @@ World.prototype._addJavascriptTopName = function(named, name) {
|
| }
|
| }
|
| World.prototype._renameJavascriptTopName = function(named) {
|
| - named._jsname = ('' + named.get$library().get$jsname() + '_' + named.get$jsname());
|
| + 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());
|
| + $globals.world.internalError(("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);
|
| }
|
| @@ -13014,13 +13091,13 @@ World.prototype._addType = function(type) {
|
| World.prototype.toJsIdentifier = function(name) {
|
| if (name == null) return null;
|
| if (this._jsKeywords == null) {
|
| - 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']);
|
| + 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 name + "_";
|
| }
|
| else {
|
| - return name.replaceAll("$", "$$").replaceAll(':', "$");
|
| + return name.replaceAll("$", "$$").replaceAll(":", "$");
|
| }
|
| }
|
| World.prototype.compileAndSave = function() {
|
| @@ -13028,25 +13105,24 @@ World.prototype.compileAndSave = function() {
|
| if ($globals.options.outfile != null) {
|
| if (success) {
|
| var code = $globals.world.getGeneratedCode();
|
| - if (!$globals.options.outfile.endsWith('.js')) {
|
| - code = '#!/usr/bin/env node\n' + code;
|
| + if (!$globals.options.outfile.endsWith(".js")) {
|
| + code = "#!/usr/bin/env node\n" + code;
|
| }
|
| $globals.world.files.writeString($globals.options.outfile, code);
|
| }
|
| else {
|
| - $globals.world.files.writeString($globals.options.outfile, "throw 'Sorry, but I could not generate reasonable code to run.\\n';"/*"throw " +
|
| - "'Sorry, but I could not generate reasonable code to run.\\n';"*/);
|
| + $globals.world.files.writeString($globals.options.outfile, "throw 'Sorry, but I could not generate reasonable code to run.\\n';");
|
| }
|
| }
|
| return success;
|
| }
|
| World.prototype.compile = function() {
|
| if ($globals.options.dartScript == null) {
|
| - this.fatal('no script provided to compile');
|
| + this.fatal("no script provided to compile");
|
| return false;
|
| }
|
| try {
|
| - this.info(('compiling ' + $globals.options.dartScript + ' with corelib ' + this.corelib));
|
| + this.info(("compiling " + $globals.options.dartScript + " with corelib " + this.corelib));
|
| if (!this.runLeg()) this.runCompilationPhases();
|
| } catch (exc) {
|
| exc = _toDartException(exc);
|
| @@ -13063,9 +13139,9 @@ World.prototype.runLeg = function() {
|
| var $this = this; // closure support
|
| if (!$globals.options.enableLeg) return false;
|
| if ($globals.legCompile == null) {
|
| - this.fatal('requested leg enabled, but no leg compiler available');
|
| + this.fatal("requested leg enabled, but no leg compiler available");
|
| }
|
| - var res = this.withTiming('try leg compile', (function () {
|
| + var res = this.withTiming("try leg compile", (function () {
|
| return $globals.legCompile($this);
|
| })
|
| );
|
| @@ -13077,15 +13153,15 @@ World.prototype.runLeg = function() {
|
| }
|
| World.prototype.runCompilationPhases = function() {
|
| var $this = this; // closure support
|
| - var lib = this.withTiming('first pass', (function () {
|
| + var lib = this.withTiming("first pass", (function () {
|
| return $this.processDartScript();
|
| })
|
| );
|
| - this.withTiming('resolve top level', this.get$resolveAll());
|
| + this.withTiming("resolve top level", this.get$resolveAll());
|
| if ($globals.experimentalAwaitPhase != null) {
|
| - this.withTiming('await translation', to$call$0($globals.experimentalAwaitPhase));
|
| + this.withTiming("await translation", to$call$0($globals.experimentalAwaitPhase));
|
| }
|
| - this.withTiming('generate code', (function () {
|
| + this.withTiming("generate code", (function () {
|
| $this.generateCode(lib);
|
| })
|
| );
|
| @@ -13105,15 +13181,15 @@ World.prototype.readFile = function(filename) {
|
| return sourceFile;
|
| } catch (e) {
|
| e = _toDartException(e);
|
| - this.warning(('Error reading file: ' + filename));
|
| - return new SourceFile(filename, '');
|
| + this.warning(("Error reading file: " + filename));
|
| + return new SourceFile(filename, "");
|
| }
|
| }
|
| World.prototype.getOrAddLibrary = function(filename) {
|
| var library = this.libraries.$index(filename);
|
| if (library == null) {
|
| library = new Library(this.readFile(filename));
|
| - this.info(('read library ' + filename));
|
| + this.info(("read library " + filename));
|
| if (!library.get$isCore() && !library.imports.some((function (li) {
|
| return li.get$library().get$isCore();
|
| })
|
| @@ -13122,7 +13198,7 @@ World.prototype.getOrAddLibrary = function(filename) {
|
| }
|
| this.libraries.$setindex(filename, library);
|
| this._todo.add(library);
|
| - if (filename == 'dart:dom') {
|
| + if (filename == "dart:dom") {
|
| this.dom = library;
|
| }
|
| }
|
| @@ -13155,17 +13231,17 @@ World.prototype.get$resolveAll = function() {
|
| return this.resolveAll.bind(this);
|
| }
|
| World.prototype.findMainMethod = function(lib) {
|
| - var mainMembers = lib.topType.resolveMember('main');
|
| + var mainMembers = lib.topType.resolveMember("main");
|
| var main = null;
|
| if (mainMembers == null || $eq(mainMembers.get$members().get$length(), 0)) {
|
| - this.fatal('no main method specified');
|
| + this.fatal("no main method specified");
|
| }
|
| else if (mainMembers.get$members().get$length() > 1) {
|
| var $$list = mainMembers.get$members();
|
| for (var $$i = mainMembers.get$members().iterator$0(); $$i.hasNext$0(); ) {
|
| var m = $$i.next$0();
|
| main = m;
|
| - this.error('more than one main member (using last?)', main.get$span());
|
| + this.error("more than one main member (using last?)", main.get$span());
|
| }
|
| }
|
| else {
|
| @@ -13209,7 +13285,7 @@ World.prototype._message = function(color, prefix, message, span, span1, span2,
|
| }
|
| World.prototype.error = function(message, span, span1, span2) {
|
| this.errors++;
|
| - this._message($globals._RED_COLOR, 'error: ', message, span, span1, span2, $globals.options.throwOnErrors);
|
| + this._message($globals._RED_COLOR, "error: ", message, span, span1, span2, $globals.options.throwOnErrors);
|
| }
|
| World.prototype.warning = function(message, span, span1, span2) {
|
| if ($globals.options.warningsAsErrors) {
|
| @@ -13218,20 +13294,20 @@ World.prototype.warning = function(message, span, span1, span2) {
|
| }
|
| this.warnings++;
|
| if ($globals.options.showWarnings) {
|
| - this._message($globals._MAGENTA_COLOR, 'warning: ', message, span, span1, span2, $globals.options.throwOnWarnings);
|
| + this._message($globals._MAGENTA_COLOR, "warning: ", message, span, span1, span2, $globals.options.throwOnWarnings);
|
| }
|
| }
|
| World.prototype.fatal = function(message, span, span1, span2) {
|
| this.errors++;
|
| this.seenFatal = true;
|
| - this._message($globals._RED_COLOR, 'fatal: ', message, span, span1, span2, $globals.options.throwOnFatal || $globals.options.throwOnErrors);
|
| + this._message($globals._RED_COLOR, "fatal: ", message, span, span1, span2, $globals.options.throwOnFatal || $globals.options.throwOnErrors);
|
| }
|
| World.prototype.internalError = function(message, span, span1, span2) {
|
| - this._message($globals._NO_COLOR, 'We are sorry, but...', message, span, span1, span2, true);
|
| + this._message($globals._NO_COLOR, "We are sorry, but...", message, span, span1, span2, true);
|
| }
|
| World.prototype.info = function(message, span, span1, span2) {
|
| if ($globals.options.showInfo) {
|
| - this._message($globals._GREEN_COLOR, 'info: ', message, span, span1, span2, false);
|
| + this._message($globals._GREEN_COLOR, "info: ", message, span, span1, span2, false);
|
| }
|
| }
|
| World.prototype.withoutForceDynamic = function(fn) {
|
| @@ -13247,16 +13323,16 @@ World.prototype.get$hasErrors = function() {
|
| return this.errors > 0;
|
| }
|
| World.prototype.printStatus = function() {
|
| - this.info(('compiled ' + this.dartBytesRead + ' bytes Dart -> ' + this.jsBytesWritten + ' bytes JS'));
|
| + this.info(("compiled " + this.dartBytesRead + " bytes Dart -> " + this.jsBytesWritten + " bytes JS"));
|
| if (this.get$hasErrors()) {
|
| - print(('compilation failed with ' + this.errors + ' errors'));
|
| + print(("compilation failed with " + this.errors + " errors"));
|
| }
|
| else {
|
| if (this.warnings > 0) {
|
| - this.info(('compilation completed successfully with ' + this.warnings + ' warnings'));
|
| + this.info(("compilation completed successfully with " + this.warnings + " warnings"));
|
| }
|
| else {
|
| - this.info('compilation completed sucessfully');
|
| + this.info("compilation completed sucessfully");
|
| }
|
| }
|
| }
|
| @@ -13265,12 +13341,12 @@ World.prototype.withTiming = function(name, f) {
|
| sw.start();
|
| var result = f();
|
| sw.stop();
|
| - this.info(('' + name + ' in ' + sw.elapsedInMs() + 'msec'));
|
| + this.info(("" + name + " in " + sw.elapsedInMs() + "msec"));
|
| return result;
|
| }
|
| // ********** Code for FrogOptions **************
|
| function FrogOptions(homedir, args, files) {
|
| - this.config = 'dev'
|
| + this.config = "dev"
|
| this.enableLeg = false
|
| this.legOnly = false
|
| this.enableAsserts = false
|
| @@ -13288,15 +13364,15 @@ function FrogOptions(homedir, args, files) {
|
| this.showWarnings = true
|
| this.useColors = true
|
| // Initializers done
|
| - if ($eq(this.config, 'dev')) {
|
| - this.libDir = joinPaths(homedir, '/lib');
|
| + if ($eq(this.config, "dev")) {
|
| + this.libDir = joinPaths(homedir, "/lib");
|
| }
|
| - else if ($eq(this.config, 'sdk')) {
|
| - this.libDir = joinPaths(homedir, '/../lib');
|
| + else if ($eq(this.config, "sdk")) {
|
| + this.libDir = joinPaths(homedir, "/../lib");
|
| }
|
| else {
|
| - $globals.world.error(('Invalid configuration ' + this.config));
|
| - $throw(('Invalid configuration'));
|
| + $globals.world.error(("Invalid configuration " + this.config));
|
| + $throw(("Invalid configuration"));
|
| }
|
| var ignoreUnrecognizedFlags = false;
|
| var passedLibDir = false;
|
| @@ -13306,131 +13382,131 @@ function FrogOptions(homedir, args, files) {
|
| i < args.get$length(); i++) {
|
| var arg = args.$index(i);
|
| switch (arg) {
|
| - case '--enable_leg':
|
| + case "--enable_leg":
|
|
|
| this.enableLeg = true;
|
| break;
|
|
|
| - case '--leg_only':
|
| + case "--leg_only":
|
|
|
| this.enableLeg = true;
|
| this.legOnly = true;
|
| break;
|
|
|
| - case '--enable_asserts':
|
| + case "--enable_asserts":
|
|
|
| this.enableAsserts = true;
|
| break;
|
|
|
| - case '--enable_type_checks':
|
| + case "--enable_type_checks":
|
|
|
| this.enableTypeChecks = true;
|
| this.enableAsserts = true;
|
| break;
|
|
|
| - case '--verify_implements':
|
| + case "--verify_implements":
|
|
|
| this.verifyImplements = true;
|
| break;
|
|
|
| - case '--compile_all':
|
| + case "--compile_all":
|
|
|
| this.compileAll = true;
|
| break;
|
|
|
| - case '--diet-parse':
|
| + case "--diet-parse":
|
|
|
| this.dietParse = true;
|
| break;
|
|
|
| - case '--ignore-unrecognized-flags':
|
| + case "--ignore-unrecognized-flags":
|
|
|
| ignoreUnrecognizedFlags = true;
|
| break;
|
|
|
| - case '--verbose':
|
| + case "--verbose":
|
|
|
| this.showInfo = true;
|
| break;
|
|
|
| - case '--suppress_warnings':
|
| + case "--suppress_warnings":
|
|
|
| this.showWarnings = false;
|
| break;
|
|
|
| - case '--warnings_as_errors':
|
| + case "--warnings_as_errors":
|
|
|
| this.warningsAsErrors = true;
|
| break;
|
|
|
| - case '--throw_on_errors':
|
| + case "--throw_on_errors":
|
|
|
| this.throwOnErrors = true;
|
| break;
|
|
|
| - case '--throw_on_warnings':
|
| + case "--throw_on_warnings":
|
|
|
| this.throwOnWarnings = true;
|
| break;
|
|
|
| - case '--compile-only':
|
| + case "--compile-only":
|
|
|
| this.compileOnly = true;
|
| break;
|
|
|
| - case '--force_dynamic':
|
| + case "--force_dynamic":
|
|
|
| this.forceDynamic = true;
|
| break;
|
|
|
| - case '--no_colors':
|
| + case "--no_colors":
|
|
|
| this.useColors = false;
|
| break;
|
|
|
| default:
|
|
|
| - if (arg.endsWith$1('.dart')) {
|
| + if (arg.endsWith$1(".dart")) {
|
| this.dartScript = arg;
|
| this.childArgs = args.getRange(i + 1, args.get$length() - i - 1);
|
| break loop;
|
| }
|
| - else if (arg.startsWith$1('--out=')) {
|
| - this.outfile = arg.substring$1('--out='.length);
|
| + else if (arg.startsWith$1("--out=")) {
|
| + this.outfile = arg.substring$1("--out=".length);
|
| }
|
| - else if (arg.startsWith$1('--libdir=')) {
|
| - this.libDir = arg.substring$1('--libdir='.length);
|
| + else if (arg.startsWith$1("--libdir=")) {
|
| + this.libDir = arg.substring$1("--libdir=".length);
|
| passedLibDir = true;
|
| }
|
| else {
|
| if (!ignoreUnrecognizedFlags) {
|
| - print(('unrecognized flag: "' + arg + '"'));
|
| + print(("unrecognized flag: \"" + arg + "\""));
|
| }
|
| }
|
|
|
| }
|
| }
|
| - if (!passedLibDir && $eq(this.config, 'dev') && !files.fileExists(this.libDir)) {
|
| - var temp = 'frog/lib';
|
| + if (!passedLibDir && $eq(this.config, "dev") && !files.fileExists(this.libDir)) {
|
| + var temp = "frog/lib";
|
| if (files.fileExists(temp)) {
|
| this.libDir = temp;
|
| }
|
| else {
|
| - this.libDir = 'lib';
|
| + this.libDir = "lib";
|
| }
|
| }
|
| }
|
| // ********** Code for LibraryReader **************
|
| function LibraryReader() {
|
| // Initializers done
|
| - if ($eq($globals.options.config, 'dev')) {
|
| - this._specialLibs = _map(['dart:core', joinPaths($globals.options.libDir, 'corelib.dart'), 'dart:coreimpl', joinPaths($globals.options.libDir, 'corelib_impl.dart'), 'dart:html', joinPaths($globals.options.libDir, '../../client/html/release/html.dart'), 'dart:htmlimpl', joinPaths($globals.options.libDir, '../../client/html/release/htmlimpl.dart'), 'dart:dom', joinPaths($globals.options.libDir, '../../client/dom/frog/dom_frog.dart'), 'dart:json', joinPaths($globals.options.libDir, 'json_frog.dart')]);
|
| + if ($eq($globals.options.config, "dev")) {
|
| + this._specialLibs = _map(["dart:core", joinPaths($globals.options.libDir, "corelib.dart"), "dart:coreimpl", joinPaths($globals.options.libDir, "corelib_impl.dart"), "dart:html", joinPaths($globals.options.libDir, "../../client/html/release/html.dart"), "dart:htmlimpl", joinPaths($globals.options.libDir, "../../client/html/release/htmlimpl.dart"), "dart:dom", joinPaths($globals.options.libDir, "../../client/dom/frog/dom_frog.dart"), "dart:json", joinPaths($globals.options.libDir, "json_frog.dart")]);
|
| }
|
| - else if ($eq($globals.options.config, 'sdk')) {
|
| - this._specialLibs = _map(['dart:core', joinPaths($globals.options.libDir, 'core/core_frog.dart'), 'dart:coreimpl', joinPaths($globals.options.libDir, 'coreimpl/coreimpl_frog.dart'), 'dart:html', joinPaths($globals.options.libDir, 'html/html.dart'), 'dart:htmlimpl', joinPaths($globals.options.libDir, 'htmlimpl/htmlimpl.dart'), 'dart:dom', joinPaths($globals.options.libDir, 'dom/frog/dom_frog.dart'), 'dart:json', joinPaths($globals.options.libDir, 'json/json_frog.dart')]);
|
| + else if ($eq($globals.options.config, "sdk")) {
|
| + this._specialLibs = _map(["dart:core", joinPaths($globals.options.libDir, "core/core_frog.dart"), "dart:coreimpl", joinPaths($globals.options.libDir, "coreimpl/coreimpl_frog.dart"), "dart:html", joinPaths($globals.options.libDir, "html/html.dart"), "dart:htmlimpl", joinPaths($globals.options.libDir, "htmlimpl/htmlimpl.dart"), "dart:dom", joinPaths($globals.options.libDir, "dom/frog/dom_frog.dart"), "dart:json", joinPaths($globals.options.libDir, "json/json_frog.dart")]);
|
| }
|
| else {
|
| - $globals.world.error(('Invalid configuration ' + $globals.options.config));
|
| + $globals.world.error(("Invalid configuration " + $globals.options.config));
|
| }
|
| }
|
| LibraryReader.prototype.readFile = function(fullname) {
|
| @@ -13442,8 +13518,8 @@ LibraryReader.prototype.readFile = function(fullname) {
|
| return new SourceFile(filename, $globals.world.files.readAll(filename));
|
| }
|
| else {
|
| - $globals.world.error(('File not found: ' + filename));
|
| - return new SourceFile(filename, '');
|
| + $globals.world.error(("File not found: " + filename));
|
| + return new SourceFile(filename, "");
|
| }
|
| }
|
| // ********** Code for VarMember **************
|
| @@ -13459,7 +13535,7 @@ VarMember.prototype.get$returnType = function() {
|
| return $globals.world.varType;
|
| }
|
| VarMember.prototype.invoke = function(context, node, target, args) {
|
| - return new Value(this.get$returnType(), ('' + target.code + '.' + this.name + '(' + args.getCode() + ')'), node.span, true);
|
| + return new Value(this.get$returnType(), ("" + target.code + "." + this.name + "(" + args.getCode() + ")"), node.span, true);
|
| }
|
| VarMember.prototype.generate$1 = VarMember.prototype.generate;
|
| VarMember.prototype.invoke$4 = VarMember.prototype.invoke;
|
| @@ -13470,7 +13546,7 @@ function VarFunctionStub(name, callArgs) {
|
| // Initializers done
|
| VarMember.call(this, name);
|
| $globals.world.functionImplType.markUsed();
|
| - $globals.world.gen.genMethod($globals.world.functionImplType.getMember('_genStub'));
|
| + $globals.world.gen.genMethod($globals.world.functionImplType.getMember("_genStub"));
|
| }
|
| VarFunctionStub.prototype.invoke = function(context, node, target, args) {
|
| return VarMember.prototype.invoke.call(this, context, node, target, args);
|
| @@ -13486,24 +13562,24 @@ VarFunctionStub.prototype.generate = function(code) {
|
| }
|
| VarFunctionStub.prototype.generatePositional = function(w) {
|
| var arity = this.args.get$length();
|
| - w.enterBlock(('Function.prototype.to\$' + this.name + ' = function() {'));
|
| - w.writeln(('this.' + this.name + ' = this._genStub(' + arity + ');'));
|
| - w.writeln(('this.to\$' + this.name + ' = function() { return this.' + this.name + '; };'));
|
| - w.writeln(('return this.' + this.name + ';'));
|
| - w.exitBlock('};');
|
| + w.enterBlock(("Function.prototype.to$" + this.name + " = function() {"));
|
| + w.writeln(("this." + this.name + " = this._genStub(" + arity + ");"));
|
| + w.writeln(("this.to$" + this.name + " = function() { return this." + this.name + "; };"));
|
| + w.writeln(("return this." + this.name + ";"));
|
| + w.exitBlock("};");
|
| var argsCode = this.args.getCode();
|
| - w.enterBlock(('Function.prototype.' + this.name + ' = function(' + argsCode + ') {'));
|
| - w.writeln(('return this.to\$' + this.name + '()(' + argsCode + ');'));
|
| - w.exitBlock('};');
|
| - w.writeln(('function to\$' + this.name + '(f) { return f && f.to\$' + this.name + '(); }'));
|
| + w.enterBlock(("Function.prototype." + this.name + " = function(" + argsCode + ") {"));
|
| + w.writeln(("return this.to$" + this.name + "()(" + argsCode + ");"));
|
| + w.exitBlock("};");
|
| + w.writeln(("function to$" + this.name + "(f) { return f && f.to$" + this.name + "(); }"));
|
| }
|
| VarFunctionStub.prototype.generateNamed = function(w) {
|
| - var named = Strings.join(this.args.getNames(), '", "');
|
| + var named = Strings.join(this.args.getNames(), "\", \"");
|
| var argsCode = this.args.getCode();
|
| - w.enterBlock(('Function.prototype.' + this.name + ' = function(' + argsCode + ') {'));
|
| - w.writeln(('this.' + this.name + ' = this._genStub(' + this.args.get$length() + ', ["' + named + '"]);'));
|
| - w.writeln(('return this.' + this.name + '(' + argsCode + ');'));
|
| - w.exitBlock('}');
|
| + w.enterBlock(("Function.prototype." + this.name + " = function(" + argsCode + ") {"));
|
| + w.writeln(("this." + this.name + " = this._genStub(" + this.args.get$length() + ", [\"" + named + "\"]);"));
|
| + w.writeln(("return this." + this.name + "(" + argsCode + ");"));
|
| + w.exitBlock("}");
|
| }
|
| VarFunctionStub.prototype.generate$1 = VarFunctionStub.prototype.generate;
|
| VarFunctionStub.prototype.invoke$4 = VarFunctionStub.prototype.invoke;
|
| @@ -13528,24 +13604,24 @@ VarMethodStub.prototype.get$declaringType = function() {
|
| }
|
| VarMethodStub.prototype.generate = function(code) {
|
| this.isGenerated = true;
|
| - code.write($globals.world.gen._prototypeOf(this.get$declaringType(), this.name) + ' = ');
|
| + code.write($globals.world.gen._prototypeOf(this.get$declaringType(), this.name) + " = ");
|
| if (!this.get$isHidden() && this._useDirectCall(this.args)) {
|
| - code.writeln($globals.world.gen._prototypeOf(this.get$declaringType(), this.member.get$jsname()) + ';');
|
| + code.writeln($globals.world.gen._prototypeOf(this.get$declaringType(), this.member.get$jsname()) + ";");
|
| }
|
| else if (this._needsExactTypeCheck()) {
|
| - code.enterBlock(('function(' + this.args.getCode() + ') {'));
|
| - code.enterBlock(('if (Object.getPrototypeOf(this).hasOwnProperty("' + this.name + '")) {'));
|
| - code.writeln(('' + this.body + ';'));
|
| - code.exitBlock('}');
|
| + code.enterBlock(("function(" + this.args.getCode() + ") {"));
|
| + code.enterBlock(("if (Object.getPrototypeOf(this).hasOwnProperty(\"" + this.name + "\")) {"));
|
| + code.writeln(("" + this.body + ";"));
|
| + code.exitBlock("}");
|
| var argsCode = this.args.getCode();
|
| - if (argsCode != '') argsCode = ', ' + argsCode;
|
| - code.writeln(('return Object.prototype.' + this.name + '.call(this' + argsCode + ');'));
|
| - code.exitBlock('};');
|
| + if (argsCode != "") argsCode = ", " + argsCode;
|
| + code.writeln(("return Object.prototype." + this.name + ".call(this" + argsCode + ");"));
|
| + code.exitBlock("};");
|
| }
|
| else {
|
| - code.enterBlock(('function(' + this.args.getCode() + ') {'));
|
| - code.writeln(('' + this.body + ';'));
|
| - code.exitBlock('};');
|
| + code.enterBlock(("function(" + this.args.getCode() + ") {"));
|
| + code.writeln(("" + this.body + ";"));
|
| + code.exitBlock("};");
|
| }
|
| }
|
| VarMethodStub.prototype._needsExactTypeCheck = function() {
|
| @@ -13565,7 +13641,7 @@ VarMethodStub.prototype._useDirectCall = function(args) {
|
| }
|
| for (var i = args.get$length();
|
| i < method.parameters.get$length(); i++) {
|
| - if ($ne(method.parameters.$index(i).get$value().get$code(), 'null')) {
|
| + if ($ne(method.parameters.$index(i).get$value().get$code(), "null")) {
|
| return false;
|
| }
|
| }
|
| @@ -13601,16 +13677,16 @@ VarMethodSet.prototype._invokeMembers = function(context, node) {
|
| for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
|
| var member = $$list.$index($$i);
|
| var type = member.get$declaringType();
|
| - var target = new Value(type, 'this', node.span, true);
|
| + var target = new Value(type, "this", node.span, true);
|
| 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 stub = new VarMethodStub(this.name, member, this.args, "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, true);
|
| + var target = new Value($globals.world.objectType, "this", node.span, true);
|
| var result = target.invokeNoSuchMethod(context, this.baseName, node, this.args);
|
| - var stub = new VarMethodStub(this.name, null, this.args, 'return ' + result.get$code());
|
| + var stub = new VarMethodStub(this.name, null, this.args, "return " + result.get$code());
|
| $globals.world.objectType.varStubs.$setindex(stub.get$name(), stub);
|
| }
|
| }
|
| @@ -13665,50 +13741,8 @@ function orderValuesByKeys(map) {
|
| }
|
| return values;
|
| }
|
| -function isMultilineString(text) {
|
| - return text.startsWith('"""') || text.startsWith("'''");
|
| -}
|
| -function isRawMultilineString(text) {
|
| - return text.startsWith('@"""') || text.startsWith("@'''");
|
| -}
|
| -function toDoubleQuote(s) {
|
| - return s.replaceAll('"', '\\"').replaceAll("\\'", "'");
|
| -}
|
| -function parseStringLiteral(lit) {
|
| - if (lit.startsWith('@')) {
|
| - if (isRawMultilineString(lit)) {
|
| - return stripLeadingNewline(lit.substring(4, lit.length - 3));
|
| - }
|
| - else {
|
| - return lit.substring(2, lit.length - 1);
|
| - }
|
| - }
|
| - else if (isMultilineString(lit)) {
|
| - lit = lit.substring(3, lit.length - 3).replaceAll('\\\$', '\$');
|
| - return stripLeadingNewline(lit);
|
| - }
|
| - else {
|
| - return lit.substring(1, lit.length - 1).replaceAll('\\\$', '\$');
|
| - }
|
| -}
|
| -function stripLeadingNewline(text) {
|
| - if (text.startsWith('\n')) {
|
| - return text.substring(1);
|
| - }
|
| - else if (text.startsWith('\r')) {
|
| - if (text.startsWith('\r\n')) {
|
| - return text.substring(2);
|
| - }
|
| - else {
|
| - return text.substring(1);
|
| - }
|
| - }
|
| - else {
|
| - return text;
|
| - }
|
| -}
|
| function _escapeForComment(text) {
|
| - return text.replaceAll('/*', '/ *').replaceAll('*/', '* /');
|
| + return text.replaceAll("/*", "/ *").replaceAll("*/", "* /");
|
| }
|
| var world;
|
| var experimentalAwaitPhase;
|
| @@ -13727,13 +13761,13 @@ function parseOptions(homedir, args, files) {
|
| $globals.options = new FrogOptions(homedir, args, files);
|
| }
|
| function _getCallStubName(name, args) {
|
| - var nameBuilder = new StringBufferImpl(('' + name + '\$' + args.get$bareCount()));
|
| + 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('\$');
|
| - if (name0.contains$1('\$')) {
|
| - nameBuilder.add(('' + name0.get$length()));
|
| + nameBuilder.add("$");
|
| + if (name0.contains$1("$")) {
|
| + nameBuilder.add(("" + name0.get$length()));
|
| }
|
| nameBuilder.add(name0);
|
| }
|
| @@ -13748,9 +13782,9 @@ function main() {
|
| i < get$process().get$argv().get$length(); i++) {
|
| argv.add$1(get$process().get$argv().$index(i));
|
| if (i == 1) {
|
| - var terminal = get$process().get$env().$index('TERM');
|
| - if (terminal == null || !terminal.startsWith$1('xterm')) {
|
| - argv.add$1('--no_colors');
|
| + var terminal = get$process().get$env().$index("TERM");
|
| + if (terminal == null || !terminal.startsWith$1("xterm")) {
|
| + argv.add$1("--no_colors");
|
| }
|
| }
|
| }
|
| @@ -13758,10 +13792,10 @@ function main() {
|
| var code = $globals.world.getGeneratedCode();
|
| if ($globals.options.compileOnly) {
|
| if ($globals.options.outfile != null) {
|
| - print(('Compilation succeded. Code generated in: ' + $globals.options.outfile));
|
| + print(("Compilation succeded. Code generated in: " + $globals.options.outfile));
|
| }
|
| else {
|
| - print('Compilation succeded.');
|
| + print("Compilation succeded.");
|
| }
|
| }
|
| else {
|
| @@ -13790,16 +13824,16 @@ $inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQ
|
| // 0 !leaf
|
| // ********** Globals **************
|
| function $static_init(){
|
| - $globals._GREEN_COLOR = '\u001b[32m';
|
| - $globals._MAGENTA_COLOR = '\u001b[35m';
|
| - $globals._NO_COLOR = '\u001b[0m';
|
| - $globals._RED_COLOR = '\u001b[31m';
|
| -}
|
| -var const$1 = new EmptyQueueException()/*const EmptyQueueException()*/;
|
| -var const$126 = new IllegalAccessException()/*const IllegalAccessException()*/;
|
| -var const$127 = ImmutableList.ImmutableList$from$factory([])/*const []*/;
|
| -var const$2 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/;
|
| -var const$7 = new NoMoreElementsException()/*const NoMoreElementsException()*/;
|
| + $globals._GREEN_COLOR = "\x1b[32m";
|
| + $globals._MAGENTA_COLOR = "\x1b[35m";
|
| + $globals._NO_COLOR = "\x1b[0m";
|
| + $globals._RED_COLOR = "\x1b[31m";
|
| +}
|
| +var const$1 = new EmptyQueueException();
|
| +var const$126 = new IllegalAccessException();
|
| +var const$127 = ImmutableList.ImmutableList$from$factory([]);
|
| +var const$2 = new _DeletedKeySentinel();
|
| +var const$7 = new NoMoreElementsException();
|
| var $globals = {};
|
| $static_init();
|
| main();
|
|
|