| 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 ListFactory.prototype.sort$1 = function($0) { | 641 ListFactory.prototype.sort$1 = function($0) { |
| 642 return this.sort(to$call$2($0)); | 642 return this.sort(to$call$2($0)); |
| 643 }; | 643 }; |
| 644 ListFactory_E = ListFactory; | 644 ListFactory_E = ListFactory; |
| 645 ListFactory_K = ListFactory; | 645 ListFactory_K = ListFactory; |
| 646 ListFactory_String = ListFactory; | 646 ListFactory_String = ListFactory; |
| 647 ListFactory_V = ListFactory; | 647 ListFactory_V = ListFactory; |
| 648 // ********** Code for ListIterator ************** | 648 // ********** Code for ListIterator ************** |
| 649 function ListIterator(array) { | 649 function ListIterator(array) { |
| 650 this._array = array; | 650 this._array = array; |
| 651 this._pos = 0; | 651 this._dart_coreimpl_pos = 0; |
| 652 // Initializers done | 652 // Initializers done |
| 653 } | 653 } |
| 654 ListIterator.prototype.hasNext = function() { | 654 ListIterator.prototype.hasNext = function() { |
| 655 return this._array.length > this._pos; | 655 return this._array.length > this._dart_coreimpl_pos; |
| 656 } | 656 } |
| 657 ListIterator.prototype.next = function() { | 657 ListIterator.prototype.next = function() { |
| 658 if (!this.hasNext()) { | 658 if (!this.hasNext()) { |
| 659 $throw(const$8/*const NoMoreElementsException()*/); | 659 $throw(const$8/*const NoMoreElementsException()*/); |
| 660 } | 660 } |
| 661 return this._array.$index(this._pos++); | 661 return this._array.$index(this._dart_coreimpl_pos++); |
| 662 } | 662 } |
| 663 ListIterator.prototype.hasNext$0 = ListIterator.prototype.hasNext; | 663 ListIterator.prototype.hasNext$0 = ListIterator.prototype.hasNext; |
| 664 ListIterator.prototype.next$0 = ListIterator.prototype.next; | 664 ListIterator.prototype.next$0 = ListIterator.prototype.next; |
| 665 // ********** Code for NumImplementation ************** | 665 // ********** Code for NumImplementation ************** |
| 666 NumImplementation = Number; | 666 NumImplementation = Number; |
| 667 NumImplementation.prototype.isNaN = function() { | 667 NumImplementation.prototype.isNaN = function() { |
| 668 return isNaN(this); | 668 return isNaN(this); |
| 669 } | 669 } |
| 670 NumImplementation.prototype.isNegative = function() { | 670 NumImplementation.prototype.isNegative = function() { |
| 671 return this == 0 ? (1 / this) < 0 : this < 0; | 671 return this == 0 ? (1 / this) < 0 : this < 0; |
| (...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2177 for (var $$i = 0;$$i < $$list.length; $$i++) { | 2177 for (var $$i = 0;$$i < $$list.length; $$i++) { |
| 2178 var file = $$list.$index($$i); | 2178 var file = $$list.$index($$i); |
| 2179 var filename = basename(file.get$filename()); | 2179 var filename = basename(file.get$filename()); |
| 2180 this.writer.comment(('// ********** Natives ' + filename + ' **************
')); | 2180 this.writer.comment(('// ********** Natives ' + filename + ' **************
')); |
| 2181 this.writer.writeln(file.get$text()); | 2181 this.writer.writeln(file.get$text()); |
| 2182 } | 2182 } |
| 2183 lib.topType.markUsed(); | 2183 lib.topType.markUsed(); |
| 2184 var $$list = this._orderValues(lib.types); | 2184 var $$list = this._orderValues(lib.types); |
| 2185 for (var $$i = 0;$$i < $$list.length; $$i++) { | 2185 for (var $$i = 0;$$i < $$list.length; $$i++) { |
| 2186 var type = $$list.$index($$i); | 2186 var type = $$list.$index($$i); |
| 2187 if ((type.get$isUsed() || type.get$isHiddenNativeType()) && type.get$isClass
()) { | 2187 if ((type.get$isUsed() || $eq(type.get$library(), $globals.world.get$dom())
|| type.get$isHiddenNativeType()) && type.get$isClass()) { |
| 2188 this.writeType(type); | 2188 this.writeType(type); |
| 2189 if (type.get$isGeneric()) { | 2189 if (type.get$isGeneric()) { |
| 2190 var $list0 = this._orderValues(type.get$_concreteTypes()); | 2190 var $list0 = this._orderValues(type.get$_concreteTypes()); |
| 2191 for (var $i0 = 0;$i0 < $list0.length; $i0++) { | 2191 for (var $i0 = 0;$i0 < $list0.length; $i0++) { |
| 2192 var ct = $list0.$index($i0); | 2192 var ct = $list0.$index($i0); |
| 2193 this.writeType(ct); | 2193 this.writeType(ct); |
| 2194 } | 2194 } |
| 2195 } | 2195 } |
| 2196 } | 2196 } |
| 2197 else if (type.get$isFunction() && type.get$varStubs().length > 0) { | 2197 else if (type.get$isFunction() && type.get$varStubs().length > 0) { |
| (...skipping 4245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6443 return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c) |
| c == 36); | 6443 return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c) |
| c == 36); |
| 6444 } | 6444 } |
| 6445 TokenizerHelpers.isInterpIdentifierPart = function(c) { | 6445 TokenizerHelpers.isInterpIdentifierPart = function(c) { |
| 6446 return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c)); | 6446 return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c)); |
| 6447 } | 6447 } |
| 6448 // ********** Code for TokenizerBase ************** | 6448 // ********** Code for TokenizerBase ************** |
| 6449 $inherits(TokenizerBase, TokenizerHelpers); | 6449 $inherits(TokenizerBase, TokenizerHelpers); |
| 6450 function TokenizerBase(_source, _skipWhitespace, index) { | 6450 function TokenizerBase(_source, _skipWhitespace, index) { |
| 6451 this._source = _source; | 6451 this._source = _source; |
| 6452 this._skipWhitespace = _skipWhitespace; | 6452 this._skipWhitespace = _skipWhitespace; |
| 6453 this._lang_index = index; | 6453 this._index = index; |
| 6454 // Initializers done | 6454 // Initializers done |
| 6455 TokenizerHelpers.call(this); | 6455 TokenizerHelpers.call(this); |
| 6456 this._text = this._source.get$text(); | 6456 this._text = this._source.get$text(); |
| 6457 } | 6457 } |
| 6458 TokenizerBase.prototype._nextChar = function() { | 6458 TokenizerBase.prototype._nextChar = function() { |
| 6459 if (this._lang_index < this._text.length) { | 6459 if (this._index < this._text.length) { |
| 6460 return this._text.charCodeAt(this._lang_index++); | 6460 return this._text.charCodeAt(this._index++); |
| 6461 } | 6461 } |
| 6462 else { | 6462 else { |
| 6463 return 0; | 6463 return 0; |
| 6464 } | 6464 } |
| 6465 } | 6465 } |
| 6466 TokenizerBase.prototype._peekChar = function() { | 6466 TokenizerBase.prototype._peekChar = function() { |
| 6467 if (this._lang_index < this._text.length) { | 6467 if (this._index < this._text.length) { |
| 6468 return this._text.charCodeAt(this._lang_index); | 6468 return this._text.charCodeAt(this._index); |
| 6469 } | 6469 } |
| 6470 else { | 6470 else { |
| 6471 return 0; | 6471 return 0; |
| 6472 } | 6472 } |
| 6473 } | 6473 } |
| 6474 TokenizerBase.prototype._maybeEatChar = function(ch) { | 6474 TokenizerBase.prototype._maybeEatChar = function(ch) { |
| 6475 if (this._lang_index < this._text.length) { | 6475 if (this._index < this._text.length) { |
| 6476 if (this._text.charCodeAt(this._lang_index) == ch) { | 6476 if (this._text.charCodeAt(this._index) == ch) { |
| 6477 this._lang_index++; | 6477 this._index++; |
| 6478 return true; | 6478 return true; |
| 6479 } | 6479 } |
| 6480 else { | 6480 else { |
| 6481 return false; | 6481 return false; |
| 6482 } | 6482 } |
| 6483 } | 6483 } |
| 6484 else { | 6484 else { |
| 6485 return false; | 6485 return false; |
| 6486 } | 6486 } |
| 6487 } | 6487 } |
| 6488 TokenizerBase.prototype._finishToken = function(kind) { | 6488 TokenizerBase.prototype._finishToken = function(kind) { |
| 6489 return new Token(kind, this._source, this._startIndex, this._lang_index); | 6489 return new Token(kind, this._source, this._startIndex, this._index); |
| 6490 } | 6490 } |
| 6491 TokenizerBase.prototype._errorToken = function(message) { | 6491 TokenizerBase.prototype._errorToken = function(message) { |
| 6492 return new ErrorToken(65/*TokenKind.ERROR*/, this._source, this._startIndex, t
his._lang_index, message); | 6492 return new ErrorToken(65/*TokenKind.ERROR*/, this._source, this._startIndex, t
his._index, message); |
| 6493 } | 6493 } |
| 6494 TokenizerBase.prototype.finishWhitespace = function() { | 6494 TokenizerBase.prototype.finishWhitespace = function() { |
| 6495 this._lang_index--; | 6495 this._index--; |
| 6496 while (this._lang_index < this._text.length) { | 6496 while (this._index < this._text.length) { |
| 6497 var ch = this._text.charCodeAt(this._lang_index++); | 6497 var ch = this._text.charCodeAt(this._index++); |
| 6498 if (ch == 32 || ch == 9 || ch == 13) { | 6498 if (ch == 32 || ch == 9 || ch == 13) { |
| 6499 } | 6499 } |
| 6500 else if (ch == 10) { | 6500 else if (ch == 10) { |
| 6501 if (!this._skipWhitespace) { | 6501 if (!this._skipWhitespace) { |
| 6502 return this._finishToken(63/*TokenKind.WHITESPACE*/); | 6502 return this._finishToken(63/*TokenKind.WHITESPACE*/); |
| 6503 } | 6503 } |
| 6504 } | 6504 } |
| 6505 else { | 6505 else { |
| 6506 this._lang_index--; | 6506 this._index--; |
| 6507 if (this._skipWhitespace) { | 6507 if (this._skipWhitespace) { |
| 6508 return this.next(); | 6508 return this.next(); |
| 6509 } | 6509 } |
| 6510 else { | 6510 else { |
| 6511 return this._finishToken(63/*TokenKind.WHITESPACE*/); | 6511 return this._finishToken(63/*TokenKind.WHITESPACE*/); |
| 6512 } | 6512 } |
| 6513 } | 6513 } |
| 6514 } | 6514 } |
| 6515 return this._finishToken(1/*TokenKind.END_OF_FILE*/); | 6515 return this._finishToken(1/*TokenKind.END_OF_FILE*/); |
| 6516 } | 6516 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6548 } | 6548 } |
| 6549 else { | 6549 else { |
| 6550 return this._finishToken(64/*TokenKind.COMMENT*/); | 6550 return this._finishToken(64/*TokenKind.COMMENT*/); |
| 6551 } | 6551 } |
| 6552 } | 6552 } |
| 6553 } | 6553 } |
| 6554 } | 6554 } |
| 6555 return this._errorToken(); | 6555 return this._errorToken(); |
| 6556 } | 6556 } |
| 6557 TokenizerBase.prototype.eatDigits = function() { | 6557 TokenizerBase.prototype.eatDigits = function() { |
| 6558 while (this._lang_index < this._text.length) { | 6558 while (this._index < this._text.length) { |
| 6559 if (TokenizerHelpers.isDigit(this._text.charCodeAt(this._lang_index))) { | 6559 if (TokenizerHelpers.isDigit(this._text.charCodeAt(this._index))) { |
| 6560 this._lang_index++; | 6560 this._index++; |
| 6561 } | 6561 } |
| 6562 else { | 6562 else { |
| 6563 return; | 6563 return; |
| 6564 } | 6564 } |
| 6565 } | 6565 } |
| 6566 } | 6566 } |
| 6567 TokenizerBase.prototype.eatHexDigits = function() { | 6567 TokenizerBase.prototype.eatHexDigits = function() { |
| 6568 while (this._lang_index < this._text.length) { | 6568 while (this._index < this._text.length) { |
| 6569 if (TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._lang_index))) { | 6569 if (TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._index))) { |
| 6570 this._lang_index++; | 6570 this._index++; |
| 6571 } | 6571 } |
| 6572 else { | 6572 else { |
| 6573 return; | 6573 return; |
| 6574 } | 6574 } |
| 6575 } | 6575 } |
| 6576 } | 6576 } |
| 6577 TokenizerBase.prototype.maybeEatHexDigit = function() { | 6577 TokenizerBase.prototype.maybeEatHexDigit = function() { |
| 6578 if (this._lang_index < this._text.length && TokenizerHelpers.isHexDigit(this._
text.charCodeAt(this._lang_index))) { | 6578 if (this._index < this._text.length && TokenizerHelpers.isHexDigit(this._text.
charCodeAt(this._index))) { |
| 6579 this._lang_index++; | 6579 this._index++; |
| 6580 return true; | 6580 return true; |
| 6581 } | 6581 } |
| 6582 return false; | 6582 return false; |
| 6583 } | 6583 } |
| 6584 TokenizerBase.prototype.finishHex = function() { | 6584 TokenizerBase.prototype.finishHex = function() { |
| 6585 this.eatHexDigits(); | 6585 this.eatHexDigits(); |
| 6586 return this._finishToken(61/*TokenKind.HEX_INTEGER*/); | 6586 return this._finishToken(61/*TokenKind.HEX_INTEGER*/); |
| 6587 } | 6587 } |
| 6588 TokenizerBase.prototype.finishNumber = function() { | 6588 TokenizerBase.prototype.finishNumber = function() { |
| 6589 this.eatDigits(); | 6589 this.eatDigits(); |
| 6590 if (this._peekChar() == 46) { | 6590 if (this._peekChar() == 46) { |
| 6591 this._nextChar(); | 6591 this._nextChar(); |
| 6592 if (TokenizerHelpers.isDigit(this._peekChar())) { | 6592 if (TokenizerHelpers.isDigit(this._peekChar())) { |
| 6593 this.eatDigits(); | 6593 this.eatDigits(); |
| 6594 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); | 6594 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); |
| 6595 } | 6595 } |
| 6596 else { | 6596 else { |
| 6597 this._lang_index--; | 6597 this._index--; |
| 6598 } | 6598 } |
| 6599 } | 6599 } |
| 6600 return this.finishNumberExtra(60/*TokenKind.INTEGER*/); | 6600 return this.finishNumberExtra(60/*TokenKind.INTEGER*/); |
| 6601 } | 6601 } |
| 6602 TokenizerBase.prototype.finishNumberExtra = function(kind) { | 6602 TokenizerBase.prototype.finishNumberExtra = function(kind) { |
| 6603 if (this._maybeEatChar(101) || this._maybeEatChar(69)) { | 6603 if (this._maybeEatChar(101) || this._maybeEatChar(69)) { |
| 6604 kind = 62/*TokenKind.DOUBLE*/; | 6604 kind = 62/*TokenKind.DOUBLE*/; |
| 6605 this._maybeEatChar(45); | 6605 this._maybeEatChar(45); |
| 6606 this._maybeEatChar(43); | 6606 this._maybeEatChar(43); |
| 6607 this.eatDigits(); | 6607 this.eatDigits(); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6721 TokenizerBase.prototype.eatEscapeSequence = function() { | 6721 TokenizerBase.prototype.eatEscapeSequence = function() { |
| 6722 var hex; | 6722 var hex; |
| 6723 switch (this._nextChar()) { | 6723 switch (this._nextChar()) { |
| 6724 case 120: | 6724 case 120: |
| 6725 | 6725 |
| 6726 return this.maybeEatHexDigit() && this.maybeEatHexDigit(); | 6726 return this.maybeEatHexDigit() && this.maybeEatHexDigit(); |
| 6727 | 6727 |
| 6728 case 117: | 6728 case 117: |
| 6729 | 6729 |
| 6730 if (this._maybeEatChar(123)) { | 6730 if (this._maybeEatChar(123)) { |
| 6731 var start = this._lang_index; | 6731 var start = this._index; |
| 6732 this.eatHexDigits(); | 6732 this.eatHexDigits(); |
| 6733 var chars = this._lang_index - start; | 6733 var chars = this._index - start; |
| 6734 if (chars > 0 && chars <= 6 && this._maybeEatChar(125)) { | 6734 if (chars > 0 && chars <= 6 && this._maybeEatChar(125)) { |
| 6735 hex = this._text.substring(start, start + chars); | 6735 hex = this._text.substring(start, start + chars); |
| 6736 break; | 6736 break; |
| 6737 } | 6737 } |
| 6738 else { | 6738 else { |
| 6739 return false; | 6739 return false; |
| 6740 } | 6740 } |
| 6741 } | 6741 } |
| 6742 else { | 6742 else { |
| 6743 if (this.maybeEatHexDigit() && this.maybeEatHexDigit() && this.maybeEatH
exDigit() && this.maybeEatHexDigit()) { | 6743 if (this.maybeEatHexDigit() && this.maybeEatHexDigit() && this.maybeEatH
exDigit() && this.maybeEatHexDigit()) { |
| 6744 hex = this._text.substring(this._lang_index - 4, this._lang_index); | 6744 hex = this._text.substring(this._index - 4, this._index); |
| 6745 break; | 6745 break; |
| 6746 } | 6746 } |
| 6747 else { | 6747 else { |
| 6748 return false; | 6748 return false; |
| 6749 } | 6749 } |
| 6750 } | 6750 } |
| 6751 | 6751 |
| 6752 default: | 6752 default: |
| 6753 | 6753 |
| 6754 return true; | 6754 return true; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 6765 else { | 6765 else { |
| 6766 return this._finishToken(14/*TokenKind.DOT*/); | 6766 return this._finishToken(14/*TokenKind.DOT*/); |
| 6767 } | 6767 } |
| 6768 } | 6768 } |
| 6769 TokenizerBase.prototype.finishIdentifier = function(ch) { | 6769 TokenizerBase.prototype.finishIdentifier = function(ch) { |
| 6770 if (this._interpStack != null && this._interpStack.depth == -1) { | 6770 if (this._interpStack != null && this._interpStack.depth == -1) { |
| 6771 this._interpStack.depth = 0; | 6771 this._interpStack.depth = 0; |
| 6772 if (ch == 36) { | 6772 if (ch == 36) { |
| 6773 return this._errorToken("illegal character after $ in string interpolation
"); | 6773 return this._errorToken("illegal character after $ in string interpolation
"); |
| 6774 } | 6774 } |
| 6775 while (this._lang_index < this._text.length) { | 6775 while (this._index < this._text.length) { |
| 6776 if (!TokenizerHelpers.isInterpIdentifierPart(this._text.charCodeAt(this._l
ang_index++))) { | 6776 if (!TokenizerHelpers.isInterpIdentifierPart(this._text.charCodeAt(this._i
ndex++))) { |
| 6777 this._lang_index--; | 6777 this._index--; |
| 6778 break; | 6778 break; |
| 6779 } | 6779 } |
| 6780 } | 6780 } |
| 6781 } | 6781 } |
| 6782 else { | 6782 else { |
| 6783 while (this._lang_index < this._text.length) { | 6783 while (this._index < this._text.length) { |
| 6784 if (!TokenizerHelpers.isIdentifierPart(this._text.charCodeAt(this._lang_in
dex++))) { | 6784 if (!TokenizerHelpers.isIdentifierPart(this._text.charCodeAt(this._index++
))) { |
| 6785 this._lang_index--; | 6785 this._index--; |
| 6786 break; | 6786 break; |
| 6787 } | 6787 } |
| 6788 } | 6788 } |
| 6789 } | 6789 } |
| 6790 var kind = this.getIdentifierKind(); | 6790 var kind = this.getIdentifierKind(); |
| 6791 if (kind == 70/*TokenKind.IDENTIFIER*/) { | 6791 if (kind == 70/*TokenKind.IDENTIFIER*/) { |
| 6792 return this._finishToken(70/*TokenKind.IDENTIFIER*/); | 6792 return this._finishToken(70/*TokenKind.IDENTIFIER*/); |
| 6793 } | 6793 } |
| 6794 else { | 6794 else { |
| 6795 return this._finishToken(kind); | 6795 return this._finishToken(kind); |
| 6796 } | 6796 } |
| 6797 } | 6797 } |
| 6798 TokenizerBase.prototype.next$0 = TokenizerBase.prototype.next; | 6798 TokenizerBase.prototype.next$0 = TokenizerBase.prototype.next; |
| 6799 // ********** Code for Tokenizer ************** | 6799 // ********** Code for Tokenizer ************** |
| 6800 $inherits(Tokenizer, TokenizerBase); | 6800 $inherits(Tokenizer, TokenizerBase); |
| 6801 function Tokenizer(source, skipWhitespace, index) { | 6801 function Tokenizer(source, skipWhitespace, index) { |
| 6802 // Initializers done | 6802 // Initializers done |
| 6803 TokenizerBase.call(this, source, skipWhitespace, index); | 6803 TokenizerBase.call(this, source, skipWhitespace, index); |
| 6804 } | 6804 } |
| 6805 Tokenizer.prototype.next = function() { | 6805 Tokenizer.prototype.next = function() { |
| 6806 this._startIndex = this._lang_index; | 6806 this._startIndex = this._index; |
| 6807 if (this._interpStack != null && this._interpStack.depth == 0) { | 6807 if (this._interpStack != null && this._interpStack.depth == 0) { |
| 6808 var istack = this._interpStack; | 6808 var istack = this._interpStack; |
| 6809 this._interpStack = this._interpStack.pop(); | 6809 this._interpStack = this._interpStack.pop(); |
| 6810 if (istack.get$isMultiline()) { | 6810 if (istack.get$isMultiline()) { |
| 6811 return this.finishMultilineString(istack.get$quote()); | 6811 return this.finishMultilineString(istack.get$quote()); |
| 6812 } | 6812 } |
| 6813 else { | 6813 else { |
| 6814 return this.finishStringBody(istack.get$quote()); | 6814 return this.finishStringBody(istack.get$quote()); |
| 6815 } | 6815 } |
| 6816 } | 6816 } |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7131 return this.finishNumber(); | 7131 return this.finishNumber(); |
| 7132 } | 7132 } |
| 7133 else { | 7133 else { |
| 7134 return this._errorToken(); | 7134 return this._errorToken(); |
| 7135 } | 7135 } |
| 7136 | 7136 |
| 7137 } | 7137 } |
| 7138 } | 7138 } |
| 7139 Tokenizer.prototype.getIdentifierKind = function() { | 7139 Tokenizer.prototype.getIdentifierKind = function() { |
| 7140 var i0 = this._startIndex; | 7140 var i0 = this._startIndex; |
| 7141 switch (this._lang_index - i0) { | 7141 switch (this._index - i0) { |
| 7142 case 2: | 7142 case 2: |
| 7143 | 7143 |
| 7144 if (this._text.charCodeAt(i0) == 100) { | 7144 if (this._text.charCodeAt(i0) == 100) { |
| 7145 if (this._text.charCodeAt(i0 + 1) == 111) return 95/*TokenKind.DO*/; | 7145 if (this._text.charCodeAt(i0 + 1) == 111) return 95/*TokenKind.DO*/; |
| 7146 } | 7146 } |
| 7147 else if (this._text.charCodeAt(i0) == 105) { | 7147 else if (this._text.charCodeAt(i0) == 105) { |
| 7148 if (this._text.charCodeAt(i0 + 1) == 102) { | 7148 if (this._text.charCodeAt(i0 + 1) == 102) { |
| 7149 return 101/*TokenKind.IF*/; | 7149 return 101/*TokenKind.IF*/; |
| 7150 } | 7150 } |
| 7151 else if (this._text.charCodeAt(i0 + 1) == 110) { | 7151 else if (this._text.charCodeAt(i0 + 1) == 110) { |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8150 this._afterParens = []; | 8150 this._afterParens = []; |
| 8151 } | 8151 } |
| 8152 Parser.prototype.get$enableAwait = function() { | 8152 Parser.prototype.get$enableAwait = function() { |
| 8153 return $globals.experimentalAwaitPhase != null; | 8153 return $globals.experimentalAwaitPhase != null; |
| 8154 } | 8154 } |
| 8155 Parser.prototype.isPrematureEndOfFile = function() { | 8155 Parser.prototype.isPrematureEndOfFile = function() { |
| 8156 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*/)) { | 8156 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*/)) { |
| 8157 $throw(new IncompleteSourceException(this._previousToken)); | 8157 $throw(new IncompleteSourceException(this._previousToken)); |
| 8158 } | 8158 } |
| 8159 else if (this._maybeEat(1/*TokenKind.END_OF_FILE*/)) { | 8159 else if (this._maybeEat(1/*TokenKind.END_OF_FILE*/)) { |
| 8160 this._lang_error('unexpected end of file', this._peekToken.get$span()); | 8160 this._error('unexpected end of file', this._peekToken.get$span()); |
| 8161 return true; | 8161 return true; |
| 8162 } | 8162 } |
| 8163 else { | 8163 else { |
| 8164 return false; | 8164 return false; |
| 8165 } | 8165 } |
| 8166 } | 8166 } |
| 8167 Parser.prototype._recoverTo = function(kind1, kind2, kind3) { | 8167 Parser.prototype._recoverTo = function(kind1, kind2, kind3) { |
| 8168 while (!this.isPrematureEndOfFile()) { | 8168 while (!this.isPrematureEndOfFile()) { |
| 8169 var kind = this._peek(); | 8169 var kind = this._peek(); |
| 8170 if (kind == kind1 || kind == kind2 || kind == kind3) { | 8170 if (kind == kind1 || kind == kind2 || kind == kind3) { |
| 8171 this._recover = false; | 8171 this._recover = false; |
| 8172 return true; | 8172 return true; |
| 8173 } | 8173 } |
| 8174 this._lang_next(); | 8174 this._next(); |
| 8175 } | 8175 } |
| 8176 return false; | 8176 return false; |
| 8177 } | 8177 } |
| 8178 Parser.prototype._peek = function() { | 8178 Parser.prototype._peek = function() { |
| 8179 return this._peekToken.kind; | 8179 return this._peekToken.kind; |
| 8180 } | 8180 } |
| 8181 Parser.prototype._lang_next = function() { | 8181 Parser.prototype._next = function() { |
| 8182 this._previousToken = this._peekToken; | 8182 this._previousToken = this._peekToken; |
| 8183 this._peekToken = this.tokenizer.next(); | 8183 this._peekToken = this.tokenizer.next(); |
| 8184 return this._previousToken; | 8184 return this._previousToken; |
| 8185 } | 8185 } |
| 8186 Parser.prototype._peekKind = function(kind) { | 8186 Parser.prototype._peekKind = function(kind) { |
| 8187 return this._peekToken.kind == kind; | 8187 return this._peekToken.kind == kind; |
| 8188 } | 8188 } |
| 8189 Parser.prototype._peekIdentifier = function() { | 8189 Parser.prototype._peekIdentifier = function() { |
| 8190 return this._isIdentifier(this._peekToken.kind); | 8190 return this._isIdentifier(this._peekToken.kind); |
| 8191 } | 8191 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 8206 if (!this._maybeEat(kind)) { | 8206 if (!this._maybeEat(kind)) { |
| 8207 this._errorExpected(TokenKind.kindToString(kind)); | 8207 this._errorExpected(TokenKind.kindToString(kind)); |
| 8208 } | 8208 } |
| 8209 } | 8209 } |
| 8210 Parser.prototype._eatSemicolon = function() { | 8210 Parser.prototype._eatSemicolon = function() { |
| 8211 if (this.optionalSemicolons && this._peekKind(1/*TokenKind.END_OF_FILE*/)) ret
urn; | 8211 if (this.optionalSemicolons && this._peekKind(1/*TokenKind.END_OF_FILE*/)) ret
urn; |
| 8212 this._eat(10/*TokenKind.SEMICOLON*/); | 8212 this._eat(10/*TokenKind.SEMICOLON*/); |
| 8213 } | 8213 } |
| 8214 Parser.prototype._errorExpected = function(expected) { | 8214 Parser.prototype._errorExpected = function(expected) { |
| 8215 if (this.throwOnIncomplete) this.isPrematureEndOfFile(); | 8215 if (this.throwOnIncomplete) this.isPrematureEndOfFile(); |
| 8216 var tok = this._lang_next(); | 8216 var tok = this._next(); |
| 8217 if ((tok instanceof ErrorToken) && tok.get$message() != null) { | 8217 if ((tok instanceof ErrorToken) && tok.get$message() != null) { |
| 8218 this._lang_error(tok.get$message(), tok.get$span()); | 8218 this._error(tok.get$message(), tok.get$span()); |
| 8219 } | 8219 } |
| 8220 else { | 8220 else { |
| 8221 this._lang_error(('expected ' + expected + ', but found ' + tok), tok.get$sp
an()); | 8221 this._error(('expected ' + expected + ', but found ' + tok), tok.get$span())
; |
| 8222 } | 8222 } |
| 8223 } | 8223 } |
| 8224 Parser.prototype._lang_error = function(message, location) { | 8224 Parser.prototype._error = function(message, location) { |
| 8225 if (this._recover) return; | 8225 if (this._recover) return; |
| 8226 if (location == null) { | 8226 if (location == null) { |
| 8227 location = this._peekToken.get$span(); | 8227 location = this._peekToken.get$span(); |
| 8228 } | 8228 } |
| 8229 $globals.world.fatal(message, location); | 8229 $globals.world.fatal(message, location); |
| 8230 this._recover = true; | 8230 this._recover = true; |
| 8231 } | 8231 } |
| 8232 Parser.prototype._skipBlock = function() { | 8232 Parser.prototype._skipBlock = function() { |
| 8233 var depth = 1; | 8233 var depth = 1; |
| 8234 this._eat(6/*TokenKind.LBRACE*/); | 8234 this._eat(6/*TokenKind.LBRACE*/); |
| 8235 while (true) { | 8235 while (true) { |
| 8236 var tok = this._lang_next(); | 8236 var tok = this._next(); |
| 8237 if ($eq(tok.get$kind(), 6/*TokenKind.LBRACE*/)) { | 8237 if ($eq(tok.get$kind(), 6/*TokenKind.LBRACE*/)) { |
| 8238 depth += 1; | 8238 depth += 1; |
| 8239 } | 8239 } |
| 8240 else if ($eq(tok.get$kind(), 7/*TokenKind.RBRACE*/)) { | 8240 else if ($eq(tok.get$kind(), 7/*TokenKind.RBRACE*/)) { |
| 8241 depth -= 1; | 8241 depth -= 1; |
| 8242 if (depth == 0) return; | 8242 if (depth == 0) return; |
| 8243 } | 8243 } |
| 8244 else if ($eq(tok.get$kind(), 1/*TokenKind.END_OF_FILE*/)) { | 8244 else if ($eq(tok.get$kind(), 1/*TokenKind.END_OF_FILE*/)) { |
| 8245 this._lang_error('unexpected end of file during diet parse', tok.get$span(
)); | 8245 this._error('unexpected end of file during diet parse', tok.get$span()); |
| 8246 return; | 8246 return; |
| 8247 } | 8247 } |
| 8248 } | 8248 } |
| 8249 } | 8249 } |
| 8250 Parser.prototype._makeSpan = function(start) { | 8250 Parser.prototype._makeSpan = function(start) { |
| 8251 return new SourceSpan(this.source, start, this._previousToken.end); | 8251 return new SourceSpan(this.source, start, this._previousToken.end); |
| 8252 } | 8252 } |
| 8253 Parser.prototype.compilationUnit = function() { | 8253 Parser.prototype.compilationUnit = function() { |
| 8254 var ret = []; | 8254 var ret = []; |
| 8255 this._maybeEat(13/*TokenKind.HASHBANG*/); | 8255 this._maybeEat(13/*TokenKind.HASHBANG*/); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8376 } | 8376 } |
| 8377 else { | 8377 else { |
| 8378 return this.block(); | 8378 return this.block(); |
| 8379 } | 8379 } |
| 8380 } | 8380 } |
| 8381 else if (!inExpression) { | 8381 else if (!inExpression) { |
| 8382 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { | 8382 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { |
| 8383 return null; | 8383 return null; |
| 8384 } | 8384 } |
| 8385 } | 8385 } |
| 8386 this._lang_error('Expected function body (neither { nor => found)'); | 8386 this._error('Expected function body (neither { nor => found)'); |
| 8387 } | 8387 } |
| 8388 Parser.prototype.finishField = function(start, modifiers, typeParams, type, name
, value) { | 8388 Parser.prototype.finishField = function(start, modifiers, typeParams, type, name
, value) { |
| 8389 if (typeParams != null) { | 8389 if (typeParams != null) { |
| 8390 $globals.world.internalError('trying to create a generic field', this._makeS
pan(start)); | 8390 $globals.world.internalError('trying to create a generic field', this._makeS
pan(start)); |
| 8391 } | 8391 } |
| 8392 var names = [name]; | 8392 var names = [name]; |
| 8393 var values = [value]; | 8393 var values = [value]; |
| 8394 while (this._maybeEat(11/*TokenKind.COMMA*/)) { | 8394 while (this._maybeEat(11/*TokenKind.COMMA*/)) { |
| 8395 names.add$1(this.identifier()); | 8395 names.add$1(this.identifier()); |
| 8396 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 8396 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8443 Parser.prototype.declaration = function(includeOperators) { | 8443 Parser.prototype.declaration = function(includeOperators) { |
| 8444 var start = this._peekToken.start; | 8444 var start = this._peekToken.start; |
| 8445 if (this._peekKind(75/*TokenKind.FACTORY*/)) { | 8445 if (this._peekKind(75/*TokenKind.FACTORY*/)) { |
| 8446 return this.factoryConstructorDeclaration(); | 8446 return this.factoryConstructorDeclaration(); |
| 8447 } | 8447 } |
| 8448 var modifiers = this._readModifiers(); | 8448 var modifiers = this._readModifiers(); |
| 8449 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include
Operators), null); | 8449 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include
Operators), null); |
| 8450 } | 8450 } |
| 8451 Parser.prototype.factoryConstructorDeclaration = function() { | 8451 Parser.prototype.factoryConstructorDeclaration = function() { |
| 8452 var start = this._peekToken.start; | 8452 var start = this._peekToken.start; |
| 8453 var factoryToken = this._lang_next(); | 8453 var factoryToken = this._next(); |
| 8454 var names = [this.identifier()]; | 8454 var names = [this.identifier()]; |
| 8455 while (this._maybeEat(14/*TokenKind.DOT*/)) { | 8455 while (this._maybeEat(14/*TokenKind.DOT*/)) { |
| 8456 names.add$1(this.identifier()); | 8456 names.add$1(this.identifier()); |
| 8457 } | 8457 } |
| 8458 var typeParams = null; | 8458 var typeParams = null; |
| 8459 if (this._peekKind(52/*TokenKind.LT*/)) { | 8459 if (this._peekKind(52/*TokenKind.LT*/)) { |
| 8460 typeParams = this.typeParameters(); | 8460 typeParams = this.typeParameters(); |
| 8461 } | 8461 } |
| 8462 var name = null; | 8462 var name = null; |
| 8463 var type = null; | 8463 var type = null; |
| 8464 if (this._maybeEat(14/*TokenKind.DOT*/)) { | 8464 if (this._maybeEat(14/*TokenKind.DOT*/)) { |
| 8465 name = this.identifier(); | 8465 name = this.identifier(); |
| 8466 } | 8466 } |
| 8467 else if (typeParams == null) { | 8467 else if (typeParams == null) { |
| 8468 if (names.length > 1) { | 8468 if (names.length > 1) { |
| 8469 name = names.removeLast$0(); | 8469 name = names.removeLast$0(); |
| 8470 } | 8470 } |
| 8471 else { | 8471 else { |
| 8472 name = new Identifier('', names.$index(0).get$span()); | 8472 name = new Identifier('', names.$index(0).get$span()); |
| 8473 } | 8473 } |
| 8474 } | 8474 } |
| 8475 else { | 8475 else { |
| 8476 name = new Identifier('', names.$index(0).get$span()); | 8476 name = new Identifier('', names.$index(0).get$span()); |
| 8477 } | 8477 } |
| 8478 if (names.length > 1) { | 8478 if (names.length > 1) { |
| 8479 this._lang_error('unsupported qualified name for factory', names.$index(0).g
et$span()); | 8479 this._error('unsupported qualified name for factory', names.$index(0).get$sp
an()); |
| 8480 } | 8480 } |
| 8481 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get
$span()); | 8481 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get
$span()); |
| 8482 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); | 8482 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); |
| 8483 return this.finishDefinition(start, [factoryToken], di, typeParams); | 8483 return this.finishDefinition(start, [factoryToken], di, typeParams); |
| 8484 } | 8484 } |
| 8485 Parser.prototype.statement = function() { | 8485 Parser.prototype.statement = function() { |
| 8486 switch (this._peek()) { | 8486 switch (this._peek()) { |
| 8487 case 89/*TokenKind.BREAK*/: | 8487 case 89/*TokenKind.BREAK*/: |
| 8488 | 8488 |
| 8489 return this.breakStatement(); | 8489 return this.breakStatement(); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8748 } | 8748 } |
| 8749 else if (this._maybeEat(94/*TokenKind.DEFAULT*/)) { | 8749 else if (this._maybeEat(94/*TokenKind.DEFAULT*/)) { |
| 8750 cases.add$1(); | 8750 cases.add$1(); |
| 8751 this._eat(8/*TokenKind.COLON*/); | 8751 this._eat(8/*TokenKind.COLON*/); |
| 8752 } | 8752 } |
| 8753 else { | 8753 else { |
| 8754 break; | 8754 break; |
| 8755 } | 8755 } |
| 8756 } | 8756 } |
| 8757 if ($eq(cases.length, 0)) { | 8757 if ($eq(cases.length, 0)) { |
| 8758 this._lang_error('case or default'); | 8758 this._error('case or default'); |
| 8759 } | 8759 } |
| 8760 var stmts = []; | 8760 var stmts = []; |
| 8761 while (!this._peekCaseEnd()) { | 8761 while (!this._peekCaseEnd()) { |
| 8762 stmts.add$1(this.statement()); | 8762 stmts.add$1(this.statement()); |
| 8763 if (this._recover && !this._recoverTo(7/*TokenKind.RBRACE*/, 90/*TokenKind.C
ASE*/, 94/*TokenKind.DEFAULT*/)) { | 8763 if (this._recover && !this._recoverTo(7/*TokenKind.RBRACE*/, 90/*TokenKind.C
ASE*/, 94/*TokenKind.DEFAULT*/)) { |
| 8764 break; | 8764 break; |
| 8765 } | 8765 } |
| 8766 } | 8766 } |
| 8767 return new CaseNode(label, cases, stmts, this._makeSpan(start)); | 8767 return new CaseNode(label, cases, stmts, this._makeSpan(start)); |
| 8768 } | 8768 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8833 if (type.get$names() == null) { | 8833 if (type.get$names() == null) { |
| 8834 type.set$names([expr.get$name()]); | 8834 type.set$names([expr.get$name()]); |
| 8835 } | 8835 } |
| 8836 else { | 8836 else { |
| 8837 type.get$names().add$1(expr.get$name()); | 8837 type.get$names().add$1(expr.get$name()); |
| 8838 } | 8838 } |
| 8839 type.set$span(expr.get$span()); | 8839 type.set$span(expr.get$span()); |
| 8840 return type; | 8840 return type; |
| 8841 } | 8841 } |
| 8842 else { | 8842 else { |
| 8843 this._lang_error('expected type reference'); | 8843 this._error('expected type reference'); |
| 8844 return null; | 8844 return null; |
| 8845 } | 8845 } |
| 8846 } | 8846 } |
| 8847 Parser.prototype.infixExpression = function(precedence) { | 8847 Parser.prototype.infixExpression = function(precedence) { |
| 8848 return this.finishInfixExpression(this.unaryExpression(), precedence); | 8848 return this.finishInfixExpression(this.unaryExpression(), precedence); |
| 8849 } | 8849 } |
| 8850 Parser.prototype._finishDeclaredId = function(type) { | 8850 Parser.prototype._finishDeclaredId = function(type) { |
| 8851 var name = this.identifier(); | 8851 var name = this.identifier(); |
| 8852 return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._m
akeSpan(type.get$span().get$start()))); | 8852 return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._m
akeSpan(type.get$span().get$start()))); |
| 8853 } | 8853 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 8879 Parser.prototype.finishInfixExpression = function(x, precedence) { | 8879 Parser.prototype.finishInfixExpression = function(x, precedence) { |
| 8880 while (true) { | 8880 while (true) { |
| 8881 var kind = this._peek(); | 8881 var kind = this._peek(); |
| 8882 var prec = TokenKind.infixPrecedence(this._peek()); | 8882 var prec = TokenKind.infixPrecedence(this._peek()); |
| 8883 if (prec >= precedence) { | 8883 if (prec >= precedence) { |
| 8884 if (kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/) { | 8884 if (kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/) { |
| 8885 if (this._isBin(x, 52/*TokenKind.LT*/)) { | 8885 if (this._isBin(x, 52/*TokenKind.LT*/)) { |
| 8886 return this._fixAsType(x); | 8886 return this._fixAsType(x); |
| 8887 } | 8887 } |
| 8888 } | 8888 } |
| 8889 var op = this._lang_next(); | 8889 var op = this._next(); |
| 8890 if ($eq(op.get$kind(), 103/*TokenKind.IS*/)) { | 8890 if ($eq(op.get$kind(), 103/*TokenKind.IS*/)) { |
| 8891 var isTrue = !this._maybeEat(19/*TokenKind.NOT*/); | 8891 var isTrue = !this._maybeEat(19/*TokenKind.NOT*/); |
| 8892 var typeRef = this.type(0); | 8892 var typeRef = this.type(0); |
| 8893 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); | 8893 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); |
| 8894 continue; | 8894 continue; |
| 8895 } | 8895 } |
| 8896 var y = this.infixExpression($eq(prec, 2) ? prec : prec + 1); | 8896 var y = this.infixExpression($eq(prec, 2) ? prec : prec + 1); |
| 8897 if ($eq(op.get$kind(), 33/*TokenKind.CONDITIONAL*/)) { | 8897 if ($eq(op.get$kind(), 33/*TokenKind.CONDITIONAL*/)) { |
| 8898 this._eat(8/*TokenKind.COLON*/); | 8898 this._eat(8/*TokenKind.COLON*/); |
| 8899 var z = this.infixExpression(prec); | 8899 var z = this.infixExpression(prec); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 8922 | 8922 |
| 8923 default: | 8923 default: |
| 8924 | 8924 |
| 8925 return false; | 8925 return false; |
| 8926 | 8926 |
| 8927 } | 8927 } |
| 8928 } | 8928 } |
| 8929 Parser.prototype.unaryExpression = function() { | 8929 Parser.prototype.unaryExpression = function() { |
| 8930 var start = this._peekToken.start; | 8930 var start = this._peekToken.start; |
| 8931 if (this._isPrefixUnaryOperator(this._peek())) { | 8931 if (this._isPrefixUnaryOperator(this._peek())) { |
| 8932 var tok = this._lang_next(); | 8932 var tok = this._next(); |
| 8933 var expr = this.unaryExpression(); | 8933 var expr = this.unaryExpression(); |
| 8934 return new UnaryExpression(tok, expr, this._makeSpan(start)); | 8934 return new UnaryExpression(tok, expr, this._makeSpan(start)); |
| 8935 } | 8935 } |
| 8936 else if (this.get$enableAwait() && this._maybeEat(88/*TokenKind.AWAIT*/)) { | 8936 else if (this.get$enableAwait() && this._maybeEat(88/*TokenKind.AWAIT*/)) { |
| 8937 var expr = this.unaryExpression(); | 8937 var expr = this.unaryExpression(); |
| 8938 return new AwaitExpression(expr, this._makeSpan(start)); | 8938 return new AwaitExpression(expr, this._makeSpan(start)); |
| 8939 } | 8939 } |
| 8940 return this.finishPostfixExpression(this.primary()); | 8940 return this.finishPostfixExpression(this.primary()); |
| 8941 } | 8941 } |
| 8942 Parser.prototype.argument = function() { | 8942 Parser.prototype.argument = function() { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8987 case 14/*TokenKind.DOT*/: | 8987 case 14/*TokenKind.DOT*/: |
| 8988 | 8988 |
| 8989 this._eat(14/*TokenKind.DOT*/); | 8989 this._eat(14/*TokenKind.DOT*/); |
| 8990 var name = this.identifier(); | 8990 var name = this.identifier(); |
| 8991 var ret = new DotExpression(expr, name, this._makeSpan(expr.get$span().get
$start())); | 8991 var ret = new DotExpression(expr, name, this._makeSpan(expr.get$span().get
$start())); |
| 8992 return this.finishPostfixExpression(ret); | 8992 return this.finishPostfixExpression(ret); |
| 8993 | 8993 |
| 8994 case 16/*TokenKind.INCR*/: | 8994 case 16/*TokenKind.INCR*/: |
| 8995 case 17/*TokenKind.DECR*/: | 8995 case 17/*TokenKind.DECR*/: |
| 8996 | 8996 |
| 8997 var tok = this._lang_next(); | 8997 var tok = this._next(); |
| 8998 return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().get
$start())); | 8998 return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().get
$start())); |
| 8999 | 8999 |
| 9000 case 9/*TokenKind.ARROW*/: | 9000 case 9/*TokenKind.ARROW*/: |
| 9001 case 6/*TokenKind.LBRACE*/: | 9001 case 6/*TokenKind.LBRACE*/: |
| 9002 | 9002 |
| 9003 return expr; | 9003 return expr; |
| 9004 | 9004 |
| 9005 default: | 9005 default: |
| 9006 | 9006 |
| 9007 if (this._peekIdentifier()) { | 9007 if (this._peekIdentifier()) { |
| 9008 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp
e(expr), this.identifier(), this._makeSpan(expr.get$span().get$start()))); | 9008 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp
e(expr), this.identifier(), this._makeSpan(expr.get$span().get$start()))); |
| 9009 } | 9009 } |
| 9010 else { | 9010 else { |
| 9011 return expr; | 9011 return expr; |
| 9012 } | 9012 } |
| 9013 | 9013 |
| 9014 } | 9014 } |
| 9015 } | 9015 } |
| 9016 Parser.prototype.finishCallOrLambdaExpression = function(expr) { | 9016 Parser.prototype.finishCallOrLambdaExpression = function(expr) { |
| 9017 if (this._atClosureParameters()) { | 9017 if (this._atClosureParameters()) { |
| 9018 var formals = this.formalParameterList(); | 9018 var formals = this.formalParameterList(); |
| 9019 var body = this.functionBody(true); | 9019 var body = this.functionBody(true); |
| 9020 return this._makeFunction(expr, formals, body); | 9020 return this._makeFunction(expr, formals, body); |
| 9021 } | 9021 } |
| 9022 else { | 9022 else { |
| 9023 if ((expr instanceof DeclaredIdentifier)) { | 9023 if ((expr instanceof DeclaredIdentifier)) { |
| 9024 this._lang_error('illegal target for call, did you mean to declare a funct
ion?', expr.get$span()); | 9024 this._error('illegal target for call, did you mean to declare a function?'
, expr.get$span()); |
| 9025 } | 9025 } |
| 9026 var args = this.arguments(); | 9026 var args = this.arguments(); |
| 9027 return this.finishPostfixExpression(new CallExpression(expr, args, this._mak
eSpan(expr.get$span().get$start()))); | 9027 return this.finishPostfixExpression(new CallExpression(expr, args, this._mak
eSpan(expr.get$span().get$start()))); |
| 9028 } | 9028 } |
| 9029 } | 9029 } |
| 9030 Parser.prototype._isBin = function(expr, kind) { | 9030 Parser.prototype._isBin = function(expr, kind) { |
| 9031 return (expr instanceof BinaryExpression) && $eq(expr.get$op().get$kind(), kin
d); | 9031 return (expr instanceof BinaryExpression) && $eq(expr.get$op().get$kind(), kin
d); |
| 9032 } | 9032 } |
| 9033 Parser.prototype._boolTypeRef = function(span) { | 9033 Parser.prototype._boolTypeRef = function(span) { |
| 9034 return new TypeReference(span, $globals.world.nonNullBool); | 9034 return new TypeReference(span, $globals.world.nonNullBool); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9099 this._eat(111/*TokenKind.TRUE*/); | 9099 this._eat(111/*TokenKind.TRUE*/); |
| 9100 return new LiteralExpression(true, this._boolTypeRef(this._makeSpan(start)
), 'true', this._makeSpan(start)); | 9100 return new LiteralExpression(true, this._boolTypeRef(this._makeSpan(start)
), 'true', this._makeSpan(start)); |
| 9101 | 9101 |
| 9102 case 97/*TokenKind.FALSE*/: | 9102 case 97/*TokenKind.FALSE*/: |
| 9103 | 9103 |
| 9104 this._eat(97/*TokenKind.FALSE*/); | 9104 this._eat(97/*TokenKind.FALSE*/); |
| 9105 return new LiteralExpression(false, this._boolTypeRef(this._makeSpan(start
)), 'false', this._makeSpan(start)); | 9105 return new LiteralExpression(false, this._boolTypeRef(this._makeSpan(start
)), 'false', this._makeSpan(start)); |
| 9106 | 9106 |
| 9107 case 61/*TokenKind.HEX_INTEGER*/: | 9107 case 61/*TokenKind.HEX_INTEGER*/: |
| 9108 | 9108 |
| 9109 var t = this._lang_next(); | 9109 var t = this._next(); |
| 9110 return new LiteralExpression(Parser.parseHex(t.get$text().substring$1(2)),
this._intTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); | 9110 return new LiteralExpression(Parser.parseHex(t.get$text().substring$1(2)),
this._intTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); |
| 9111 | 9111 |
| 9112 case 60/*TokenKind.INTEGER*/: | 9112 case 60/*TokenKind.INTEGER*/: |
| 9113 | 9113 |
| 9114 var t = this._lang_next(); | 9114 var t = this._next(); |
| 9115 return new LiteralExpression(Math.parseInt(t.get$text()), this._intTypeRef
(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); | 9115 return new LiteralExpression(Math.parseInt(t.get$text()), this._intTypeRef
(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); |
| 9116 | 9116 |
| 9117 case 62/*TokenKind.DOUBLE*/: | 9117 case 62/*TokenKind.DOUBLE*/: |
| 9118 | 9118 |
| 9119 var t = this._lang_next(); | 9119 var t = this._next(); |
| 9120 return new LiteralExpression(Math.parseDouble(t.get$text()), this._doubleT
ypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); | 9120 return new LiteralExpression(Math.parseDouble(t.get$text()), this._doubleT
ypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); |
| 9121 | 9121 |
| 9122 case 58/*TokenKind.STRING*/: | 9122 case 58/*TokenKind.STRING*/: |
| 9123 | 9123 |
| 9124 return this.stringLiteralExpr(); | 9124 return this.stringLiteralExpr(); |
| 9125 | 9125 |
| 9126 case 66/*TokenKind.INCOMPLETE_STRING*/: | 9126 case 66/*TokenKind.INCOMPLETE_STRING*/: |
| 9127 | 9127 |
| 9128 return this.stringInterpolation(); | 9128 return this.stringInterpolation(); |
| 9129 | 9129 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 9144 } | 9144 } |
| 9145 return new VarExpression(this.identifier(), this._makeSpan(start)); | 9145 return new VarExpression(this.identifier(), this._makeSpan(start)); |
| 9146 | 9146 |
| 9147 } | 9147 } |
| 9148 } | 9148 } |
| 9149 Parser.prototype.stringInterpolation = function() { | 9149 Parser.prototype.stringInterpolation = function() { |
| 9150 var start = this._peekToken.start; | 9150 var start = this._peekToken.start; |
| 9151 var lits = []; | 9151 var lits = []; |
| 9152 var startQuote = null, endQuote = null; | 9152 var startQuote = null, endQuote = null; |
| 9153 while (this._peekKind(66/*TokenKind.INCOMPLETE_STRING*/)) { | 9153 while (this._peekKind(66/*TokenKind.INCOMPLETE_STRING*/)) { |
| 9154 var token = this._lang_next(); | 9154 var token = this._next(); |
| 9155 var text = token.get$text(); | 9155 var text = token.get$text(); |
| 9156 if (startQuote == null) { | 9156 if (startQuote == null) { |
| 9157 if (isMultilineString(text)) { | 9157 if (isMultilineString(text)) { |
| 9158 endQuote = text.substring$2(0, 3); | 9158 endQuote = text.substring$2(0, 3); |
| 9159 startQuote = endQuote + '\n'; | 9159 startQuote = endQuote + '\n'; |
| 9160 } | 9160 } |
| 9161 else { | 9161 else { |
| 9162 startQuote = endQuote = text.$index(0); | 9162 startQuote = endQuote = text.$index(0); |
| 9163 } | 9163 } |
| 9164 text = text.substring$2(0, text.length - 1) + endQuote; | 9164 text = text.substring$2(0, text.length - 1) + endQuote; |
| 9165 } | 9165 } |
| 9166 else { | 9166 else { |
| 9167 text = startQuote + text.substring$2(0, text.length - 1) + endQuote; | 9167 text = startQuote + text.substring$2(0, text.length - 1) + endQuote; |
| 9168 } | 9168 } |
| 9169 lits.add$1(this.makeStringLiteral(text, token.get$span())); | 9169 lits.add$1(this.makeStringLiteral(text, token.get$span())); |
| 9170 if (this._maybeEat(6/*TokenKind.LBRACE*/)) { | 9170 if (this._maybeEat(6/*TokenKind.LBRACE*/)) { |
| 9171 lits.add$1(this.expression()); | 9171 lits.add$1(this.expression()); |
| 9172 this._eat(7/*TokenKind.RBRACE*/); | 9172 this._eat(7/*TokenKind.RBRACE*/); |
| 9173 } | 9173 } |
| 9174 else if (this._maybeEat(109/*TokenKind.THIS*/)) { | 9174 else if (this._maybeEat(109/*TokenKind.THIS*/)) { |
| 9175 lits.add$1(new ThisExpression(this._previousToken.get$span())); | 9175 lits.add$1(new ThisExpression(this._previousToken.get$span())); |
| 9176 } | 9176 } |
| 9177 else { | 9177 else { |
| 9178 var id = this.identifier(); | 9178 var id = this.identifier(); |
| 9179 lits.add$1(new VarExpression(id, id.get$span())); | 9179 lits.add$1(new VarExpression(id, id.get$span())); |
| 9180 } | 9180 } |
| 9181 } | 9181 } |
| 9182 var tok = this._lang_next(); | 9182 var tok = this._next(); |
| 9183 if ($ne(tok.get$kind(), 58/*TokenKind.STRING*/)) { | 9183 if ($ne(tok.get$kind(), 58/*TokenKind.STRING*/)) { |
| 9184 this._errorExpected('interpolated string'); | 9184 this._errorExpected('interpolated string'); |
| 9185 } | 9185 } |
| 9186 var text = startQuote + tok.get$text(); | 9186 var text = startQuote + tok.get$text(); |
| 9187 lits.add$1(this.makeStringLiteral(text, tok.get$span())); | 9187 lits.add$1(this.makeStringLiteral(text, tok.get$span())); |
| 9188 var span = this._makeSpan(start); | 9188 var span = this._makeSpan(start); |
| 9189 return new LiteralExpression(lits, this._stringTypeRef(span), '\$\$\$', span); | 9189 return new LiteralExpression(lits, this._stringTypeRef(span), '\$\$\$', span); |
| 9190 } | 9190 } |
| 9191 Parser.prototype.makeStringLiteral = function(text, span) { | 9191 Parser.prototype.makeStringLiteral = function(text, span) { |
| 9192 return new LiteralExpression(text, this._stringTypeRef(span), text, span); | 9192 return new LiteralExpression(text, this._stringTypeRef(span), text, span); |
| 9193 } | 9193 } |
| 9194 Parser.prototype.stringLiteralExpr = function() { | 9194 Parser.prototype.stringLiteralExpr = function() { |
| 9195 var token = this._lang_next(); | 9195 var token = this._next(); |
| 9196 return this.makeStringLiteral(token.get$text(), token.get$span()); | 9196 return this.makeStringLiteral(token.get$text(), token.get$span()); |
| 9197 } | 9197 } |
| 9198 Parser.prototype.maybeStringLiteral = function() { | 9198 Parser.prototype.maybeStringLiteral = function() { |
| 9199 var kind = this._peek(); | 9199 var kind = this._peek(); |
| 9200 if ($eq(kind, 58/*TokenKind.STRING*/)) { | 9200 if ($eq(kind, 58/*TokenKind.STRING*/)) { |
| 9201 return parseStringLiteral(this._lang_next().get$text()); | 9201 return parseStringLiteral(this._next().get$text()); |
| 9202 } | 9202 } |
| 9203 else if ($eq(kind, 59/*TokenKind.STRING_PART*/)) { | 9203 else if ($eq(kind, 59/*TokenKind.STRING_PART*/)) { |
| 9204 this._lang_next(); | 9204 this._next(); |
| 9205 this._errorExpected('string literal, but found interpolated string start'); | 9205 this._errorExpected('string literal, but found interpolated string start'); |
| 9206 } | 9206 } |
| 9207 else if ($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/)) { | 9207 else if ($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/)) { |
| 9208 this._lang_next(); | 9208 this._next(); |
| 9209 this._errorExpected('string literal, but found incomplete string'); | 9209 this._errorExpected('string literal, but found incomplete string'); |
| 9210 } | 9210 } |
| 9211 return null; | 9211 return null; |
| 9212 } | 9212 } |
| 9213 Parser.prototype._parenOrLambda = function() { | 9213 Parser.prototype._parenOrLambda = function() { |
| 9214 var start = this._peekToken.start; | 9214 var start = this._peekToken.start; |
| 9215 if (this._atClosureParameters()) { | 9215 if (this._atClosureParameters()) { |
| 9216 var formals = this.formalParameterList(); | 9216 var formals = this.formalParameterList(); |
| 9217 var body = this.functionBody(true); | 9217 var body = this.functionBody(true); |
| 9218 var func = new FunctionDefinition(null, null, null, formals, null, null, nul
l, body, this._makeSpan(start)); | 9218 var func = new FunctionDefinition(null, null, null, formals, null, null, nul
l, body, this._makeSpan(start)); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 9236 Parser.prototype._eatLeftParen = function() { | 9236 Parser.prototype._eatLeftParen = function() { |
| 9237 this._eat(2/*TokenKind.LPAREN*/); | 9237 this._eat(2/*TokenKind.LPAREN*/); |
| 9238 this._afterParensIndex++; | 9238 this._afterParensIndex++; |
| 9239 } | 9239 } |
| 9240 Parser.prototype._peekAfterCloseParen = function() { | 9240 Parser.prototype._peekAfterCloseParen = function() { |
| 9241 if (this._afterParensIndex < this._afterParens.length) { | 9241 if (this._afterParensIndex < this._afterParens.length) { |
| 9242 return this._afterParens.$index(this._afterParensIndex); | 9242 return this._afterParens.$index(this._afterParensIndex); |
| 9243 } | 9243 } |
| 9244 this._afterParensIndex = 0; | 9244 this._afterParensIndex = 0; |
| 9245 this._afterParens.clear(); | 9245 this._afterParens.clear(); |
| 9246 var tokens = [this._lang_next()]; | 9246 var tokens = [this._next()]; |
| 9247 this._lookaheadAfterParens(tokens); | 9247 this._lookaheadAfterParens(tokens); |
| 9248 var after = this._peekToken; | 9248 var after = this._peekToken; |
| 9249 tokens.add$1(after); | 9249 tokens.add$1(after); |
| 9250 this.tokenizer = new DivertedTokenSource(tokens, this, this.tokenizer); | 9250 this.tokenizer = new DivertedTokenSource(tokens, this, this.tokenizer); |
| 9251 this._lang_next(); | 9251 this._next(); |
| 9252 return after; | 9252 return after; |
| 9253 } | 9253 } |
| 9254 Parser.prototype._lookaheadAfterParens = function(tokens) { | 9254 Parser.prototype._lookaheadAfterParens = function(tokens) { |
| 9255 var saved = this._afterParens.length; | 9255 var saved = this._afterParens.length; |
| 9256 this._afterParens.add(null); | 9256 this._afterParens.add(null); |
| 9257 while (true) { | 9257 while (true) { |
| 9258 var token = this._lang_next(); | 9258 var token = this._next(); |
| 9259 tokens.add(token); | 9259 tokens.add(token); |
| 9260 var kind = token.kind; | 9260 var kind = token.kind; |
| 9261 if (kind == 3/*TokenKind.RPAREN*/ || kind == 1/*TokenKind.END_OF_FILE*/) { | 9261 if (kind == 3/*TokenKind.RPAREN*/ || kind == 1/*TokenKind.END_OF_FILE*/) { |
| 9262 this._afterParens.$setindex(saved, this._peekToken); | 9262 this._afterParens.$setindex(saved, this._peekToken); |
| 9263 return; | 9263 return; |
| 9264 } | 9264 } |
| 9265 else if (kind == 2/*TokenKind.LPAREN*/) { | 9265 else if (kind == 2/*TokenKind.LPAREN*/) { |
| 9266 this._lookaheadAfterParens(tokens); | 9266 this._lookaheadAfterParens(tokens); |
| 9267 } | 9267 } |
| 9268 } | 9268 } |
| 9269 } | 9269 } |
| 9270 Parser.prototype._typeAsIdentifier = function(type) { | 9270 Parser.prototype._typeAsIdentifier = function(type) { |
| 9271 return type.get$name(); | 9271 return type.get$name(); |
| 9272 } | 9272 } |
| 9273 Parser.prototype._specialIdentifier = function(includeOperators) { | 9273 Parser.prototype._specialIdentifier = function(includeOperators) { |
| 9274 var start = this._peekToken.start; | 9274 var start = this._peekToken.start; |
| 9275 var name; | 9275 var name; |
| 9276 switch (this._peek()) { | 9276 switch (this._peek()) { |
| 9277 case 15/*TokenKind.ELLIPSIS*/: | 9277 case 15/*TokenKind.ELLIPSIS*/: |
| 9278 | 9278 |
| 9279 this._eat(15/*TokenKind.ELLIPSIS*/); | 9279 this._eat(15/*TokenKind.ELLIPSIS*/); |
| 9280 this._lang_error('rest no longer supported', this._previousToken.get$span(
)); | 9280 this._error('rest no longer supported', this._previousToken.get$span()); |
| 9281 name = this.identifier().get$name(); | 9281 name = this.identifier().get$name(); |
| 9282 break; | 9282 break; |
| 9283 | 9283 |
| 9284 case 109/*TokenKind.THIS*/: | 9284 case 109/*TokenKind.THIS*/: |
| 9285 | 9285 |
| 9286 this._eat(109/*TokenKind.THIS*/); | 9286 this._eat(109/*TokenKind.THIS*/); |
| 9287 this._eat(14/*TokenKind.DOT*/); | 9287 this._eat(14/*TokenKind.DOT*/); |
| 9288 name = ('this.' + this.identifier().get$name()); | 9288 name = ('this.' + this.identifier().get$name()); |
| 9289 break; | 9289 break; |
| 9290 | 9290 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 9312 } | 9312 } |
| 9313 break; | 9313 break; |
| 9314 | 9314 |
| 9315 case 83/*TokenKind.OPERATOR*/: | 9315 case 83/*TokenKind.OPERATOR*/: |
| 9316 | 9316 |
| 9317 if (!includeOperators) return null; | 9317 if (!includeOperators) return null; |
| 9318 this._eat(83/*TokenKind.OPERATOR*/); | 9318 this._eat(83/*TokenKind.OPERATOR*/); |
| 9319 var kind = this._peek(); | 9319 var kind = this._peek(); |
| 9320 if ($eq(kind, 82/*TokenKind.NEGATE*/)) { | 9320 if ($eq(kind, 82/*TokenKind.NEGATE*/)) { |
| 9321 name = ':negate'; | 9321 name = ':negate'; |
| 9322 this._lang_next(); | 9322 this._next(); |
| 9323 } | 9323 } |
| 9324 else { | 9324 else { |
| 9325 name = TokenKind.binaryMethodName(kind); | 9325 name = TokenKind.binaryMethodName(kind); |
| 9326 if (name == null) { | 9326 if (name == null) { |
| 9327 name = 'operator'; | 9327 name = 'operator'; |
| 9328 } | 9328 } |
| 9329 else { | 9329 else { |
| 9330 this._lang_next(); | 9330 this._next(); |
| 9331 } | 9331 } |
| 9332 } | 9332 } |
| 9333 break; | 9333 break; |
| 9334 | 9334 |
| 9335 default: | 9335 default: |
| 9336 | 9336 |
| 9337 return null; | 9337 return null; |
| 9338 | 9338 |
| 9339 } | 9339 } |
| 9340 return new Identifier(name, this._makeSpan(start)); | 9340 return new Identifier(name, this._makeSpan(start)); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9455 var modifiers = null; | 9455 var modifiers = null; |
| 9456 while (true) { | 9456 while (true) { |
| 9457 switch (this._peek()) { | 9457 switch (this._peek()) { |
| 9458 case 86/*TokenKind.STATIC*/: | 9458 case 86/*TokenKind.STATIC*/: |
| 9459 case 98/*TokenKind.FINAL*/: | 9459 case 98/*TokenKind.FINAL*/: |
| 9460 case 92/*TokenKind.CONST*/: | 9460 case 92/*TokenKind.CONST*/: |
| 9461 case 71/*TokenKind.ABSTRACT*/: | 9461 case 71/*TokenKind.ABSTRACT*/: |
| 9462 case 75/*TokenKind.FACTORY*/: | 9462 case 75/*TokenKind.FACTORY*/: |
| 9463 | 9463 |
| 9464 if (modifiers == null) modifiers = []; | 9464 if (modifiers == null) modifiers = []; |
| 9465 modifiers.add$1(this._lang_next()); | 9465 modifiers.add$1(this._next()); |
| 9466 break; | 9466 break; |
| 9467 | 9467 |
| 9468 default: | 9468 default: |
| 9469 | 9469 |
| 9470 return modifiers; | 9470 return modifiers; |
| 9471 | 9471 |
| 9472 } | 9472 } |
| 9473 } | 9473 } |
| 9474 return null; | 9474 return null; |
| 9475 } | 9475 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9556 } | 9556 } |
| 9557 Parser.prototype.nameTypeReference = function() { | 9557 Parser.prototype.nameTypeReference = function() { |
| 9558 var start = this._peekToken.start; | 9558 var start = this._peekToken.start; |
| 9559 var name; | 9559 var name; |
| 9560 var names = null; | 9560 var names = null; |
| 9561 var typeArgs = null; | 9561 var typeArgs = null; |
| 9562 var isFinal = false; | 9562 var isFinal = false; |
| 9563 switch (this._peek()) { | 9563 switch (this._peek()) { |
| 9564 case 114/*TokenKind.VOID*/: | 9564 case 114/*TokenKind.VOID*/: |
| 9565 | 9565 |
| 9566 return new TypeReference(this._lang_next().get$span(), $globals.world.void
Type); | 9566 return new TypeReference(this._next().get$span(), $globals.world.voidType)
; |
| 9567 | 9567 |
| 9568 case 113/*TokenKind.VAR*/: | 9568 case 113/*TokenKind.VAR*/: |
| 9569 | 9569 |
| 9570 return new TypeReference(this._lang_next().get$span(), $globals.world.varT
ype); | 9570 return new TypeReference(this._next().get$span(), $globals.world.varType); |
| 9571 | 9571 |
| 9572 case 98/*TokenKind.FINAL*/: | 9572 case 98/*TokenKind.FINAL*/: |
| 9573 | 9573 |
| 9574 this._eat(98/*TokenKind.FINAL*/); | 9574 this._eat(98/*TokenKind.FINAL*/); |
| 9575 isFinal = true; | 9575 isFinal = true; |
| 9576 name = this.identifier(); | 9576 name = this.identifier(); |
| 9577 break; | 9577 break; |
| 9578 | 9578 |
| 9579 default: | 9579 default: |
| 9580 | 9580 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 9603 Parser.prototype.formalParameter = function(inOptionalBlock) { | 9603 Parser.prototype.formalParameter = function(inOptionalBlock) { |
| 9604 var start = this._peekToken.start; | 9604 var start = this._peekToken.start; |
| 9605 var isThis = false; | 9605 var isThis = false; |
| 9606 var isRest = false; | 9606 var isRest = false; |
| 9607 var di = this.declaredIdentifier(false); | 9607 var di = this.declaredIdentifier(false); |
| 9608 var type = di.get$type(); | 9608 var type = di.get$type(); |
| 9609 var name = di.get$name(); | 9609 var name = di.get$name(); |
| 9610 var value = null; | 9610 var value = null; |
| 9611 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 9611 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
| 9612 if (!inOptionalBlock) { | 9612 if (!inOptionalBlock) { |
| 9613 this._lang_error('default values only allowed inside [optional] section'); | 9613 this._error('default values only allowed inside [optional] section'); |
| 9614 } | 9614 } |
| 9615 value = this.expression(); | 9615 value = this.expression(); |
| 9616 } | 9616 } |
| 9617 else if (this._peekKind(2/*TokenKind.LPAREN*/)) { | 9617 else if (this._peekKind(2/*TokenKind.LPAREN*/)) { |
| 9618 var formals = this.formalParameterList(); | 9618 var formals = this.formalParameterList(); |
| 9619 var func = new FunctionDefinition(null, type, name, formals, null, null, nul
l, null, this._makeSpan(start)); | 9619 var func = new FunctionDefinition(null, type, name, formals, null, null, nul
l, null, this._makeSpan(start)); |
| 9620 type = new FunctionTypeReference(false, func, func.get$span()); | 9620 type = new FunctionTypeReference(false, func, func.get$span()); |
| 9621 } | 9621 } |
| 9622 if (inOptionalBlock && value == null) { | 9622 if (inOptionalBlock && value == null) { |
| 9623 value = new NullExpression(this._makeSpan(start)); | 9623 value = new NullExpression(this._makeSpan(start)); |
| 9624 } | 9624 } |
| 9625 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start)
); | 9625 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start)
); |
| 9626 } | 9626 } |
| 9627 Parser.prototype.formalParameterList = function() { | 9627 Parser.prototype.formalParameterList = function() { |
| 9628 this._eatLeftParen(); | 9628 this._eatLeftParen(); |
| 9629 var formals = []; | 9629 var formals = []; |
| 9630 var inOptionalBlock = false; | 9630 var inOptionalBlock = false; |
| 9631 if (!this._maybeEat(3/*TokenKind.RPAREN*/)) { | 9631 if (!this._maybeEat(3/*TokenKind.RPAREN*/)) { |
| 9632 if (this._maybeEat(4/*TokenKind.LBRACK*/)) { | 9632 if (this._maybeEat(4/*TokenKind.LBRACK*/)) { |
| 9633 inOptionalBlock = true; | 9633 inOptionalBlock = true; |
| 9634 } | 9634 } |
| 9635 formals.add$1(this.formalParameter(inOptionalBlock)); | 9635 formals.add$1(this.formalParameter(inOptionalBlock)); |
| 9636 while (this._maybeEat(11/*TokenKind.COMMA*/)) { | 9636 while (this._maybeEat(11/*TokenKind.COMMA*/)) { |
| 9637 if (this._maybeEat(4/*TokenKind.LBRACK*/)) { | 9637 if (this._maybeEat(4/*TokenKind.LBRACK*/)) { |
| 9638 if (inOptionalBlock) { | 9638 if (inOptionalBlock) { |
| 9639 this._lang_error('already inside an optional block', this._previousTok
en.get$span()); | 9639 this._error('already inside an optional block', this._previousToken.ge
t$span()); |
| 9640 } | 9640 } |
| 9641 inOptionalBlock = true; | 9641 inOptionalBlock = true; |
| 9642 } | 9642 } |
| 9643 formals.add$1(this.formalParameter(inOptionalBlock)); | 9643 formals.add$1(this.formalParameter(inOptionalBlock)); |
| 9644 } | 9644 } |
| 9645 if (inOptionalBlock) { | 9645 if (inOptionalBlock) { |
| 9646 this._eat(5/*TokenKind.RBRACK*/); | 9646 this._eat(5/*TokenKind.RBRACK*/); |
| 9647 } | 9647 } |
| 9648 this._eat(3/*TokenKind.RPAREN*/); | 9648 this._eat(3/*TokenKind.RPAREN*/); |
| 9649 } | 9649 } |
| 9650 return formals; | 9650 return formals; |
| 9651 } | 9651 } |
| 9652 Parser.prototype.identifier = function() { | 9652 Parser.prototype.identifier = function() { |
| 9653 var tok = this._lang_next(); | 9653 var tok = this._next(); |
| 9654 if (!this._isIdentifier(tok.get$kind())) { | 9654 if (!this._isIdentifier(tok.get$kind())) { |
| 9655 this._lang_error(('expected identifier, but found ' + tok), tok.get$span()); | 9655 this._error(('expected identifier, but found ' + tok), tok.get$span()); |
| 9656 } | 9656 } |
| 9657 return new Identifier(tok.get$text(), this._makeSpan(tok.get$start())); | 9657 return new Identifier(tok.get$text(), this._makeSpan(tok.get$start())); |
| 9658 } | 9658 } |
| 9659 Parser.prototype._makeFunction = function(expr, formals, body) { | 9659 Parser.prototype._makeFunction = function(expr, formals, body) { |
| 9660 var name, type; | 9660 var name, type; |
| 9661 if ((expr instanceof VarExpression)) { | 9661 if ((expr instanceof VarExpression)) { |
| 9662 name = expr.get$name(); | 9662 name = expr.get$name(); |
| 9663 type = null; | 9663 type = null; |
| 9664 } | 9664 } |
| 9665 else if ((expr instanceof DeclaredIdentifier)) { | 9665 else if ((expr instanceof DeclaredIdentifier)) { |
| 9666 name = expr.get$name(); | 9666 name = expr.get$name(); |
| 9667 type = expr.get$type(); | 9667 type = expr.get$type(); |
| 9668 } | 9668 } |
| 9669 else { | 9669 else { |
| 9670 this._lang_error('bad function body', expr.get$span()); | 9670 this._error('bad function body', expr.get$span()); |
| 9671 } | 9671 } |
| 9672 var span = new SourceSpan(expr.get$span().get$file(), expr.get$span().get$star
t(), body.get$span().get$end()); | 9672 var span = new SourceSpan(expr.get$span().get$file(), expr.get$span().get$star
t(), body.get$span().get$end()); |
| 9673 var func = new FunctionDefinition(null, type, name, formals, null, null, null,
body, span); | 9673 var func = new FunctionDefinition(null, type, name, formals, null, null, null,
body, span); |
| 9674 return new LambdaExpression(func, func.get$span()); | 9674 return new LambdaExpression(func, func.get$span()); |
| 9675 } | 9675 } |
| 9676 Parser.prototype._makeDeclaredIdentifier = function(e) { | 9676 Parser.prototype._makeDeclaredIdentifier = function(e) { |
| 9677 if ((e instanceof VarExpression)) { | 9677 if ((e instanceof VarExpression)) { |
| 9678 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); | 9678 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); |
| 9679 } | 9679 } |
| 9680 else if ((e instanceof DeclaredIdentifier)) { | 9680 else if ((e instanceof DeclaredIdentifier)) { |
| 9681 return e; | 9681 return e; |
| 9682 } | 9682 } |
| 9683 else { | 9683 else { |
| 9684 this._lang_error('expected declared identifier'); | 9684 this._error('expected declared identifier'); |
| 9685 return new DeclaredIdentifier(null, null, e.get$span()); | 9685 return new DeclaredIdentifier(null, null, e.get$span()); |
| 9686 } | 9686 } |
| 9687 } | 9687 } |
| 9688 Parser.prototype._makeLabel = function(expr) { | 9688 Parser.prototype._makeLabel = function(expr) { |
| 9689 if ((expr instanceof VarExpression)) { | 9689 if ((expr instanceof VarExpression)) { |
| 9690 return expr.get$name(); | 9690 return expr.get$name(); |
| 9691 } | 9691 } |
| 9692 else { | 9692 else { |
| 9693 this._errorExpected('label'); | 9693 this._errorExpected('label'); |
| 9694 return null; | 9694 return null; |
| 9695 } | 9695 } |
| 9696 } | 9696 } |
| 9697 Parser.prototype.block$0 = Parser.prototype.block; | 9697 Parser.prototype.block$0 = Parser.prototype.block; |
| 9698 // ********** Code for IncompleteSourceException ************** | 9698 // ********** Code for IncompleteSourceException ************** |
| 9699 function IncompleteSourceException(token) { | 9699 function IncompleteSourceException(token) { |
| 9700 this.token = token; | 9700 this.token = token; |
| 9701 // Initializers done | 9701 // Initializers done |
| 9702 } | 9702 } |
| 9703 IncompleteSourceException.prototype.toString = function() { | 9703 IncompleteSourceException.prototype.toString = function() { |
| 9704 if (this.token.get$span() == null) return ('Unexpected ' + this.token); | 9704 if (this.token.get$span() == null) return ('Unexpected ' + this.token); |
| 9705 return this.token.get$span().toMessageString(('Unexpected ' + this.token)); | 9705 return this.token.get$span().toMessageString(('Unexpected ' + this.token)); |
| 9706 } | 9706 } |
| 9707 IncompleteSourceException.prototype.toString$0 = IncompleteSourceException.proto
type.toString; | 9707 IncompleteSourceException.prototype.toString$0 = IncompleteSourceException.proto
type.toString; |
| 9708 // ********** Code for DivertedTokenSource ************** | 9708 // ********** Code for DivertedTokenSource ************** |
| 9709 function DivertedTokenSource(tokens, parser, previousTokenizer) { | 9709 function DivertedTokenSource(tokens, parser, previousTokenizer) { |
| 9710 this._lang_pos = 0 | 9710 this._pos = 0 |
| 9711 this.tokens = tokens; | 9711 this.tokens = tokens; |
| 9712 this.parser = parser; | 9712 this.parser = parser; |
| 9713 this.previousTokenizer = previousTokenizer; | 9713 this.previousTokenizer = previousTokenizer; |
| 9714 // Initializers done | 9714 // Initializers done |
| 9715 } | 9715 } |
| 9716 DivertedTokenSource.prototype.next = function() { | 9716 DivertedTokenSource.prototype.next = function() { |
| 9717 var token = this.tokens.$index(this._lang_pos); | 9717 var token = this.tokens.$index(this._pos); |
| 9718 ++this._lang_pos; | 9718 ++this._pos; |
| 9719 if (this._lang_pos == this.tokens.length) { | 9719 if (this._pos == this.tokens.length) { |
| 9720 this.parser.tokenizer = this.previousTokenizer; | 9720 this.parser.tokenizer = this.previousTokenizer; |
| 9721 } | 9721 } |
| 9722 return token; | 9722 return token; |
| 9723 } | 9723 } |
| 9724 DivertedTokenSource.prototype.next$0 = DivertedTokenSource.prototype.next; | 9724 DivertedTokenSource.prototype.next$0 = DivertedTokenSource.prototype.next; |
| 9725 // ********** Code for Node ************** | 9725 // ********** Code for Node ************** |
| 9726 function Node(span) { | 9726 function Node(span) { |
| 9727 this.span = span; | 9727 this.span = span; |
| 9728 // Initializers done | 9728 // Initializers done |
| 9729 } | 9729 } |
| (...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12349 } | 12349 } |
| 12350 member = this.home.get$library().lookup(name, this.span); | 12350 member = this.home.get$library().lookup(name, this.span); |
| 12351 if (member != null) { | 12351 if (member != null) { |
| 12352 return member; | 12352 return member; |
| 12353 } | 12353 } |
| 12354 this._ensureCode(); | 12354 this._ensureCode(); |
| 12355 return null; | 12355 return null; |
| 12356 } | 12356 } |
| 12357 // ********** Code for CompilerException ************** | 12357 // ********** Code for CompilerException ************** |
| 12358 function CompilerException(_message, _location) { | 12358 function CompilerException(_message, _location) { |
| 12359 this._lang_message = _message; | 12359 this._message = _message; |
| 12360 this._location = _location; | 12360 this._location = _location; |
| 12361 // Initializers done | 12361 // Initializers done |
| 12362 } | 12362 } |
| 12363 CompilerException.prototype.toString = function() { | 12363 CompilerException.prototype.toString = function() { |
| 12364 if (this._location != null) { | 12364 if (this._location != null) { |
| 12365 return ('CompilerException: ' + this._location.toMessageString(this._lang_me
ssage)); | 12365 return ('CompilerException: ' + this._location.toMessageString(this._message
)); |
| 12366 } | 12366 } |
| 12367 else { | 12367 else { |
| 12368 return ('CompilerException: ' + this._lang_message); | 12368 return ('CompilerException: ' + this._message); |
| 12369 } | 12369 } |
| 12370 } | 12370 } |
| 12371 CompilerException.prototype.toString$0 = CompilerException.prototype.toString; | 12371 CompilerException.prototype.toString$0 = CompilerException.prototype.toString; |
| 12372 // ********** Code for World ************** | 12372 // ********** Code for World ************** |
| 12373 function World(files) { | 12373 function World(files) { |
| 12374 this.errors = 0 | 12374 this.errors = 0 |
| 12375 this.warnings = 0 | 12375 this.warnings = 0 |
| 12376 this.dartBytesRead = 0 | 12376 this.dartBytesRead = 0 |
| 12377 this.jsBytesWritten = 0 | 12377 this.jsBytesWritten = 0 |
| 12378 this.seenFatal = false | 12378 this.seenFatal = false |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13223 $globals._NO_COLOR = '\u001b[0m'; | 13223 $globals._NO_COLOR = '\u001b[0m'; |
| 13224 $globals._RED_COLOR = '\u001b[31m'; | 13224 $globals._RED_COLOR = '\u001b[31m'; |
| 13225 } | 13225 } |
| 13226 var const$0 = new EnvMap()/*const EnvMap()*/; | 13226 var const$0 = new EnvMap()/*const EnvMap()*/; |
| 13227 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; | 13227 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; |
| 13228 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; | 13228 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; |
| 13229 var const$8 = new NoMoreElementsException()/*const NoMoreElementsException()*/; | 13229 var const$8 = new NoMoreElementsException()/*const NoMoreElementsException()*/; |
| 13230 var $globals = {}; | 13230 var $globals = {}; |
| 13231 $static_init(); | 13231 $static_init(); |
| 13232 main(); | 13232 main(); |
| OLD | NEW |