| OLD | NEW |
| 1 #!/usr/bin/env node | 1 #!/usr/bin/env node |
| 2 // ********** Library dart:core ************** | 2 // ********** Library dart:core ************** |
| 3 // ********** Natives dart:core ************** | 3 // ********** Natives dart:core ************** |
| 4 /** | 4 /** |
| 5 * Generates a dynamic call stub for a function. | 5 * Generates a dynamic call stub for a function. |
| 6 * Our goal is to create a stub method like this on-the-fly: | 6 * Our goal is to create a stub method like this on-the-fly: |
| 7 * function($0, $1, capture) { return this($0, $1, true, capture); } | 7 * function($0, $1, capture) { return this($0, $1, true, capture); } |
| 8 * | 8 * |
| 9 * This stub then replaces the dynamic one on Function, with one that is | 9 * This stub then replaces the dynamic one on Function, with one that is |
| 10 * specialized for that particular function, taking into account its default | 10 * specialized for that particular function, taking into account its default |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 ListFactory.prototype.sort$1 = function($0) { | 655 ListFactory.prototype.sort$1 = function($0) { |
| 656 return this.sort(to$call$2($0)); | 656 return this.sort(to$call$2($0)); |
| 657 }; | 657 }; |
| 658 ListFactory_E = ListFactory; | 658 ListFactory_E = ListFactory; |
| 659 ListFactory_K = ListFactory; | 659 ListFactory_K = ListFactory; |
| 660 ListFactory_String = ListFactory; | 660 ListFactory_String = ListFactory; |
| 661 ListFactory_V = ListFactory; | 661 ListFactory_V = ListFactory; |
| 662 // ********** Code for ListIterator ************** | 662 // ********** Code for ListIterator ************** |
| 663 function ListIterator(array) { | 663 function ListIterator(array) { |
| 664 this._array = array; | 664 this._array = array; |
| 665 this._dart_coreimpl_pos = 0; | 665 this._pos = 0; |
| 666 // Initializers done | 666 // Initializers done |
| 667 } | 667 } |
| 668 ListIterator.prototype.hasNext = function() { | 668 ListIterator.prototype.hasNext = function() { |
| 669 return this._array.get$length() > this._dart_coreimpl_pos; | 669 return this._array.get$length() > this._dart_coreimpl_pos; |
| 670 } | 670 } |
| 671 ListIterator.prototype.next = function() { | 671 ListIterator.prototype.next = function() { |
| 672 if (!this.hasNext()) { | 672 if (!this.hasNext()) { |
| 673 $throw(const$8/*const NoMoreElementsException()*/); | 673 $throw(const$8/*const NoMoreElementsException()*/); |
| 674 } | 674 } |
| 675 return this._array.$index(this._dart_coreimpl_pos++); | 675 return this._array.$index(this._pos++); |
| 676 } | 676 } |
| 677 ListIterator.prototype.hasNext$0 = ListIterator.prototype.hasNext; | 677 ListIterator.prototype.hasNext$0 = ListIterator.prototype.hasNext; |
| 678 ListIterator.prototype.next$0 = ListIterator.prototype.next; | 678 ListIterator.prototype.next$0 = ListIterator.prototype.next; |
| 679 // ********** Code for NumImplementation ************** | 679 // ********** Code for NumImplementation ************** |
| 680 NumImplementation = Number; | 680 NumImplementation = Number; |
| 681 NumImplementation.prototype.isNaN = function() { | 681 NumImplementation.prototype.isNaN = function() { |
| 682 return isNaN(this); | 682 return isNaN(this); |
| 683 } | 683 } |
| 684 NumImplementation.prototype.isNegative = function() { | 684 NumImplementation.prototype.isNegative = function() { |
| 685 return this == 0 ? (1 / this) < 0 : this < 0; | 685 return this == 0 ? (1 / this) < 0 : this < 0; |
| (...skipping 2881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3567 var name = TokenKind.binaryMethodName(node.op.kind); | 3567 var name = TokenKind.binaryMethodName(node.op.kind); |
| 3568 if (node.op.kind == 49/*TokenKind.NE*/) { | 3568 if (node.op.kind == 49/*TokenKind.NE*/) { |
| 3569 name = ':ne'; | 3569 name = ':ne'; |
| 3570 } | 3570 } |
| 3571 if (name == null) { | 3571 if (name == null) { |
| 3572 $globals.world.internalError(('unimplemented binary op ' + node.op), node.
span); | 3572 $globals.world.internalError(('unimplemented binary op ' + node.op), node.
span); |
| 3573 return; | 3573 return; |
| 3574 } | 3574 } |
| 3575 return x.invoke$4(this, name, node, new Arguments(null, [y])); | 3575 return x.invoke$4(this, name, node, new Arguments(null, [y])); |
| 3576 } | 3576 } |
| 3577 else if ((assignKind != 0) && ((node.y instanceof BinaryExpression))) { |
| 3578 return this._visitAssign(assignKind, node.x, new ParenExpression(node.y, nod
e.y.span), node, to$call$1(null), isVoid); |
| 3579 } |
| 3577 else { | 3580 else { |
| 3578 return this._visitAssign(assignKind, node.x, node.y, node, to$call$1(null),
isVoid); | 3581 return this._visitAssign(assignKind, node.x, node.y, node, to$call$1(null),
isVoid); |
| 3579 } | 3582 } |
| 3580 } | 3583 } |
| 3581 MethodGenerator.prototype._visitAssign = function(kind, xn, yn, position, captur
eOriginal, isVoid) { | 3584 MethodGenerator.prototype._visitAssign = function(kind, xn, yn, position, captur
eOriginal, isVoid) { |
| 3582 if (captureOriginal == null) { | 3585 if (captureOriginal == null) { |
| 3583 captureOriginal = (function (x) { | 3586 captureOriginal = (function (x) { |
| 3584 return x; | 3587 return x; |
| 3585 }) | 3588 }) |
| 3586 ; | 3589 ; |
| (...skipping 2930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6517 return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c) |
| c == 36); | 6520 return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c) |
| c == 36); |
| 6518 } | 6521 } |
| 6519 TokenizerHelpers.isInterpIdentifierPart = function(c) { | 6522 TokenizerHelpers.isInterpIdentifierPart = function(c) { |
| 6520 return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c)); | 6523 return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c)); |
| 6521 } | 6524 } |
| 6522 // ********** Code for TokenizerBase ************** | 6525 // ********** Code for TokenizerBase ************** |
| 6523 $inherits(TokenizerBase, TokenizerHelpers); | 6526 $inherits(TokenizerBase, TokenizerHelpers); |
| 6524 function TokenizerBase(_source, _skipWhitespace, index) { | 6527 function TokenizerBase(_source, _skipWhitespace, index) { |
| 6525 this._source = _source; | 6528 this._source = _source; |
| 6526 this._skipWhitespace = _skipWhitespace; | 6529 this._skipWhitespace = _skipWhitespace; |
| 6527 this._index = index; | 6530 this._lang_index = index; |
| 6528 // Initializers done | 6531 // Initializers done |
| 6529 TokenizerHelpers.call(this); | 6532 TokenizerHelpers.call(this); |
| 6530 this._text = this._source.get$text(); | 6533 this._text = this._source.get$text(); |
| 6531 } | 6534 } |
| 6532 TokenizerBase.prototype._nextChar = function() { | 6535 TokenizerBase.prototype._nextChar = function() { |
| 6533 if (this._index < this._text.length) { | 6536 if (this._lang_index < this._text.length) { |
| 6534 return this._text.charCodeAt(this._index++); | 6537 return this._text.charCodeAt(this._lang_index++); |
| 6535 } | 6538 } |
| 6536 else { | 6539 else { |
| 6537 return 0; | 6540 return 0; |
| 6538 } | 6541 } |
| 6539 } | 6542 } |
| 6540 TokenizerBase.prototype._peekChar = function() { | 6543 TokenizerBase.prototype._peekChar = function() { |
| 6541 if (this._index < this._text.length) { | 6544 if (this._lang_index < this._text.length) { |
| 6542 return this._text.charCodeAt(this._index); | 6545 return this._text.charCodeAt(this._lang_index); |
| 6543 } | 6546 } |
| 6544 else { | 6547 else { |
| 6545 return 0; | 6548 return 0; |
| 6546 } | 6549 } |
| 6547 } | 6550 } |
| 6548 TokenizerBase.prototype._maybeEatChar = function(ch) { | 6551 TokenizerBase.prototype._maybeEatChar = function(ch) { |
| 6549 if (this._index < this._text.length) { | 6552 if (this._lang_index < this._text.length) { |
| 6550 if (this._text.charCodeAt(this._index) == ch) { | 6553 if (this._text.charCodeAt(this._lang_index) == ch) { |
| 6551 this._index++; | 6554 this._lang_index++; |
| 6552 return true; | 6555 return true; |
| 6553 } | 6556 } |
| 6554 else { | 6557 else { |
| 6555 return false; | 6558 return false; |
| 6556 } | 6559 } |
| 6557 } | 6560 } |
| 6558 else { | 6561 else { |
| 6559 return false; | 6562 return false; |
| 6560 } | 6563 } |
| 6561 } | 6564 } |
| 6562 TokenizerBase.prototype._finishToken = function(kind) { | 6565 TokenizerBase.prototype._finishToken = function(kind) { |
| 6563 return new Token(kind, this._source, this._startIndex, this._index); | 6566 return new Token(kind, this._source, this._startIndex, this._lang_index); |
| 6564 } | 6567 } |
| 6565 TokenizerBase.prototype._errorToken = function(message) { | 6568 TokenizerBase.prototype._errorToken = function(message) { |
| 6566 return new ErrorToken(65/*TokenKind.ERROR*/, this._source, this._startIndex, t
his._index, message); | 6569 return new ErrorToken(65/*TokenKind.ERROR*/, this._source, this._startIndex, t
his._lang_index, message); |
| 6567 } | 6570 } |
| 6568 TokenizerBase.prototype.finishWhitespace = function() { | 6571 TokenizerBase.prototype.finishWhitespace = function() { |
| 6569 this._index--; | 6572 this._lang_index--; |
| 6570 while (this._index < this._text.length) { | 6573 while (this._lang_index < this._text.length) { |
| 6571 var ch = this._text.charCodeAt(this._index++); | 6574 var ch = this._text.charCodeAt(this._lang_index++); |
| 6572 if (ch == 32 || ch == 9 || ch == 13) { | 6575 if (ch == 32 || ch == 9 || ch == 13) { |
| 6573 } | 6576 } |
| 6574 else if (ch == 10) { | 6577 else if (ch == 10) { |
| 6575 if (!this._skipWhitespace) { | 6578 if (!this._skipWhitespace) { |
| 6576 return this._finishToken(63/*TokenKind.WHITESPACE*/); | 6579 return this._finishToken(63/*TokenKind.WHITESPACE*/); |
| 6577 } | 6580 } |
| 6578 } | 6581 } |
| 6579 else { | 6582 else { |
| 6580 this._index--; | 6583 this._lang_index--; |
| 6581 if (this._skipWhitespace) { | 6584 if (this._skipWhitespace) { |
| 6582 return this.next(); | 6585 return this.next(); |
| 6583 } | 6586 } |
| 6584 else { | 6587 else { |
| 6585 return this._finishToken(63/*TokenKind.WHITESPACE*/); | 6588 return this._finishToken(63/*TokenKind.WHITESPACE*/); |
| 6586 } | 6589 } |
| 6587 } | 6590 } |
| 6588 } | 6591 } |
| 6589 return this._finishToken(1/*TokenKind.END_OF_FILE*/); | 6592 return this._finishToken(1/*TokenKind.END_OF_FILE*/); |
| 6590 } | 6593 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6622 } | 6625 } |
| 6623 else { | 6626 else { |
| 6624 return this._finishToken(64/*TokenKind.COMMENT*/); | 6627 return this._finishToken(64/*TokenKind.COMMENT*/); |
| 6625 } | 6628 } |
| 6626 } | 6629 } |
| 6627 } | 6630 } |
| 6628 } | 6631 } |
| 6629 return this._errorToken(); | 6632 return this._errorToken(); |
| 6630 } | 6633 } |
| 6631 TokenizerBase.prototype.eatDigits = function() { | 6634 TokenizerBase.prototype.eatDigits = function() { |
| 6632 while (this._index < this._text.length) { | 6635 while (this._lang_index < this._text.length) { |
| 6633 if (TokenizerHelpers.isDigit(this._text.charCodeAt(this._index))) { | 6636 if (TokenizerHelpers.isDigit(this._text.charCodeAt(this._lang_index))) { |
| 6634 this._index++; | 6637 this._lang_index++; |
| 6635 } | 6638 } |
| 6636 else { | 6639 else { |
| 6637 return; | 6640 return; |
| 6638 } | 6641 } |
| 6639 } | 6642 } |
| 6640 } | 6643 } |
| 6641 TokenizerBase.prototype.eatHexDigits = function() { | 6644 TokenizerBase.prototype.eatHexDigits = function() { |
| 6642 while (this._index < this._text.length) { | 6645 while (this._lang_index < this._text.length) { |
| 6643 if (TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._index))) { | 6646 if (TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._lang_index))) { |
| 6644 this._index++; | 6647 this._lang_index++; |
| 6645 } | 6648 } |
| 6646 else { | 6649 else { |
| 6647 return; | 6650 return; |
| 6648 } | 6651 } |
| 6649 } | 6652 } |
| 6650 } | 6653 } |
| 6651 TokenizerBase.prototype.maybeEatHexDigit = function() { | 6654 TokenizerBase.prototype.maybeEatHexDigit = function() { |
| 6652 if (this._index < this._text.length && TokenizerHelpers.isHexDigit(this._text.
charCodeAt(this._index))) { | 6655 if (this._lang_index < this._text.length && TokenizerHelpers.isHexDigit(this._
text.charCodeAt(this._lang_index))) { |
| 6653 this._index++; | 6656 this._lang_index++; |
| 6654 return true; | 6657 return true; |
| 6655 } | 6658 } |
| 6656 return false; | 6659 return false; |
| 6657 } | 6660 } |
| 6658 TokenizerBase.prototype.finishHex = function() { | 6661 TokenizerBase.prototype.finishHex = function() { |
| 6659 this.eatHexDigits(); | 6662 this.eatHexDigits(); |
| 6660 return this._finishToken(61/*TokenKind.HEX_INTEGER*/); | 6663 return this._finishToken(61/*TokenKind.HEX_INTEGER*/); |
| 6661 } | 6664 } |
| 6662 TokenizerBase.prototype.finishNumber = function() { | 6665 TokenizerBase.prototype.finishNumber = function() { |
| 6663 this.eatDigits(); | 6666 this.eatDigits(); |
| 6664 if (this._peekChar() == 46) { | 6667 if (this._peekChar() == 46) { |
| 6665 this._nextChar(); | 6668 this._nextChar(); |
| 6666 if (TokenizerHelpers.isDigit(this._peekChar())) { | 6669 if (TokenizerHelpers.isDigit(this._peekChar())) { |
| 6667 this.eatDigits(); | 6670 this.eatDigits(); |
| 6668 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); | 6671 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); |
| 6669 } | 6672 } |
| 6670 else { | 6673 else { |
| 6671 this._index--; | 6674 this._lang_index--; |
| 6672 } | 6675 } |
| 6673 } | 6676 } |
| 6674 return this.finishNumberExtra(60/*TokenKind.INTEGER*/); | 6677 return this.finishNumberExtra(60/*TokenKind.INTEGER*/); |
| 6675 } | 6678 } |
| 6676 TokenizerBase.prototype.finishNumberExtra = function(kind) { | 6679 TokenizerBase.prototype.finishNumberExtra = function(kind) { |
| 6677 if (this._maybeEatChar(101) || this._maybeEatChar(69)) { | 6680 if (this._maybeEatChar(101) || this._maybeEatChar(69)) { |
| 6678 kind = 62/*TokenKind.DOUBLE*/; | 6681 kind = 62/*TokenKind.DOUBLE*/; |
| 6679 this._maybeEatChar(45); | 6682 this._maybeEatChar(45); |
| 6680 this._maybeEatChar(43); | 6683 this._maybeEatChar(43); |
| 6681 this.eatDigits(); | 6684 this.eatDigits(); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6795 TokenizerBase.prototype.eatEscapeSequence = function() { | 6798 TokenizerBase.prototype.eatEscapeSequence = function() { |
| 6796 var hex; | 6799 var hex; |
| 6797 switch (this._nextChar()) { | 6800 switch (this._nextChar()) { |
| 6798 case 120: | 6801 case 120: |
| 6799 | 6802 |
| 6800 return this.maybeEatHexDigit() && this.maybeEatHexDigit(); | 6803 return this.maybeEatHexDigit() && this.maybeEatHexDigit(); |
| 6801 | 6804 |
| 6802 case 117: | 6805 case 117: |
| 6803 | 6806 |
| 6804 if (this._maybeEatChar(123)) { | 6807 if (this._maybeEatChar(123)) { |
| 6805 var start = this._index; | 6808 var start = this._lang_index; |
| 6806 this.eatHexDigits(); | 6809 this.eatHexDigits(); |
| 6807 var chars = this._index - start; | 6810 var chars = this._lang_index - start; |
| 6808 if (chars > 0 && chars <= 6 && this._maybeEatChar(125)) { | 6811 if (chars > 0 && chars <= 6 && this._maybeEatChar(125)) { |
| 6809 hex = this._text.substring(start, start + chars); | 6812 hex = this._text.substring(start, start + chars); |
| 6810 break; | 6813 break; |
| 6811 } | 6814 } |
| 6812 else { | 6815 else { |
| 6813 return false; | 6816 return false; |
| 6814 } | 6817 } |
| 6815 } | 6818 } |
| 6816 else { | 6819 else { |
| 6817 if (this.maybeEatHexDigit() && this.maybeEatHexDigit() && this.maybeEatH
exDigit() && this.maybeEatHexDigit()) { | 6820 if (this.maybeEatHexDigit() && this.maybeEatHexDigit() && this.maybeEatH
exDigit() && this.maybeEatHexDigit()) { |
| 6818 hex = this._text.substring(this._index - 4, this._index); | 6821 hex = this._text.substring(this._lang_index - 4, this._lang_index); |
| 6819 break; | 6822 break; |
| 6820 } | 6823 } |
| 6821 else { | 6824 else { |
| 6822 return false; | 6825 return false; |
| 6823 } | 6826 } |
| 6824 } | 6827 } |
| 6825 | 6828 |
| 6826 default: | 6829 default: |
| 6827 | 6830 |
| 6828 return true; | 6831 return true; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 6839 else { | 6842 else { |
| 6840 return this._finishToken(14/*TokenKind.DOT*/); | 6843 return this._finishToken(14/*TokenKind.DOT*/); |
| 6841 } | 6844 } |
| 6842 } | 6845 } |
| 6843 TokenizerBase.prototype.finishIdentifier = function(ch) { | 6846 TokenizerBase.prototype.finishIdentifier = function(ch) { |
| 6844 if (this._interpStack != null && this._interpStack.depth == -1) { | 6847 if (this._interpStack != null && this._interpStack.depth == -1) { |
| 6845 this._interpStack.depth = 0; | 6848 this._interpStack.depth = 0; |
| 6846 if (ch == 36) { | 6849 if (ch == 36) { |
| 6847 return this._errorToken("illegal character after $ in string interpolation
"); | 6850 return this._errorToken("illegal character after $ in string interpolation
"); |
| 6848 } | 6851 } |
| 6849 while (this._index < this._text.length) { | 6852 while (this._lang_index < this._text.length) { |
| 6850 if (!TokenizerHelpers.isInterpIdentifierPart(this._text.charCodeAt(this._i
ndex++))) { | 6853 if (!TokenizerHelpers.isInterpIdentifierPart(this._text.charCodeAt(this._l
ang_index++))) { |
| 6851 this._index--; | 6854 this._lang_index--; |
| 6852 break; | 6855 break; |
| 6853 } | 6856 } |
| 6854 } | 6857 } |
| 6855 } | 6858 } |
| 6856 else { | 6859 else { |
| 6857 while (this._index < this._text.length) { | 6860 while (this._lang_index < this._text.length) { |
| 6858 if (!TokenizerHelpers.isIdentifierPart(this._text.charCodeAt(this._index++
))) { | 6861 if (!TokenizerHelpers.isIdentifierPart(this._text.charCodeAt(this._lang_in
dex++))) { |
| 6859 this._index--; | 6862 this._lang_index--; |
| 6860 break; | 6863 break; |
| 6861 } | 6864 } |
| 6862 } | 6865 } |
| 6863 } | 6866 } |
| 6864 var kind = this.getIdentifierKind(); | 6867 var kind = this.getIdentifierKind(); |
| 6865 if (kind == 70/*TokenKind.IDENTIFIER*/) { | 6868 if (kind == 70/*TokenKind.IDENTIFIER*/) { |
| 6866 return this._finishToken(70/*TokenKind.IDENTIFIER*/); | 6869 return this._finishToken(70/*TokenKind.IDENTIFIER*/); |
| 6867 } | 6870 } |
| 6868 else { | 6871 else { |
| 6869 return this._finishToken(kind); | 6872 return this._finishToken(kind); |
| 6870 } | 6873 } |
| 6871 } | 6874 } |
| 6872 TokenizerBase.prototype.next$0 = TokenizerBase.prototype.next; | 6875 TokenizerBase.prototype.next$0 = TokenizerBase.prototype.next; |
| 6873 // ********** Code for Tokenizer ************** | 6876 // ********** Code for Tokenizer ************** |
| 6874 $inherits(Tokenizer, TokenizerBase); | 6877 $inherits(Tokenizer, TokenizerBase); |
| 6875 function Tokenizer(source, skipWhitespace, index) { | 6878 function Tokenizer(source, skipWhitespace, index) { |
| 6876 // Initializers done | 6879 // Initializers done |
| 6877 TokenizerBase.call(this, source, skipWhitespace, index); | 6880 TokenizerBase.call(this, source, skipWhitespace, index); |
| 6878 } | 6881 } |
| 6879 Tokenizer.prototype.next = function() { | 6882 Tokenizer.prototype.next = function() { |
| 6880 this._startIndex = this._index; | 6883 this._startIndex = this._lang_index; |
| 6881 if (this._interpStack != null && this._interpStack.depth == 0) { | 6884 if (this._interpStack != null && this._interpStack.depth == 0) { |
| 6882 var istack = this._interpStack; | 6885 var istack = this._interpStack; |
| 6883 this._interpStack = this._interpStack.pop(); | 6886 this._interpStack = this._interpStack.pop(); |
| 6884 if (istack.get$isMultiline()) { | 6887 if (istack.get$isMultiline()) { |
| 6885 return this.finishMultilineString(istack.get$quote()); | 6888 return this.finishMultilineString(istack.get$quote()); |
| 6886 } | 6889 } |
| 6887 else { | 6890 else { |
| 6888 return this.finishStringBody(istack.get$quote()); | 6891 return this.finishStringBody(istack.get$quote()); |
| 6889 } | 6892 } |
| 6890 } | 6893 } |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7205 return this.finishNumber(); | 7208 return this.finishNumber(); |
| 7206 } | 7209 } |
| 7207 else { | 7210 else { |
| 7208 return this._errorToken(); | 7211 return this._errorToken(); |
| 7209 } | 7212 } |
| 7210 | 7213 |
| 7211 } | 7214 } |
| 7212 } | 7215 } |
| 7213 Tokenizer.prototype.getIdentifierKind = function() { | 7216 Tokenizer.prototype.getIdentifierKind = function() { |
| 7214 var i0 = this._startIndex; | 7217 var i0 = this._startIndex; |
| 7215 switch (this._index - i0) { | 7218 switch (this._lang_index - i0) { |
| 7216 case 2: | 7219 case 2: |
| 7217 | 7220 |
| 7218 if (this._text.charCodeAt(i0) == 100) { | 7221 if (this._text.charCodeAt(i0) == 100) { |
| 7219 if (this._text.charCodeAt(i0 + 1) == 111) return 95/*TokenKind.DO*/; | 7222 if (this._text.charCodeAt(i0 + 1) == 111) return 95/*TokenKind.DO*/; |
| 7220 } | 7223 } |
| 7221 else if (this._text.charCodeAt(i0) == 105) { | 7224 else if (this._text.charCodeAt(i0) == 105) { |
| 7222 if (this._text.charCodeAt(i0 + 1) == 102) { | 7225 if (this._text.charCodeAt(i0 + 1) == 102) { |
| 7223 return 101/*TokenKind.IF*/; | 7226 return 101/*TokenKind.IF*/; |
| 7224 } | 7227 } |
| 7225 else if (this._text.charCodeAt(i0 + 1) == 110) { | 7228 else if (this._text.charCodeAt(i0 + 1) == 110) { |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8224 this._afterParens = []; | 8227 this._afterParens = []; |
| 8225 } | 8228 } |
| 8226 Parser.prototype.get$enableAwait = function() { | 8229 Parser.prototype.get$enableAwait = function() { |
| 8227 return $globals.experimentalAwaitPhase != null; | 8230 return $globals.experimentalAwaitPhase != null; |
| 8228 } | 8231 } |
| 8229 Parser.prototype.isPrematureEndOfFile = function() { | 8232 Parser.prototype.isPrematureEndOfFile = function() { |
| 8230 if (this.throwOnIncomplete && this._maybeEat(1/*TokenKind.END_OF_FILE*/) || th
is._maybeEat(68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/) || this._maybeEat(6
9/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/)) { | 8233 if (this.throwOnIncomplete && this._maybeEat(1/*TokenKind.END_OF_FILE*/) || th
is._maybeEat(68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/) || this._maybeEat(6
9/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/)) { |
| 8231 $throw(new IncompleteSourceException(this._previousToken)); | 8234 $throw(new IncompleteSourceException(this._previousToken)); |
| 8232 } | 8235 } |
| 8233 else if (this._maybeEat(1/*TokenKind.END_OF_FILE*/)) { | 8236 else if (this._maybeEat(1/*TokenKind.END_OF_FILE*/)) { |
| 8234 this._error('unexpected end of file', this._peekToken.get$span()); | 8237 this._lang_error('unexpected end of file', this._peekToken.get$span()); |
| 8235 return true; | 8238 return true; |
| 8236 } | 8239 } |
| 8237 else { | 8240 else { |
| 8238 return false; | 8241 return false; |
| 8239 } | 8242 } |
| 8240 } | 8243 } |
| 8241 Parser.prototype._recoverTo = function(kind1, kind2, kind3) { | 8244 Parser.prototype._recoverTo = function(kind1, kind2, kind3) { |
| 8242 while (!this.isPrematureEndOfFile()) { | 8245 while (!this.isPrematureEndOfFile()) { |
| 8243 var kind = this._peek(); | 8246 var kind = this._peek(); |
| 8244 if (kind == kind1 || kind == kind2 || kind == kind3) { | 8247 if (kind == kind1 || kind == kind2 || kind == kind3) { |
| 8245 this._recover = false; | 8248 this._recover = false; |
| 8246 return true; | 8249 return true; |
| 8247 } | 8250 } |
| 8248 this._next(); | 8251 this._lang_next(); |
| 8249 } | 8252 } |
| 8250 return false; | 8253 return false; |
| 8251 } | 8254 } |
| 8252 Parser.prototype._peek = function() { | 8255 Parser.prototype._peek = function() { |
| 8253 return this._peekToken.kind; | 8256 return this._peekToken.kind; |
| 8254 } | 8257 } |
| 8255 Parser.prototype._next = function() { | 8258 Parser.prototype._lang_next = function() { |
| 8256 this._previousToken = this._peekToken; | 8259 this._previousToken = this._peekToken; |
| 8257 this._peekToken = this.tokenizer.next(); | 8260 this._peekToken = this.tokenizer.next(); |
| 8258 return this._previousToken; | 8261 return this._previousToken; |
| 8259 } | 8262 } |
| 8260 Parser.prototype._peekKind = function(kind) { | 8263 Parser.prototype._peekKind = function(kind) { |
| 8261 return this._peekToken.kind == kind; | 8264 return this._peekToken.kind == kind; |
| 8262 } | 8265 } |
| 8263 Parser.prototype._peekIdentifier = function() { | 8266 Parser.prototype._peekIdentifier = function() { |
| 8264 return this._isIdentifier(this._peekToken.kind); | 8267 return this._isIdentifier(this._peekToken.kind); |
| 8265 } | 8268 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 8280 if (!this._maybeEat(kind)) { | 8283 if (!this._maybeEat(kind)) { |
| 8281 this._errorExpected(TokenKind.kindToString(kind)); | 8284 this._errorExpected(TokenKind.kindToString(kind)); |
| 8282 } | 8285 } |
| 8283 } | 8286 } |
| 8284 Parser.prototype._eatSemicolon = function() { | 8287 Parser.prototype._eatSemicolon = function() { |
| 8285 if (this.optionalSemicolons && this._peekKind(1/*TokenKind.END_OF_FILE*/)) ret
urn; | 8288 if (this.optionalSemicolons && this._peekKind(1/*TokenKind.END_OF_FILE*/)) ret
urn; |
| 8286 this._eat(10/*TokenKind.SEMICOLON*/); | 8289 this._eat(10/*TokenKind.SEMICOLON*/); |
| 8287 } | 8290 } |
| 8288 Parser.prototype._errorExpected = function(expected) { | 8291 Parser.prototype._errorExpected = function(expected) { |
| 8289 if (this.throwOnIncomplete) this.isPrematureEndOfFile(); | 8292 if (this.throwOnIncomplete) this.isPrematureEndOfFile(); |
| 8290 var tok = this._next(); | 8293 var tok = this._lang_next(); |
| 8291 if ((tok instanceof ErrorToken) && tok.get$message() != null) { | 8294 if ((tok instanceof ErrorToken) && tok.get$message() != null) { |
| 8292 this._error(tok.get$message(), tok.get$span()); | 8295 this._lang_error(tok.get$message(), tok.get$span()); |
| 8293 } | 8296 } |
| 8294 else { | 8297 else { |
| 8295 this._error(('expected ' + expected + ', but found ' + tok), tok.get$span())
; | 8298 this._lang_error(('expected ' + expected + ', but found ' + tok), tok.get$sp
an()); |
| 8296 } | 8299 } |
| 8297 } | 8300 } |
| 8298 Parser.prototype._error = function(message, location) { | 8301 Parser.prototype._lang_error = function(message, location) { |
| 8299 if (this._recover) return; | 8302 if (this._recover) return; |
| 8300 if (location == null) { | 8303 if (location == null) { |
| 8301 location = this._peekToken.get$span(); | 8304 location = this._peekToken.get$span(); |
| 8302 } | 8305 } |
| 8303 $globals.world.fatal(message, location); | 8306 $globals.world.fatal(message, location); |
| 8304 this._recover = true; | 8307 this._recover = true; |
| 8305 } | 8308 } |
| 8306 Parser.prototype._skipBlock = function() { | 8309 Parser.prototype._skipBlock = function() { |
| 8307 var depth = 1; | 8310 var depth = 1; |
| 8308 this._eat(6/*TokenKind.LBRACE*/); | 8311 this._eat(6/*TokenKind.LBRACE*/); |
| 8309 while (true) { | 8312 while (true) { |
| 8310 var tok = this._next(); | 8313 var tok = this._lang_next(); |
| 8311 if ($eq(tok.get$kind(), 6/*TokenKind.LBRACE*/)) { | 8314 if ($eq(tok.get$kind(), 6/*TokenKind.LBRACE*/)) { |
| 8312 depth += 1; | 8315 depth += 1; |
| 8313 } | 8316 } |
| 8314 else if ($eq(tok.get$kind(), 7/*TokenKind.RBRACE*/)) { | 8317 else if ($eq(tok.get$kind(), 7/*TokenKind.RBRACE*/)) { |
| 8315 depth -= 1; | 8318 depth -= 1; |
| 8316 if (depth == 0) return; | 8319 if (depth == 0) return; |
| 8317 } | 8320 } |
| 8318 else if ($eq(tok.get$kind(), 1/*TokenKind.END_OF_FILE*/)) { | 8321 else if ($eq(tok.get$kind(), 1/*TokenKind.END_OF_FILE*/)) { |
| 8319 this._error('unexpected end of file during diet parse', tok.get$span()); | 8322 this._lang_error('unexpected end of file during diet parse', tok.get$span(
)); |
| 8320 return; | 8323 return; |
| 8321 } | 8324 } |
| 8322 } | 8325 } |
| 8323 } | 8326 } |
| 8324 Parser.prototype._makeSpan = function(start) { | 8327 Parser.prototype._makeSpan = function(start) { |
| 8325 return new SourceSpan(this.source, start, this._previousToken.end); | 8328 return new SourceSpan(this.source, start, this._previousToken.end); |
| 8326 } | 8329 } |
| 8327 Parser.prototype.compilationUnit = function() { | 8330 Parser.prototype.compilationUnit = function() { |
| 8328 var ret = []; | 8331 var ret = []; |
| 8329 this._maybeEat(13/*TokenKind.HASHBANG*/); | 8332 this._maybeEat(13/*TokenKind.HASHBANG*/); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8450 } | 8453 } |
| 8451 else { | 8454 else { |
| 8452 return this.block(); | 8455 return this.block(); |
| 8453 } | 8456 } |
| 8454 } | 8457 } |
| 8455 else if (!inExpression) { | 8458 else if (!inExpression) { |
| 8456 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { | 8459 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { |
| 8457 return null; | 8460 return null; |
| 8458 } | 8461 } |
| 8459 } | 8462 } |
| 8460 this._error('Expected function body (neither { nor => found)'); | 8463 this._lang_error('Expected function body (neither { nor => found)'); |
| 8461 } | 8464 } |
| 8462 Parser.prototype.finishField = function(start, modifiers, typeParams, type, name
, value) { | 8465 Parser.prototype.finishField = function(start, modifiers, typeParams, type, name
, value) { |
| 8463 if (typeParams != null) { | 8466 if (typeParams != null) { |
| 8464 $globals.world.internalError('trying to create a generic field', this._makeS
pan(start)); | 8467 $globals.world.internalError('trying to create a generic field', this._makeS
pan(start)); |
| 8465 } | 8468 } |
| 8466 var names = [name]; | 8469 var names = [name]; |
| 8467 var values = [value]; | 8470 var values = [value]; |
| 8468 while (this._maybeEat(11/*TokenKind.COMMA*/)) { | 8471 while (this._maybeEat(11/*TokenKind.COMMA*/)) { |
| 8469 names.add$1(this.identifier()); | 8472 names.add$1(this.identifier()); |
| 8470 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 8473 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8517 Parser.prototype.declaration = function(includeOperators) { | 8520 Parser.prototype.declaration = function(includeOperators) { |
| 8518 var start = this._peekToken.start; | 8521 var start = this._peekToken.start; |
| 8519 if (this._peekKind(75/*TokenKind.FACTORY*/)) { | 8522 if (this._peekKind(75/*TokenKind.FACTORY*/)) { |
| 8520 return this.factoryConstructorDeclaration(); | 8523 return this.factoryConstructorDeclaration(); |
| 8521 } | 8524 } |
| 8522 var modifiers = this._readModifiers(); | 8525 var modifiers = this._readModifiers(); |
| 8523 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include
Operators), null); | 8526 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include
Operators), null); |
| 8524 } | 8527 } |
| 8525 Parser.prototype.factoryConstructorDeclaration = function() { | 8528 Parser.prototype.factoryConstructorDeclaration = function() { |
| 8526 var start = this._peekToken.start; | 8529 var start = this._peekToken.start; |
| 8527 var factoryToken = this._next(); | 8530 var factoryToken = this._lang_next(); |
| 8528 var names = [this.identifier()]; | 8531 var names = [this.identifier()]; |
| 8529 while (this._maybeEat(14/*TokenKind.DOT*/)) { | 8532 while (this._maybeEat(14/*TokenKind.DOT*/)) { |
| 8530 names.add$1(this.identifier()); | 8533 names.add$1(this.identifier()); |
| 8531 } | 8534 } |
| 8532 var typeParams = null; | 8535 var typeParams = null; |
| 8533 if (this._peekKind(52/*TokenKind.LT*/)) { | 8536 if (this._peekKind(52/*TokenKind.LT*/)) { |
| 8534 typeParams = this.typeParameters(); | 8537 typeParams = this.typeParameters(); |
| 8535 } | 8538 } |
| 8536 var name = null; | 8539 var name = null; |
| 8537 var type = null; | 8540 var type = null; |
| 8538 if (this._maybeEat(14/*TokenKind.DOT*/)) { | 8541 if (this._maybeEat(14/*TokenKind.DOT*/)) { |
| 8539 name = this.identifier(); | 8542 name = this.identifier(); |
| 8540 } | 8543 } |
| 8541 else if (typeParams == null) { | 8544 else if (typeParams == null) { |
| 8542 if (names.get$length() > 1) { | 8545 if (names.get$length() > 1) { |
| 8543 name = names.removeLast$0(); | 8546 name = names.removeLast$0(); |
| 8544 } | 8547 } |
| 8545 else { | 8548 else { |
| 8546 name = new Identifier('', names.$index(0).get$span()); | 8549 name = new Identifier('', names.$index(0).get$span()); |
| 8547 } | 8550 } |
| 8548 } | 8551 } |
| 8549 else { | 8552 else { |
| 8550 name = new Identifier('', names.$index(0).get$span()); | 8553 name = new Identifier('', names.$index(0).get$span()); |
| 8551 } | 8554 } |
| 8552 if (names.get$length() > 1) { | 8555 if (names.get$length() > 1) { |
| 8553 this._error('unsupported qualified name for factory', names.$index(0).get$sp
an()); | 8556 this._lang_error('unsupported qualified name for factory', names.$index(0).g
et$span()); |
| 8554 } | 8557 } |
| 8555 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get
$span()); | 8558 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get
$span()); |
| 8556 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); | 8559 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); |
| 8557 return this.finishDefinition(start, [factoryToken], di, typeParams); | 8560 return this.finishDefinition(start, [factoryToken], di, typeParams); |
| 8558 } | 8561 } |
| 8559 Parser.prototype.statement = function() { | 8562 Parser.prototype.statement = function() { |
| 8560 switch (this._peek()) { | 8563 switch (this._peek()) { |
| 8561 case 89/*TokenKind.BREAK*/: | 8564 case 89/*TokenKind.BREAK*/: |
| 8562 | 8565 |
| 8563 return this.breakStatement(); | 8566 return this.breakStatement(); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8822 } | 8825 } |
| 8823 else if (this._maybeEat(94/*TokenKind.DEFAULT*/)) { | 8826 else if (this._maybeEat(94/*TokenKind.DEFAULT*/)) { |
| 8824 cases.add$1(); | 8827 cases.add$1(); |
| 8825 this._eat(8/*TokenKind.COLON*/); | 8828 this._eat(8/*TokenKind.COLON*/); |
| 8826 } | 8829 } |
| 8827 else { | 8830 else { |
| 8828 break; | 8831 break; |
| 8829 } | 8832 } |
| 8830 } | 8833 } |
| 8831 if ($eq(cases.get$length(), 0)) { | 8834 if ($eq(cases.get$length(), 0)) { |
| 8832 this._error('case or default'); | 8835 this._lang_error('case or default'); |
| 8833 } | 8836 } |
| 8834 var stmts = []; | 8837 var stmts = []; |
| 8835 while (!this._peekCaseEnd()) { | 8838 while (!this._peekCaseEnd()) { |
| 8836 stmts.add$1(this.statement()); | 8839 stmts.add$1(this.statement()); |
| 8837 if (this._recover && !this._recoverTo(7/*TokenKind.RBRACE*/, 90/*TokenKind.C
ASE*/, 94/*TokenKind.DEFAULT*/)) { | 8840 if (this._recover && !this._recoverTo(7/*TokenKind.RBRACE*/, 90/*TokenKind.C
ASE*/, 94/*TokenKind.DEFAULT*/)) { |
| 8838 break; | 8841 break; |
| 8839 } | 8842 } |
| 8840 } | 8843 } |
| 8841 return new CaseNode(label, cases, stmts, this._makeSpan(start)); | 8844 return new CaseNode(label, cases, stmts, this._makeSpan(start)); |
| 8842 } | 8845 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8907 if (type.get$names() == null) { | 8910 if (type.get$names() == null) { |
| 8908 type.set$names([expr.get$name()]); | 8911 type.set$names([expr.get$name()]); |
| 8909 } | 8912 } |
| 8910 else { | 8913 else { |
| 8911 type.get$names().add$1(expr.get$name()); | 8914 type.get$names().add$1(expr.get$name()); |
| 8912 } | 8915 } |
| 8913 type.set$span(expr.get$span()); | 8916 type.set$span(expr.get$span()); |
| 8914 return type; | 8917 return type; |
| 8915 } | 8918 } |
| 8916 else { | 8919 else { |
| 8917 this._error('expected type reference'); | 8920 this._lang_error('expected type reference'); |
| 8918 return null; | 8921 return null; |
| 8919 } | 8922 } |
| 8920 } | 8923 } |
| 8921 Parser.prototype.infixExpression = function(precedence) { | 8924 Parser.prototype.infixExpression = function(precedence) { |
| 8922 return this.finishInfixExpression(this.unaryExpression(), precedence); | 8925 return this.finishInfixExpression(this.unaryExpression(), precedence); |
| 8923 } | 8926 } |
| 8924 Parser.prototype._finishDeclaredId = function(type) { | 8927 Parser.prototype._finishDeclaredId = function(type) { |
| 8925 var name = this.identifier(); | 8928 var name = this.identifier(); |
| 8926 return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._m
akeSpan(type.get$span().get$start()))); | 8929 return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._m
akeSpan(type.get$span().get$start()))); |
| 8927 } | 8930 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 8953 Parser.prototype.finishInfixExpression = function(x, precedence) { | 8956 Parser.prototype.finishInfixExpression = function(x, precedence) { |
| 8954 while (true) { | 8957 while (true) { |
| 8955 var kind = this._peek(); | 8958 var kind = this._peek(); |
| 8956 var prec = TokenKind.infixPrecedence(this._peek()); | 8959 var prec = TokenKind.infixPrecedence(this._peek()); |
| 8957 if (prec >= precedence) { | 8960 if (prec >= precedence) { |
| 8958 if (kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/) { | 8961 if (kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/) { |
| 8959 if (this._isBin(x, 52/*TokenKind.LT*/)) { | 8962 if (this._isBin(x, 52/*TokenKind.LT*/)) { |
| 8960 return this._fixAsType(x); | 8963 return this._fixAsType(x); |
| 8961 } | 8964 } |
| 8962 } | 8965 } |
| 8963 var op = this._next(); | 8966 var op = this._lang_next(); |
| 8964 if ($eq(op.get$kind(), 103/*TokenKind.IS*/)) { | 8967 if ($eq(op.get$kind(), 103/*TokenKind.IS*/)) { |
| 8965 var isTrue = !this._maybeEat(19/*TokenKind.NOT*/); | 8968 var isTrue = !this._maybeEat(19/*TokenKind.NOT*/); |
| 8966 var typeRef = this.type(0); | 8969 var typeRef = this.type(0); |
| 8967 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); | 8970 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); |
| 8968 continue; | 8971 continue; |
| 8969 } | 8972 } |
| 8970 var y = this.infixExpression($eq(prec, 2) ? prec : prec + 1); | 8973 var y = this.infixExpression($eq(prec, 2) ? prec : prec + 1); |
| 8971 if ($eq(op.get$kind(), 33/*TokenKind.CONDITIONAL*/)) { | 8974 if ($eq(op.get$kind(), 33/*TokenKind.CONDITIONAL*/)) { |
| 8972 this._eat(8/*TokenKind.COLON*/); | 8975 this._eat(8/*TokenKind.COLON*/); |
| 8973 var z = this.infixExpression(prec); | 8976 var z = this.infixExpression(prec); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 8996 | 8999 |
| 8997 default: | 9000 default: |
| 8998 | 9001 |
| 8999 return false; | 9002 return false; |
| 9000 | 9003 |
| 9001 } | 9004 } |
| 9002 } | 9005 } |
| 9003 Parser.prototype.unaryExpression = function() { | 9006 Parser.prototype.unaryExpression = function() { |
| 9004 var start = this._peekToken.start; | 9007 var start = this._peekToken.start; |
| 9005 if (this._isPrefixUnaryOperator(this._peek())) { | 9008 if (this._isPrefixUnaryOperator(this._peek())) { |
| 9006 var tok = this._next(); | 9009 var tok = this._lang_next(); |
| 9007 var expr = this.unaryExpression(); | 9010 var expr = this.unaryExpression(); |
| 9008 return new UnaryExpression(tok, expr, this._makeSpan(start)); | 9011 return new UnaryExpression(tok, expr, this._makeSpan(start)); |
| 9009 } | 9012 } |
| 9010 else if (this.get$enableAwait() && this._maybeEat(88/*TokenKind.AWAIT*/)) { | 9013 else if (this.get$enableAwait() && this._maybeEat(88/*TokenKind.AWAIT*/)) { |
| 9011 var expr = this.unaryExpression(); | 9014 var expr = this.unaryExpression(); |
| 9012 return new AwaitExpression(expr, this._makeSpan(start)); | 9015 return new AwaitExpression(expr, this._makeSpan(start)); |
| 9013 } | 9016 } |
| 9014 return this.finishPostfixExpression(this.primary()); | 9017 return this.finishPostfixExpression(this.primary()); |
| 9015 } | 9018 } |
| 9016 Parser.prototype.argument = function() { | 9019 Parser.prototype.argument = function() { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9061 case 14/*TokenKind.DOT*/: | 9064 case 14/*TokenKind.DOT*/: |
| 9062 | 9065 |
| 9063 this._eat(14/*TokenKind.DOT*/); | 9066 this._eat(14/*TokenKind.DOT*/); |
| 9064 var name = this.identifier(); | 9067 var name = this.identifier(); |
| 9065 var ret = new DotExpression(expr, name, this._makeSpan(expr.get$span().get
$start())); | 9068 var ret = new DotExpression(expr, name, this._makeSpan(expr.get$span().get
$start())); |
| 9066 return this.finishPostfixExpression(ret); | 9069 return this.finishPostfixExpression(ret); |
| 9067 | 9070 |
| 9068 case 16/*TokenKind.INCR*/: | 9071 case 16/*TokenKind.INCR*/: |
| 9069 case 17/*TokenKind.DECR*/: | 9072 case 17/*TokenKind.DECR*/: |
| 9070 | 9073 |
| 9071 var tok = this._next(); | 9074 var tok = this._lang_next(); |
| 9072 return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().get
$start())); | 9075 return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().get
$start())); |
| 9073 | 9076 |
| 9074 case 9/*TokenKind.ARROW*/: | 9077 case 9/*TokenKind.ARROW*/: |
| 9075 case 6/*TokenKind.LBRACE*/: | 9078 case 6/*TokenKind.LBRACE*/: |
| 9076 | 9079 |
| 9077 return expr; | 9080 return expr; |
| 9078 | 9081 |
| 9079 default: | 9082 default: |
| 9080 | 9083 |
| 9081 if (this._peekIdentifier()) { | 9084 if (this._peekIdentifier()) { |
| 9082 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp
e(expr), this.identifier(), this._makeSpan(expr.get$span().get$start()))); | 9085 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp
e(expr), this.identifier(), this._makeSpan(expr.get$span().get$start()))); |
| 9083 } | 9086 } |
| 9084 else { | 9087 else { |
| 9085 return expr; | 9088 return expr; |
| 9086 } | 9089 } |
| 9087 | 9090 |
| 9088 } | 9091 } |
| 9089 } | 9092 } |
| 9090 Parser.prototype.finishCallOrLambdaExpression = function(expr) { | 9093 Parser.prototype.finishCallOrLambdaExpression = function(expr) { |
| 9091 if (this._atClosureParameters()) { | 9094 if (this._atClosureParameters()) { |
| 9092 var formals = this.formalParameterList(); | 9095 var formals = this.formalParameterList(); |
| 9093 var body = this.functionBody(true); | 9096 var body = this.functionBody(true); |
| 9094 return this._makeFunction(expr, formals, body); | 9097 return this._makeFunction(expr, formals, body); |
| 9095 } | 9098 } |
| 9096 else { | 9099 else { |
| 9097 if ((expr instanceof DeclaredIdentifier)) { | 9100 if ((expr instanceof DeclaredIdentifier)) { |
| 9098 this._error('illegal target for call, did you mean to declare a function?'
, expr.get$span()); | 9101 this._lang_error('illegal target for call, did you mean to declare a funct
ion?', expr.get$span()); |
| 9099 } | 9102 } |
| 9100 var args = this.arguments(); | 9103 var args = this.arguments(); |
| 9101 return this.finishPostfixExpression(new CallExpression(expr, args, this._mak
eSpan(expr.get$span().get$start()))); | 9104 return this.finishPostfixExpression(new CallExpression(expr, args, this._mak
eSpan(expr.get$span().get$start()))); |
| 9102 } | 9105 } |
| 9103 } | 9106 } |
| 9104 Parser.prototype._isBin = function(expr, kind) { | 9107 Parser.prototype._isBin = function(expr, kind) { |
| 9105 return (expr instanceof BinaryExpression) && $eq(expr.get$op().get$kind(), kin
d); | 9108 return (expr instanceof BinaryExpression) && $eq(expr.get$op().get$kind(), kin
d); |
| 9106 } | 9109 } |
| 9107 Parser.prototype._boolTypeRef = function(span) { | 9110 Parser.prototype._boolTypeRef = function(span) { |
| 9108 return new TypeReference(span, $globals.world.nonNullBool); | 9111 return new TypeReference(span, $globals.world.nonNullBool); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9173 this._eat(111/*TokenKind.TRUE*/); | 9176 this._eat(111/*TokenKind.TRUE*/); |
| 9174 return new LiteralExpression(true, this._boolTypeRef(this._makeSpan(start)
), 'true', this._makeSpan(start)); | 9177 return new LiteralExpression(true, this._boolTypeRef(this._makeSpan(start)
), 'true', this._makeSpan(start)); |
| 9175 | 9178 |
| 9176 case 97/*TokenKind.FALSE*/: | 9179 case 97/*TokenKind.FALSE*/: |
| 9177 | 9180 |
| 9178 this._eat(97/*TokenKind.FALSE*/); | 9181 this._eat(97/*TokenKind.FALSE*/); |
| 9179 return new LiteralExpression(false, this._boolTypeRef(this._makeSpan(start
)), 'false', this._makeSpan(start)); | 9182 return new LiteralExpression(false, this._boolTypeRef(this._makeSpan(start
)), 'false', this._makeSpan(start)); |
| 9180 | 9183 |
| 9181 case 61/*TokenKind.HEX_INTEGER*/: | 9184 case 61/*TokenKind.HEX_INTEGER*/: |
| 9182 | 9185 |
| 9183 var t = this._next(); | 9186 var t = this._lang_next(); |
| 9184 return new LiteralExpression(Parser.parseHex(t.get$text().substring$1(2)),
this._intTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); | 9187 return new LiteralExpression(Parser.parseHex(t.get$text().substring$1(2)),
this._intTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); |
| 9185 | 9188 |
| 9186 case 60/*TokenKind.INTEGER*/: | 9189 case 60/*TokenKind.INTEGER*/: |
| 9187 | 9190 |
| 9188 var t = this._next(); | 9191 var t = this._lang_next(); |
| 9189 return new LiteralExpression(Math.parseInt(t.get$text()), this._intTypeRef
(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); | 9192 return new LiteralExpression(Math.parseInt(t.get$text()), this._intTypeRef
(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); |
| 9190 | 9193 |
| 9191 case 62/*TokenKind.DOUBLE*/: | 9194 case 62/*TokenKind.DOUBLE*/: |
| 9192 | 9195 |
| 9193 var t = this._next(); | 9196 var t = this._lang_next(); |
| 9194 return new LiteralExpression(Math.parseDouble(t.get$text()), this._doubleT
ypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); | 9197 return new LiteralExpression(Math.parseDouble(t.get$text()), this._doubleT
ypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); |
| 9195 | 9198 |
| 9196 case 58/*TokenKind.STRING*/: | 9199 case 58/*TokenKind.STRING*/: |
| 9197 | 9200 |
| 9198 return this.stringLiteralExpr(); | 9201 return this.stringLiteralExpr(); |
| 9199 | 9202 |
| 9200 case 66/*TokenKind.INCOMPLETE_STRING*/: | 9203 case 66/*TokenKind.INCOMPLETE_STRING*/: |
| 9201 | 9204 |
| 9202 return this.stringInterpolation(); | 9205 return this.stringInterpolation(); |
| 9203 | 9206 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 9218 } | 9221 } |
| 9219 return new VarExpression(this.identifier(), this._makeSpan(start)); | 9222 return new VarExpression(this.identifier(), this._makeSpan(start)); |
| 9220 | 9223 |
| 9221 } | 9224 } |
| 9222 } | 9225 } |
| 9223 Parser.prototype.stringInterpolation = function() { | 9226 Parser.prototype.stringInterpolation = function() { |
| 9224 var start = this._peekToken.start; | 9227 var start = this._peekToken.start; |
| 9225 var lits = []; | 9228 var lits = []; |
| 9226 var startQuote = null, endQuote = null; | 9229 var startQuote = null, endQuote = null; |
| 9227 while (this._peekKind(66/*TokenKind.INCOMPLETE_STRING*/)) { | 9230 while (this._peekKind(66/*TokenKind.INCOMPLETE_STRING*/)) { |
| 9228 var token = this._next(); | 9231 var token = this._lang_next(); |
| 9229 var text = token.get$text(); | 9232 var text = token.get$text(); |
| 9230 if (startQuote == null) { | 9233 if (startQuote == null) { |
| 9231 if (isMultilineString(text)) { | 9234 if (isMultilineString(text)) { |
| 9232 endQuote = text.substring$2(0, 3); | 9235 endQuote = text.substring$2(0, 3); |
| 9233 startQuote = endQuote + '\n'; | 9236 startQuote = endQuote + '\n'; |
| 9234 } | 9237 } |
| 9235 else { | 9238 else { |
| 9236 startQuote = endQuote = text.$index(0); | 9239 startQuote = endQuote = text.$index(0); |
| 9237 } | 9240 } |
| 9238 text = text.substring$2(0, text.get$length() - 1) + endQuote; | 9241 text = text.substring$2(0, text.get$length() - 1) + endQuote; |
| 9239 } | 9242 } |
| 9240 else { | 9243 else { |
| 9241 text = startQuote + text.substring$2(0, text.get$length() - 1) + endQuote; | 9244 text = startQuote + text.substring$2(0, text.get$length() - 1) + endQuote; |
| 9242 } | 9245 } |
| 9243 lits.add$1(this.makeStringLiteral(text, token.get$span())); | 9246 lits.add$1(this.makeStringLiteral(text, token.get$span())); |
| 9244 if (this._maybeEat(6/*TokenKind.LBRACE*/)) { | 9247 if (this._maybeEat(6/*TokenKind.LBRACE*/)) { |
| 9245 lits.add$1(this.expression()); | 9248 lits.add$1(this.expression()); |
| 9246 this._eat(7/*TokenKind.RBRACE*/); | 9249 this._eat(7/*TokenKind.RBRACE*/); |
| 9247 } | 9250 } |
| 9248 else if (this._maybeEat(109/*TokenKind.THIS*/)) { | 9251 else if (this._maybeEat(109/*TokenKind.THIS*/)) { |
| 9249 lits.add$1(new ThisExpression(this._previousToken.get$span())); | 9252 lits.add$1(new ThisExpression(this._previousToken.get$span())); |
| 9250 } | 9253 } |
| 9251 else { | 9254 else { |
| 9252 var id = this.identifier(); | 9255 var id = this.identifier(); |
| 9253 lits.add$1(new VarExpression(id, id.get$span())); | 9256 lits.add$1(new VarExpression(id, id.get$span())); |
| 9254 } | 9257 } |
| 9255 } | 9258 } |
| 9256 var tok = this._next(); | 9259 var tok = this._lang_next(); |
| 9257 if ($ne(tok.get$kind(), 58/*TokenKind.STRING*/)) { | 9260 if ($ne(tok.get$kind(), 58/*TokenKind.STRING*/)) { |
| 9258 this._errorExpected('interpolated string'); | 9261 this._errorExpected('interpolated string'); |
| 9259 } | 9262 } |
| 9260 var text = startQuote + tok.get$text(); | 9263 var text = startQuote + tok.get$text(); |
| 9261 lits.add$1(this.makeStringLiteral(text, tok.get$span())); | 9264 lits.add$1(this.makeStringLiteral(text, tok.get$span())); |
| 9262 var span = this._makeSpan(start); | 9265 var span = this._makeSpan(start); |
| 9263 return new LiteralExpression(lits, this._stringTypeRef(span), '\$\$\$', span); | 9266 return new LiteralExpression(lits, this._stringTypeRef(span), '\$\$\$', span); |
| 9264 } | 9267 } |
| 9265 Parser.prototype.makeStringLiteral = function(text, span) { | 9268 Parser.prototype.makeStringLiteral = function(text, span) { |
| 9266 return new LiteralExpression(text, this._stringTypeRef(span), text, span); | 9269 return new LiteralExpression(text, this._stringTypeRef(span), text, span); |
| 9267 } | 9270 } |
| 9268 Parser.prototype.stringLiteralExpr = function() { | 9271 Parser.prototype.stringLiteralExpr = function() { |
| 9269 var token = this._next(); | 9272 var token = this._lang_next(); |
| 9270 return this.makeStringLiteral(token.get$text(), token.get$span()); | 9273 return this.makeStringLiteral(token.get$text(), token.get$span()); |
| 9271 } | 9274 } |
| 9272 Parser.prototype.maybeStringLiteral = function() { | 9275 Parser.prototype.maybeStringLiteral = function() { |
| 9273 var kind = this._peek(); | 9276 var kind = this._peek(); |
| 9274 if ($eq(kind, 58/*TokenKind.STRING*/)) { | 9277 if ($eq(kind, 58/*TokenKind.STRING*/)) { |
| 9275 return parseStringLiteral(this._next().get$text()); | 9278 return parseStringLiteral(this._lang_next().get$text()); |
| 9276 } | 9279 } |
| 9277 else if ($eq(kind, 59/*TokenKind.STRING_PART*/)) { | 9280 else if ($eq(kind, 59/*TokenKind.STRING_PART*/)) { |
| 9278 this._next(); | 9281 this._lang_next(); |
| 9279 this._errorExpected('string literal, but found interpolated string start'); | 9282 this._errorExpected('string literal, but found interpolated string start'); |
| 9280 } | 9283 } |
| 9281 else if ($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/)) { | 9284 else if ($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/)) { |
| 9282 this._next(); | 9285 this._lang_next(); |
| 9283 this._errorExpected('string literal, but found incomplete string'); | 9286 this._errorExpected('string literal, but found incomplete string'); |
| 9284 } | 9287 } |
| 9285 return null; | 9288 return null; |
| 9286 } | 9289 } |
| 9287 Parser.prototype._parenOrLambda = function() { | 9290 Parser.prototype._parenOrLambda = function() { |
| 9288 var start = this._peekToken.start; | 9291 var start = this._peekToken.start; |
| 9289 if (this._atClosureParameters()) { | 9292 if (this._atClosureParameters()) { |
| 9290 var formals = this.formalParameterList(); | 9293 var formals = this.formalParameterList(); |
| 9291 var body = this.functionBody(true); | 9294 var body = this.functionBody(true); |
| 9292 var func = new FunctionDefinition(null, null, null, formals, null, null, nul
l, body, this._makeSpan(start)); | 9295 var func = new FunctionDefinition(null, null, null, formals, null, null, nul
l, body, this._makeSpan(start)); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 9310 Parser.prototype._eatLeftParen = function() { | 9313 Parser.prototype._eatLeftParen = function() { |
| 9311 this._eat(2/*TokenKind.LPAREN*/); | 9314 this._eat(2/*TokenKind.LPAREN*/); |
| 9312 this._afterParensIndex++; | 9315 this._afterParensIndex++; |
| 9313 } | 9316 } |
| 9314 Parser.prototype._peekAfterCloseParen = function() { | 9317 Parser.prototype._peekAfterCloseParen = function() { |
| 9315 if (this._afterParensIndex < this._afterParens.get$length()) { | 9318 if (this._afterParensIndex < this._afterParens.get$length()) { |
| 9316 return this._afterParens.$index(this._afterParensIndex); | 9319 return this._afterParens.$index(this._afterParensIndex); |
| 9317 } | 9320 } |
| 9318 this._afterParensIndex = 0; | 9321 this._afterParensIndex = 0; |
| 9319 this._afterParens.clear(); | 9322 this._afterParens.clear(); |
| 9320 var tokens = [this._next()]; | 9323 var tokens = [this._lang_next()]; |
| 9321 this._lookaheadAfterParens(tokens); | 9324 this._lookaheadAfterParens(tokens); |
| 9322 var after = this._peekToken; | 9325 var after = this._peekToken; |
| 9323 tokens.add$1(after); | 9326 tokens.add$1(after); |
| 9324 this.tokenizer = new DivertedTokenSource(tokens, this, this.tokenizer); | 9327 this.tokenizer = new DivertedTokenSource(tokens, this, this.tokenizer); |
| 9325 this._next(); | 9328 this._lang_next(); |
| 9326 return after; | 9329 return after; |
| 9327 } | 9330 } |
| 9328 Parser.prototype._lookaheadAfterParens = function(tokens) { | 9331 Parser.prototype._lookaheadAfterParens = function(tokens) { |
| 9329 var saved = this._afterParens.get$length(); | 9332 var saved = this._afterParens.get$length(); |
| 9330 this._afterParens.add(null); | 9333 this._afterParens.add(null); |
| 9331 while (true) { | 9334 while (true) { |
| 9332 var token = this._next(); | 9335 var token = this._lang_next(); |
| 9333 tokens.add(token); | 9336 tokens.add(token); |
| 9334 var kind = token.kind; | 9337 var kind = token.kind; |
| 9335 if (kind == 3/*TokenKind.RPAREN*/ || kind == 1/*TokenKind.END_OF_FILE*/) { | 9338 if (kind == 3/*TokenKind.RPAREN*/ || kind == 1/*TokenKind.END_OF_FILE*/) { |
| 9336 this._afterParens.$setindex(saved, this._peekToken); | 9339 this._afterParens.$setindex(saved, this._peekToken); |
| 9337 return; | 9340 return; |
| 9338 } | 9341 } |
| 9339 else if (kind == 2/*TokenKind.LPAREN*/) { | 9342 else if (kind == 2/*TokenKind.LPAREN*/) { |
| 9340 this._lookaheadAfterParens(tokens); | 9343 this._lookaheadAfterParens(tokens); |
| 9341 } | 9344 } |
| 9342 } | 9345 } |
| 9343 } | 9346 } |
| 9344 Parser.prototype._typeAsIdentifier = function(type) { | 9347 Parser.prototype._typeAsIdentifier = function(type) { |
| 9345 return type.get$name(); | 9348 return type.get$name(); |
| 9346 } | 9349 } |
| 9347 Parser.prototype._specialIdentifier = function(includeOperators) { | 9350 Parser.prototype._specialIdentifier = function(includeOperators) { |
| 9348 var start = this._peekToken.start; | 9351 var start = this._peekToken.start; |
| 9349 var name; | 9352 var name; |
| 9350 switch (this._peek()) { | 9353 switch (this._peek()) { |
| 9351 case 15/*TokenKind.ELLIPSIS*/: | 9354 case 15/*TokenKind.ELLIPSIS*/: |
| 9352 | 9355 |
| 9353 this._eat(15/*TokenKind.ELLIPSIS*/); | 9356 this._eat(15/*TokenKind.ELLIPSIS*/); |
| 9354 this._error('rest no longer supported', this._previousToken.get$span()); | 9357 this._lang_error('rest no longer supported', this._previousToken.get$span(
)); |
| 9355 name = this.identifier().get$name(); | 9358 name = this.identifier().get$name(); |
| 9356 break; | 9359 break; |
| 9357 | 9360 |
| 9358 case 109/*TokenKind.THIS*/: | 9361 case 109/*TokenKind.THIS*/: |
| 9359 | 9362 |
| 9360 this._eat(109/*TokenKind.THIS*/); | 9363 this._eat(109/*TokenKind.THIS*/); |
| 9361 this._eat(14/*TokenKind.DOT*/); | 9364 this._eat(14/*TokenKind.DOT*/); |
| 9362 name = ('this.' + this.identifier().get$name()); | 9365 name = ('this.' + this.identifier().get$name()); |
| 9363 break; | 9366 break; |
| 9364 | 9367 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 9386 } | 9389 } |
| 9387 break; | 9390 break; |
| 9388 | 9391 |
| 9389 case 83/*TokenKind.OPERATOR*/: | 9392 case 83/*TokenKind.OPERATOR*/: |
| 9390 | 9393 |
| 9391 if (!includeOperators) return null; | 9394 if (!includeOperators) return null; |
| 9392 this._eat(83/*TokenKind.OPERATOR*/); | 9395 this._eat(83/*TokenKind.OPERATOR*/); |
| 9393 var kind = this._peek(); | 9396 var kind = this._peek(); |
| 9394 if ($eq(kind, 82/*TokenKind.NEGATE*/)) { | 9397 if ($eq(kind, 82/*TokenKind.NEGATE*/)) { |
| 9395 name = ':negate'; | 9398 name = ':negate'; |
| 9396 this._next(); | 9399 this._lang_next(); |
| 9397 } | 9400 } |
| 9398 else { | 9401 else { |
| 9399 name = TokenKind.binaryMethodName(kind); | 9402 name = TokenKind.binaryMethodName(kind); |
| 9400 if (name == null) { | 9403 if (name == null) { |
| 9401 name = 'operator'; | 9404 name = 'operator'; |
| 9402 } | 9405 } |
| 9403 else { | 9406 else { |
| 9404 this._next(); | 9407 this._lang_next(); |
| 9405 } | 9408 } |
| 9406 } | 9409 } |
| 9407 break; | 9410 break; |
| 9408 | 9411 |
| 9409 default: | 9412 default: |
| 9410 | 9413 |
| 9411 return null; | 9414 return null; |
| 9412 | 9415 |
| 9413 } | 9416 } |
| 9414 return new Identifier(name, this._makeSpan(start)); | 9417 return new Identifier(name, this._makeSpan(start)); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9530 var modifiers = null; | 9533 var modifiers = null; |
| 9531 while (true) { | 9534 while (true) { |
| 9532 switch (this._peek()) { | 9535 switch (this._peek()) { |
| 9533 case 86/*TokenKind.STATIC*/: | 9536 case 86/*TokenKind.STATIC*/: |
| 9534 case 98/*TokenKind.FINAL*/: | 9537 case 98/*TokenKind.FINAL*/: |
| 9535 case 92/*TokenKind.CONST*/: | 9538 case 92/*TokenKind.CONST*/: |
| 9536 case 71/*TokenKind.ABSTRACT*/: | 9539 case 71/*TokenKind.ABSTRACT*/: |
| 9537 case 75/*TokenKind.FACTORY*/: | 9540 case 75/*TokenKind.FACTORY*/: |
| 9538 | 9541 |
| 9539 if (modifiers == null) modifiers = []; | 9542 if (modifiers == null) modifiers = []; |
| 9540 modifiers.add$1(this._next()); | 9543 modifiers.add$1(this._lang_next()); |
| 9541 break; | 9544 break; |
| 9542 | 9545 |
| 9543 default: | 9546 default: |
| 9544 | 9547 |
| 9545 return modifiers; | 9548 return modifiers; |
| 9546 | 9549 |
| 9547 } | 9550 } |
| 9548 } | 9551 } |
| 9549 return null; | 9552 return null; |
| 9550 } | 9553 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9631 } | 9634 } |
| 9632 Parser.prototype.nameTypeReference = function() { | 9635 Parser.prototype.nameTypeReference = function() { |
| 9633 var start = this._peekToken.start; | 9636 var start = this._peekToken.start; |
| 9634 var name; | 9637 var name; |
| 9635 var names = null; | 9638 var names = null; |
| 9636 var typeArgs = null; | 9639 var typeArgs = null; |
| 9637 var isFinal = false; | 9640 var isFinal = false; |
| 9638 switch (this._peek()) { | 9641 switch (this._peek()) { |
| 9639 case 114/*TokenKind.VOID*/: | 9642 case 114/*TokenKind.VOID*/: |
| 9640 | 9643 |
| 9641 return new TypeReference(this._next().get$span(), $globals.world.voidType)
; | 9644 return new TypeReference(this._lang_next().get$span(), $globals.world.void
Type); |
| 9642 | 9645 |
| 9643 case 113/*TokenKind.VAR*/: | 9646 case 113/*TokenKind.VAR*/: |
| 9644 | 9647 |
| 9645 return new TypeReference(this._next().get$span(), $globals.world.varType); | 9648 return new TypeReference(this._lang_next().get$span(), $globals.world.varT
ype); |
| 9646 | 9649 |
| 9647 case 98/*TokenKind.FINAL*/: | 9650 case 98/*TokenKind.FINAL*/: |
| 9648 | 9651 |
| 9649 this._eat(98/*TokenKind.FINAL*/); | 9652 this._eat(98/*TokenKind.FINAL*/); |
| 9650 isFinal = true; | 9653 isFinal = true; |
| 9651 name = this.identifier(); | 9654 name = this.identifier(); |
| 9652 break; | 9655 break; |
| 9653 | 9656 |
| 9654 default: | 9657 default: |
| 9655 | 9658 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 9679 Parser.prototype.formalParameter = function(inOptionalBlock) { | 9682 Parser.prototype.formalParameter = function(inOptionalBlock) { |
| 9680 var start = this._peekToken.start; | 9683 var start = this._peekToken.start; |
| 9681 var isThis = false; | 9684 var isThis = false; |
| 9682 var isRest = false; | 9685 var isRest = false; |
| 9683 var di = this.declaredIdentifier(false); | 9686 var di = this.declaredIdentifier(false); |
| 9684 var type = di.get$type(); | 9687 var type = di.get$type(); |
| 9685 var name = di.get$name(); | 9688 var name = di.get$name(); |
| 9686 var value = null; | 9689 var value = null; |
| 9687 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 9690 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
| 9688 if (!inOptionalBlock) { | 9691 if (!inOptionalBlock) { |
| 9689 this._error('default values only allowed inside [optional] section'); | 9692 this._lang_error('default values only allowed inside [optional] section'); |
| 9690 } | 9693 } |
| 9691 value = this.expression(); | 9694 value = this.expression(); |
| 9692 } | 9695 } |
| 9693 else if (this._peekKind(2/*TokenKind.LPAREN*/)) { | 9696 else if (this._peekKind(2/*TokenKind.LPAREN*/)) { |
| 9694 var formals = this.formalParameterList(); | 9697 var formals = this.formalParameterList(); |
| 9695 var func = new FunctionDefinition(null, type, name, formals, null, null, nul
l, null, this._makeSpan(start)); | 9698 var func = new FunctionDefinition(null, type, name, formals, null, null, nul
l, null, this._makeSpan(start)); |
| 9696 type = new FunctionTypeReference(false, func, func.get$span()); | 9699 type = new FunctionTypeReference(false, func, func.get$span()); |
| 9697 } | 9700 } |
| 9698 if (inOptionalBlock && value == null) { | 9701 if (inOptionalBlock && value == null) { |
| 9699 value = new NullExpression(this._makeSpan(start)); | 9702 value = new NullExpression(this._makeSpan(start)); |
| 9700 } | 9703 } |
| 9701 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start)
); | 9704 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start)
); |
| 9702 } | 9705 } |
| 9703 Parser.prototype.formalParameterList = function() { | 9706 Parser.prototype.formalParameterList = function() { |
| 9704 this._eatLeftParen(); | 9707 this._eatLeftParen(); |
| 9705 var formals = []; | 9708 var formals = []; |
| 9706 var inOptionalBlock = false; | 9709 var inOptionalBlock = false; |
| 9707 if (!this._maybeEat(3/*TokenKind.RPAREN*/)) { | 9710 if (!this._maybeEat(3/*TokenKind.RPAREN*/)) { |
| 9708 if (this._maybeEat(4/*TokenKind.LBRACK*/)) { | 9711 if (this._maybeEat(4/*TokenKind.LBRACK*/)) { |
| 9709 inOptionalBlock = true; | 9712 inOptionalBlock = true; |
| 9710 } | 9713 } |
| 9711 formals.add$1(this.formalParameter(inOptionalBlock)); | 9714 formals.add$1(this.formalParameter(inOptionalBlock)); |
| 9712 while (this._maybeEat(11/*TokenKind.COMMA*/)) { | 9715 while (this._maybeEat(11/*TokenKind.COMMA*/)) { |
| 9713 if (this._maybeEat(4/*TokenKind.LBRACK*/)) { | 9716 if (this._maybeEat(4/*TokenKind.LBRACK*/)) { |
| 9714 if (inOptionalBlock) { | 9717 if (inOptionalBlock) { |
| 9715 this._error('already inside an optional block', this._previousToken.ge
t$span()); | 9718 this._lang_error('already inside an optional block', this._previousTok
en.get$span()); |
| 9716 } | 9719 } |
| 9717 inOptionalBlock = true; | 9720 inOptionalBlock = true; |
| 9718 } | 9721 } |
| 9719 formals.add$1(this.formalParameter(inOptionalBlock)); | 9722 formals.add$1(this.formalParameter(inOptionalBlock)); |
| 9720 } | 9723 } |
| 9721 if (inOptionalBlock) { | 9724 if (inOptionalBlock) { |
| 9722 this._eat(5/*TokenKind.RBRACK*/); | 9725 this._eat(5/*TokenKind.RBRACK*/); |
| 9723 } | 9726 } |
| 9724 this._eat(3/*TokenKind.RPAREN*/); | 9727 this._eat(3/*TokenKind.RPAREN*/); |
| 9725 } | 9728 } |
| 9726 return formals; | 9729 return formals; |
| 9727 } | 9730 } |
| 9728 Parser.prototype.identifier = function() { | 9731 Parser.prototype.identifier = function() { |
| 9729 var tok = this._next(); | 9732 var tok = this._lang_next(); |
| 9730 if (!this._isIdentifier(tok.get$kind())) { | 9733 if (!this._isIdentifier(tok.get$kind())) { |
| 9731 this._error(('expected identifier, but found ' + tok), tok.get$span()); | 9734 this._lang_error(('expected identifier, but found ' + tok), tok.get$span()); |
| 9732 } | 9735 } |
| 9733 return new Identifier(tok.get$text(), this._makeSpan(tok.get$start())); | 9736 return new Identifier(tok.get$text(), this._makeSpan(tok.get$start())); |
| 9734 } | 9737 } |
| 9735 Parser.prototype._makeFunction = function(expr, formals, body) { | 9738 Parser.prototype._makeFunction = function(expr, formals, body) { |
| 9736 var name, type; | 9739 var name, type; |
| 9737 if ((expr instanceof VarExpression)) { | 9740 if ((expr instanceof VarExpression)) { |
| 9738 name = expr.get$name(); | 9741 name = expr.get$name(); |
| 9739 type = null; | 9742 type = null; |
| 9740 } | 9743 } |
| 9741 else if ((expr instanceof DeclaredIdentifier)) { | 9744 else if ((expr instanceof DeclaredIdentifier)) { |
| 9742 name = expr.get$name(); | 9745 name = expr.get$name(); |
| 9743 type = expr.get$type(); | 9746 type = expr.get$type(); |
| 9744 } | 9747 } |
| 9745 else { | 9748 else { |
| 9746 this._error('bad function body', expr.get$span()); | 9749 this._lang_error('bad function body', expr.get$span()); |
| 9747 } | 9750 } |
| 9748 var span = new SourceSpan(expr.get$span().get$file(), expr.get$span().get$star
t(), body.get$span().get$end()); | 9751 var span = new SourceSpan(expr.get$span().get$file(), expr.get$span().get$star
t(), body.get$span().get$end()); |
| 9749 var func = new FunctionDefinition(null, type, name, formals, null, null, null,
body, span); | 9752 var func = new FunctionDefinition(null, type, name, formals, null, null, null,
body, span); |
| 9750 return new LambdaExpression(func, func.get$span()); | 9753 return new LambdaExpression(func, func.get$span()); |
| 9751 } | 9754 } |
| 9752 Parser.prototype._makeDeclaredIdentifier = function(e) { | 9755 Parser.prototype._makeDeclaredIdentifier = function(e) { |
| 9753 if ((e instanceof VarExpression)) { | 9756 if ((e instanceof VarExpression)) { |
| 9754 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); | 9757 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); |
| 9755 } | 9758 } |
| 9756 else if ((e instanceof DeclaredIdentifier)) { | 9759 else if ((e instanceof DeclaredIdentifier)) { |
| 9757 return e; | 9760 return e; |
| 9758 } | 9761 } |
| 9759 else { | 9762 else { |
| 9760 this._error('expected declared identifier'); | 9763 this._lang_error('expected declared identifier'); |
| 9761 return new DeclaredIdentifier(null, null, e.get$span()); | 9764 return new DeclaredIdentifier(null, null, e.get$span()); |
| 9762 } | 9765 } |
| 9763 } | 9766 } |
| 9764 Parser.prototype._makeLabel = function(expr) { | 9767 Parser.prototype._makeLabel = function(expr) { |
| 9765 if ((expr instanceof VarExpression)) { | 9768 if ((expr instanceof VarExpression)) { |
| 9766 return expr.get$name(); | 9769 return expr.get$name(); |
| 9767 } | 9770 } |
| 9768 else { | 9771 else { |
| 9769 this._errorExpected('label'); | 9772 this._errorExpected('label'); |
| 9770 return null; | 9773 return null; |
| 9771 } | 9774 } |
| 9772 } | 9775 } |
| 9773 Parser.prototype.block$0 = Parser.prototype.block; | 9776 Parser.prototype.block$0 = Parser.prototype.block; |
| 9774 // ********** Code for IncompleteSourceException ************** | 9777 // ********** Code for IncompleteSourceException ************** |
| 9775 function IncompleteSourceException(token) { | 9778 function IncompleteSourceException(token) { |
| 9776 this.token = token; | 9779 this.token = token; |
| 9777 // Initializers done | 9780 // Initializers done |
| 9778 } | 9781 } |
| 9779 IncompleteSourceException.prototype.toString = function() { | 9782 IncompleteSourceException.prototype.toString = function() { |
| 9780 if (this.token.get$span() == null) return ('Unexpected ' + this.token); | 9783 if (this.token.get$span() == null) return ('Unexpected ' + this.token); |
| 9781 return this.token.get$span().toMessageString(('Unexpected ' + this.token)); | 9784 return this.token.get$span().toMessageString(('Unexpected ' + this.token)); |
| 9782 } | 9785 } |
| 9783 IncompleteSourceException.prototype.toString$0 = IncompleteSourceException.proto
type.toString; | 9786 IncompleteSourceException.prototype.toString$0 = IncompleteSourceException.proto
type.toString; |
| 9784 // ********** Code for DivertedTokenSource ************** | 9787 // ********** Code for DivertedTokenSource ************** |
| 9785 function DivertedTokenSource(tokens, parser, previousTokenizer) { | 9788 function DivertedTokenSource(tokens, parser, previousTokenizer) { |
| 9786 this._pos = 0 | 9789 this._lang_pos = 0 |
| 9787 this.tokens = tokens; | 9790 this.tokens = tokens; |
| 9788 this.parser = parser; | 9791 this.parser = parser; |
| 9789 this.previousTokenizer = previousTokenizer; | 9792 this.previousTokenizer = previousTokenizer; |
| 9790 // Initializers done | 9793 // Initializers done |
| 9791 } | 9794 } |
| 9792 DivertedTokenSource.prototype.next = function() { | 9795 DivertedTokenSource.prototype.next = function() { |
| 9793 var token = this.tokens.$index(this._pos); | 9796 var token = this.tokens.$index(this._pos); |
| 9794 ++this._pos; | 9797 ++this._pos; |
| 9795 if (this._pos == this.tokens.get$length()) { | 9798 if (this._pos == this.tokens.get$length()) { |
| 9796 this.parser.tokenizer = this.previousTokenizer; | 9799 this.parser.tokenizer = this.previousTokenizer; |
| (...skipping 2633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12430 } | 12433 } |
| 12431 member = this.home.get$library().lookup(name, this.span); | 12434 member = this.home.get$library().lookup(name, this.span); |
| 12432 if (member != null) { | 12435 if (member != null) { |
| 12433 return member; | 12436 return member; |
| 12434 } | 12437 } |
| 12435 this._ensureCode(); | 12438 this._ensureCode(); |
| 12436 return null; | 12439 return null; |
| 12437 } | 12440 } |
| 12438 // ********** Code for CompilerException ************** | 12441 // ********** Code for CompilerException ************** |
| 12439 function CompilerException(_message, _location) { | 12442 function CompilerException(_message, _location) { |
| 12440 this._message = _message; | 12443 this._lang_message = _message; |
| 12441 this._location = _location; | 12444 this._location = _location; |
| 12442 // Initializers done | 12445 // Initializers done |
| 12443 } | 12446 } |
| 12444 CompilerException.prototype.toString = function() { | 12447 CompilerException.prototype.toString = function() { |
| 12445 if (this._location != null) { | 12448 if (this._location != null) { |
| 12446 return ('CompilerException: ' + this._location.toMessageString(this._message
)); | 12449 return ('CompilerException: ' + this._location.toMessageString(this._lang_me
ssage)); |
| 12447 } | 12450 } |
| 12448 else { | 12451 else { |
| 12449 return ('CompilerException: ' + this._message); | 12452 return ('CompilerException: ' + this._lang_message); |
| 12450 } | 12453 } |
| 12451 } | 12454 } |
| 12452 CompilerException.prototype.toString$0 = CompilerException.prototype.toString; | 12455 CompilerException.prototype.toString$0 = CompilerException.prototype.toString; |
| 12453 // ********** Code for World ************** | 12456 // ********** Code for World ************** |
| 12454 function World(files) { | 12457 function World(files) { |
| 12455 this.errors = 0 | 12458 this.errors = 0 |
| 12456 this.warnings = 0 | 12459 this.warnings = 0 |
| 12457 this.dartBytesRead = 0 | 12460 this.dartBytesRead = 0 |
| 12458 this.jsBytesWritten = 0 | 12461 this.jsBytesWritten = 0 |
| 12459 this.seenFatal = false | 12462 this.seenFatal = false |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13321 $globals._NO_COLOR = '\u001b[0m'; | 13324 $globals._NO_COLOR = '\u001b[0m'; |
| 13322 $globals._RED_COLOR = '\u001b[31m'; | 13325 $globals._RED_COLOR = '\u001b[31m'; |
| 13323 } | 13326 } |
| 13324 var const$0 = new EnvMap()/*const EnvMap()*/; | 13327 var const$0 = new EnvMap()/*const EnvMap()*/; |
| 13325 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; | 13328 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; |
| 13326 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; | 13329 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; |
| 13327 var const$8 = new NoMoreElementsException()/*const NoMoreElementsException()*/; | 13330 var const$8 = new NoMoreElementsException()/*const NoMoreElementsException()*/; |
| 13328 var $globals = {}; | 13331 var $globals = {}; |
| 13329 $static_init(); | 13332 $static_init(); |
| 13330 main(); | 13333 main(); |
| OLD | NEW |