| Index: frog/minfrog
|
| ===================================================================
|
| --- frog/minfrog (revision 2468)
|
| +++ frog/minfrog (working copy)
|
| @@ -662,7 +662,7 @@
|
| // ********** Code for ListIterator **************
|
| function ListIterator(array) {
|
| this._array = array;
|
| - this._dart_coreimpl_pos = 0;
|
| + this._pos = 0;
|
| // Initializers done
|
| }
|
| ListIterator.prototype.hasNext = function() {
|
| @@ -672,7 +672,7 @@
|
| if (!this.hasNext()) {
|
| $throw(const$8/*const NoMoreElementsException()*/);
|
| }
|
| - return this._array.$index(this._dart_coreimpl_pos++);
|
| + return this._array.$index(this._pos++);
|
| }
|
| ListIterator.prototype.hasNext$0 = ListIterator.prototype.hasNext;
|
| ListIterator.prototype.next$0 = ListIterator.prototype.next;
|
| @@ -3574,6 +3574,9 @@
|
| }
|
| return x.invoke$4(this, name, node, new Arguments(null, [y]));
|
| }
|
| + else if ((assignKind != 0) && ((node.y instanceof BinaryExpression))) {
|
| + return this._visitAssign(assignKind, node.x, new ParenExpression(node.y, node.y.span), node, to$call$1(null), isVoid);
|
| + }
|
| else {
|
| return this._visitAssign(assignKind, node.x, node.y, node, to$call$1(null), isVoid);
|
| }
|
| @@ -6524,31 +6527,31 @@
|
| function TokenizerBase(_source, _skipWhitespace, index) {
|
| this._source = _source;
|
| this._skipWhitespace = _skipWhitespace;
|
| - this._index = index;
|
| + this._lang_index = index;
|
| // Initializers done
|
| TokenizerHelpers.call(this);
|
| this._text = this._source.get$text();
|
| }
|
| TokenizerBase.prototype._nextChar = function() {
|
| - if (this._index < this._text.length) {
|
| - return this._text.charCodeAt(this._index++);
|
| + if (this._lang_index < this._text.length) {
|
| + return this._text.charCodeAt(this._lang_index++);
|
| }
|
| else {
|
| return 0;
|
| }
|
| }
|
| TokenizerBase.prototype._peekChar = function() {
|
| - if (this._index < this._text.length) {
|
| - return this._text.charCodeAt(this._index);
|
| + if (this._lang_index < this._text.length) {
|
| + return this._text.charCodeAt(this._lang_index);
|
| }
|
| else {
|
| return 0;
|
| }
|
| }
|
| TokenizerBase.prototype._maybeEatChar = function(ch) {
|
| - if (this._index < this._text.length) {
|
| - if (this._text.charCodeAt(this._index) == ch) {
|
| - this._index++;
|
| + if (this._lang_index < this._text.length) {
|
| + if (this._text.charCodeAt(this._lang_index) == ch) {
|
| + this._lang_index++;
|
| return true;
|
| }
|
| else {
|
| @@ -6560,15 +6563,15 @@
|
| }
|
| }
|
| TokenizerBase.prototype._finishToken = function(kind) {
|
| - return new Token(kind, this._source, this._startIndex, this._index);
|
| + return new Token(kind, this._source, this._startIndex, this._lang_index);
|
| }
|
| TokenizerBase.prototype._errorToken = function(message) {
|
| - return new ErrorToken(65/*TokenKind.ERROR*/, this._source, this._startIndex, this._index, message);
|
| + return new ErrorToken(65/*TokenKind.ERROR*/, this._source, this._startIndex, this._lang_index, message);
|
| }
|
| TokenizerBase.prototype.finishWhitespace = function() {
|
| - this._index--;
|
| - while (this._index < this._text.length) {
|
| - var ch = this._text.charCodeAt(this._index++);
|
| + this._lang_index--;
|
| + while (this._lang_index < this._text.length) {
|
| + var ch = this._text.charCodeAt(this._lang_index++);
|
| if (ch == 32 || ch == 9 || ch == 13) {
|
| }
|
| else if (ch == 10) {
|
| @@ -6577,7 +6580,7 @@
|
| }
|
| }
|
| else {
|
| - this._index--;
|
| + this._lang_index--;
|
| if (this._skipWhitespace) {
|
| return this.next();
|
| }
|
| @@ -6629,9 +6632,9 @@
|
| return this._errorToken();
|
| }
|
| TokenizerBase.prototype.eatDigits = function() {
|
| - while (this._index < this._text.length) {
|
| - if (TokenizerHelpers.isDigit(this._text.charCodeAt(this._index))) {
|
| - this._index++;
|
| + while (this._lang_index < this._text.length) {
|
| + if (TokenizerHelpers.isDigit(this._text.charCodeAt(this._lang_index))) {
|
| + this._lang_index++;
|
| }
|
| else {
|
| return;
|
| @@ -6639,9 +6642,9 @@
|
| }
|
| }
|
| TokenizerBase.prototype.eatHexDigits = function() {
|
| - while (this._index < this._text.length) {
|
| - if (TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._index))) {
|
| - this._index++;
|
| + while (this._lang_index < this._text.length) {
|
| + if (TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._lang_index))) {
|
| + this._lang_index++;
|
| }
|
| else {
|
| return;
|
| @@ -6649,8 +6652,8 @@
|
| }
|
| }
|
| TokenizerBase.prototype.maybeEatHexDigit = function() {
|
| - if (this._index < this._text.length && TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._index))) {
|
| - this._index++;
|
| + if (this._lang_index < this._text.length && TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._lang_index))) {
|
| + this._lang_index++;
|
| return true;
|
| }
|
| return false;
|
| @@ -6668,7 +6671,7 @@
|
| return this.finishNumberExtra(62/*TokenKind.DOUBLE*/);
|
| }
|
| else {
|
| - this._index--;
|
| + this._lang_index--;
|
| }
|
| }
|
| return this.finishNumberExtra(60/*TokenKind.INTEGER*/);
|
| @@ -6802,9 +6805,9 @@
|
| case 117:
|
|
|
| if (this._maybeEatChar(123)) {
|
| - var start = this._index;
|
| + var start = this._lang_index;
|
| this.eatHexDigits();
|
| - var chars = this._index - start;
|
| + var chars = this._lang_index - start;
|
| if (chars > 0 && chars <= 6 && this._maybeEatChar(125)) {
|
| hex = this._text.substring(start, start + chars);
|
| break;
|
| @@ -6815,7 +6818,7 @@
|
| }
|
| else {
|
| if (this.maybeEatHexDigit() && this.maybeEatHexDigit() && this.maybeEatHexDigit() && this.maybeEatHexDigit()) {
|
| - hex = this._text.substring(this._index - 4, this._index);
|
| + hex = this._text.substring(this._lang_index - 4, this._lang_index);
|
| break;
|
| }
|
| else {
|
| @@ -6846,17 +6849,17 @@
|
| if (ch == 36) {
|
| return this._errorToken("illegal character after $ in string interpolation");
|
| }
|
| - while (this._index < this._text.length) {
|
| - if (!TokenizerHelpers.isInterpIdentifierPart(this._text.charCodeAt(this._index++))) {
|
| - this._index--;
|
| + while (this._lang_index < this._text.length) {
|
| + if (!TokenizerHelpers.isInterpIdentifierPart(this._text.charCodeAt(this._lang_index++))) {
|
| + this._lang_index--;
|
| break;
|
| }
|
| }
|
| }
|
| else {
|
| - while (this._index < this._text.length) {
|
| - if (!TokenizerHelpers.isIdentifierPart(this._text.charCodeAt(this._index++))) {
|
| - this._index--;
|
| + while (this._lang_index < this._text.length) {
|
| + if (!TokenizerHelpers.isIdentifierPart(this._text.charCodeAt(this._lang_index++))) {
|
| + this._lang_index--;
|
| break;
|
| }
|
| }
|
| @@ -6877,7 +6880,7 @@
|
| TokenizerBase.call(this, source, skipWhitespace, index);
|
| }
|
| Tokenizer.prototype.next = function() {
|
| - this._startIndex = this._index;
|
| + this._startIndex = this._lang_index;
|
| if (this._interpStack != null && this._interpStack.depth == 0) {
|
| var istack = this._interpStack;
|
| this._interpStack = this._interpStack.pop();
|
| @@ -7212,7 +7215,7 @@
|
| }
|
| Tokenizer.prototype.getIdentifierKind = function() {
|
| var i0 = this._startIndex;
|
| - switch (this._index - i0) {
|
| + switch (this._lang_index - i0) {
|
| case 2:
|
|
|
| if (this._text.charCodeAt(i0) == 100) {
|
| @@ -8231,7 +8234,7 @@
|
| $throw(new IncompleteSourceException(this._previousToken));
|
| }
|
| else if (this._maybeEat(1/*TokenKind.END_OF_FILE*/)) {
|
| - this._error('unexpected end of file', this._peekToken.get$span());
|
| + this._lang_error('unexpected end of file', this._peekToken.get$span());
|
| return true;
|
| }
|
| else {
|
| @@ -8245,14 +8248,14 @@
|
| this._recover = false;
|
| return true;
|
| }
|
| - this._next();
|
| + this._lang_next();
|
| }
|
| return false;
|
| }
|
| Parser.prototype._peek = function() {
|
| return this._peekToken.kind;
|
| }
|
| -Parser.prototype._next = function() {
|
| +Parser.prototype._lang_next = function() {
|
| this._previousToken = this._peekToken;
|
| this._peekToken = this.tokenizer.next();
|
| return this._previousToken;
|
| @@ -8287,15 +8290,15 @@
|
| }
|
| Parser.prototype._errorExpected = function(expected) {
|
| if (this.throwOnIncomplete) this.isPrematureEndOfFile();
|
| - var tok = this._next();
|
| + var tok = this._lang_next();
|
| if ((tok instanceof ErrorToken) && tok.get$message() != null) {
|
| - this._error(tok.get$message(), tok.get$span());
|
| + this._lang_error(tok.get$message(), tok.get$span());
|
| }
|
| else {
|
| - this._error(('expected ' + expected + ', but found ' + tok), tok.get$span());
|
| + this._lang_error(('expected ' + expected + ', but found ' + tok), tok.get$span());
|
| }
|
| }
|
| -Parser.prototype._error = function(message, location) {
|
| +Parser.prototype._lang_error = function(message, location) {
|
| if (this._recover) return;
|
| if (location == null) {
|
| location = this._peekToken.get$span();
|
| @@ -8307,7 +8310,7 @@
|
| var depth = 1;
|
| this._eat(6/*TokenKind.LBRACE*/);
|
| while (true) {
|
| - var tok = this._next();
|
| + var tok = this._lang_next();
|
| if ($eq(tok.get$kind(), 6/*TokenKind.LBRACE*/)) {
|
| depth += 1;
|
| }
|
| @@ -8316,7 +8319,7 @@
|
| if (depth == 0) return;
|
| }
|
| else if ($eq(tok.get$kind(), 1/*TokenKind.END_OF_FILE*/)) {
|
| - this._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;
|
| }
|
| }
|
| @@ -8457,7 +8460,7 @@
|
| return null;
|
| }
|
| }
|
| - this._error('Expected function body (neither { nor => found)');
|
| + this._lang_error('Expected function body (neither { nor => found)');
|
| }
|
| Parser.prototype.finishField = function(start, modifiers, typeParams, type, name, value) {
|
| if (typeParams != null) {
|
| @@ -8524,7 +8527,7 @@
|
| }
|
| Parser.prototype.factoryConstructorDeclaration = function() {
|
| var start = this._peekToken.start;
|
| - var factoryToken = this._next();
|
| + var factoryToken = this._lang_next();
|
| var names = [this.identifier()];
|
| while (this._maybeEat(14/*TokenKind.DOT*/)) {
|
| names.add$1(this.identifier());
|
| @@ -8550,7 +8553,7 @@
|
| name = new Identifier('', names.$index(0).get$span());
|
| }
|
| if (names.get$length() > 1) {
|
| - this._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));
|
| @@ -8829,7 +8832,7 @@
|
| }
|
| }
|
| if ($eq(cases.get$length(), 0)) {
|
| - this._error('case or default');
|
| + this._lang_error('case or default');
|
| }
|
| var stmts = [];
|
| while (!this._peekCaseEnd()) {
|
| @@ -8914,7 +8917,7 @@
|
| return type;
|
| }
|
| else {
|
| - this._error('expected type reference');
|
| + this._lang_error('expected type reference');
|
| return null;
|
| }
|
| }
|
| @@ -8960,7 +8963,7 @@
|
| return this._fixAsType(x);
|
| }
|
| }
|
| - var op = this._next();
|
| + var op = this._lang_next();
|
| if ($eq(op.get$kind(), 103/*TokenKind.IS*/)) {
|
| var isTrue = !this._maybeEat(19/*TokenKind.NOT*/);
|
| var typeRef = this.type(0);
|
| @@ -9003,7 +9006,7 @@
|
| Parser.prototype.unaryExpression = function() {
|
| var start = this._peekToken.start;
|
| if (this._isPrefixUnaryOperator(this._peek())) {
|
| - var tok = this._next();
|
| + var tok = this._lang_next();
|
| var expr = this.unaryExpression();
|
| return new UnaryExpression(tok, expr, this._makeSpan(start));
|
| }
|
| @@ -9068,7 +9071,7 @@
|
| case 16/*TokenKind.INCR*/:
|
| case 17/*TokenKind.DECR*/:
|
|
|
| - var tok = this._next();
|
| + var tok = this._lang_next();
|
| return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().get$start()));
|
|
|
| case 9/*TokenKind.ARROW*/:
|
| @@ -9095,7 +9098,7 @@
|
| }
|
| else {
|
| if ((expr instanceof DeclaredIdentifier)) {
|
| - this._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())));
|
| @@ -9180,17 +9183,17 @@
|
|
|
| case 61/*TokenKind.HEX_INTEGER*/:
|
|
|
| - var t = this._next();
|
| + 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));
|
|
|
| case 60/*TokenKind.INTEGER*/:
|
|
|
| - var t = this._next();
|
| + var t = this._lang_next();
|
| return new LiteralExpression(Math.parseInt(t.get$text()), this._intTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start));
|
|
|
| case 62/*TokenKind.DOUBLE*/:
|
|
|
| - var t = this._next();
|
| + var t = this._lang_next();
|
| return new LiteralExpression(Math.parseDouble(t.get$text()), this._doubleTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start));
|
|
|
| case 58/*TokenKind.STRING*/:
|
| @@ -9225,7 +9228,7 @@
|
| var lits = [];
|
| var startQuote = null, endQuote = null;
|
| while (this._peekKind(66/*TokenKind.INCOMPLETE_STRING*/)) {
|
| - var token = this._next();
|
| + var token = this._lang_next();
|
| var text = token.get$text();
|
| if (startQuote == null) {
|
| if (isMultilineString(text)) {
|
| @@ -9253,7 +9256,7 @@
|
| lits.add$1(new VarExpression(id, id.get$span()));
|
| }
|
| }
|
| - var tok = this._next();
|
| + var tok = this._lang_next();
|
| if ($ne(tok.get$kind(), 58/*TokenKind.STRING*/)) {
|
| this._errorExpected('interpolated string');
|
| }
|
| @@ -9266,20 +9269,20 @@
|
| return new LiteralExpression(text, this._stringTypeRef(span), text, span);
|
| }
|
| Parser.prototype.stringLiteralExpr = function() {
|
| - var token = this._next();
|
| + var token = this._lang_next();
|
| return this.makeStringLiteral(token.get$text(), token.get$span());
|
| }
|
| Parser.prototype.maybeStringLiteral = function() {
|
| var kind = this._peek();
|
| if ($eq(kind, 58/*TokenKind.STRING*/)) {
|
| - return parseStringLiteral(this._next().get$text());
|
| + return parseStringLiteral(this._lang_next().get$text());
|
| }
|
| else if ($eq(kind, 59/*TokenKind.STRING_PART*/)) {
|
| - this._next();
|
| + this._lang_next();
|
| this._errorExpected('string literal, but found interpolated string start');
|
| }
|
| else if ($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/)) {
|
| - this._next();
|
| + this._lang_next();
|
| this._errorExpected('string literal, but found incomplete string');
|
| }
|
| return null;
|
| @@ -9317,19 +9320,19 @@
|
| }
|
| this._afterParensIndex = 0;
|
| this._afterParens.clear();
|
| - var tokens = [this._next()];
|
| + var tokens = [this._lang_next()];
|
| this._lookaheadAfterParens(tokens);
|
| var after = this._peekToken;
|
| tokens.add$1(after);
|
| this.tokenizer = new DivertedTokenSource(tokens, this, this.tokenizer);
|
| - this._next();
|
| + this._lang_next();
|
| return after;
|
| }
|
| Parser.prototype._lookaheadAfterParens = function(tokens) {
|
| var saved = this._afterParens.get$length();
|
| this._afterParens.add(null);
|
| while (true) {
|
| - var token = this._next();
|
| + var token = this._lang_next();
|
| tokens.add(token);
|
| var kind = token.kind;
|
| if (kind == 3/*TokenKind.RPAREN*/ || kind == 1/*TokenKind.END_OF_FILE*/) {
|
| @@ -9351,7 +9354,7 @@
|
| case 15/*TokenKind.ELLIPSIS*/:
|
|
|
| this._eat(15/*TokenKind.ELLIPSIS*/);
|
| - this._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;
|
|
|
| @@ -9393,7 +9396,7 @@
|
| var kind = this._peek();
|
| if ($eq(kind, 82/*TokenKind.NEGATE*/)) {
|
| name = ':negate';
|
| - this._next();
|
| + this._lang_next();
|
| }
|
| else {
|
| name = TokenKind.binaryMethodName(kind);
|
| @@ -9401,7 +9404,7 @@
|
| name = 'operator';
|
| }
|
| else {
|
| - this._next();
|
| + this._lang_next();
|
| }
|
| }
|
| break;
|
| @@ -9537,7 +9540,7 @@
|
| case 75/*TokenKind.FACTORY*/:
|
|
|
| if (modifiers == null) modifiers = [];
|
| - modifiers.add$1(this._next());
|
| + modifiers.add$1(this._lang_next());
|
| break;
|
|
|
| default:
|
| @@ -9638,11 +9641,11 @@
|
| switch (this._peek()) {
|
| case 114/*TokenKind.VOID*/:
|
|
|
| - return new TypeReference(this._next().get$span(), $globals.world.voidType);
|
| + return new TypeReference(this._lang_next().get$span(), $globals.world.voidType);
|
|
|
| case 113/*TokenKind.VAR*/:
|
|
|
| - return new TypeReference(this._next().get$span(), $globals.world.varType);
|
| + return new TypeReference(this._lang_next().get$span(), $globals.world.varType);
|
|
|
| case 98/*TokenKind.FINAL*/:
|
|
|
| @@ -9686,7 +9689,7 @@
|
| var value = null;
|
| if (this._maybeEat(20/*TokenKind.ASSIGN*/)) {
|
| if (!inOptionalBlock) {
|
| - this._error('default values only allowed inside [optional] section');
|
| + this._lang_error('default values only allowed inside [optional] section');
|
| }
|
| value = this.expression();
|
| }
|
| @@ -9712,7 +9715,7 @@
|
| while (this._maybeEat(11/*TokenKind.COMMA*/)) {
|
| if (this._maybeEat(4/*TokenKind.LBRACK*/)) {
|
| if (inOptionalBlock) {
|
| - this._error('already inside an optional block', this._previousToken.get$span());
|
| + this._lang_error('already inside an optional block', this._previousToken.get$span());
|
| }
|
| inOptionalBlock = true;
|
| }
|
| @@ -9726,9 +9729,9 @@
|
| return formals;
|
| }
|
| Parser.prototype.identifier = function() {
|
| - var tok = this._next();
|
| + var tok = this._lang_next();
|
| if (!this._isIdentifier(tok.get$kind())) {
|
| - this._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()));
|
| }
|
| @@ -9743,7 +9746,7 @@
|
| type = expr.get$type();
|
| }
|
| else {
|
| - this._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, null, body, span);
|
| @@ -9757,7 +9760,7 @@
|
| return e;
|
| }
|
| else {
|
| - this._error('expected declared identifier');
|
| + this._lang_error('expected declared identifier');
|
| return new DeclaredIdentifier(null, null, e.get$span());
|
| }
|
| }
|
| @@ -9783,7 +9786,7 @@
|
| IncompleteSourceException.prototype.toString$0 = IncompleteSourceException.prototype.toString;
|
| // ********** Code for DivertedTokenSource **************
|
| function DivertedTokenSource(tokens, parser, previousTokenizer) {
|
| - this._pos = 0
|
| + this._lang_pos = 0
|
| this.tokens = tokens;
|
| this.parser = parser;
|
| this.previousTokenizer = previousTokenizer;
|
| @@ -12437,16 +12440,16 @@
|
| }
|
| // ********** Code for CompilerException **************
|
| function CompilerException(_message, _location) {
|
| - this._message = _message;
|
| + this._lang_message = _message;
|
| this._location = _location;
|
| // Initializers done
|
| }
|
| CompilerException.prototype.toString = function() {
|
| if (this._location != null) {
|
| - return ('CompilerException: ' + this._location.toMessageString(this._message));
|
| + return ('CompilerException: ' + this._location.toMessageString(this._lang_message));
|
| }
|
| else {
|
| - return ('CompilerException: ' + this._message);
|
| + return ('CompilerException: ' + this._lang_message);
|
| }
|
| }
|
| CompilerException.prototype.toString$0 = CompilerException.prototype.toString;
|
|
|