OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library engine.parser; | 8 library engine.parser; |
9 | 9 |
10 import "dart:math" as math; | 10 import "dart:math" as math; |
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2667 modifiers.externalKeyword, | 2667 modifiers.externalKeyword, |
2668 modifiers.staticKeyword, | 2668 modifiers.staticKeyword, |
2669 null); | 2669 null); |
2670 } else if (_matchesKeyword(Keyword.OPERATOR) && _isOperator(_peek())) { | 2670 } else if (_matchesKeyword(Keyword.OPERATOR) && _isOperator(_peek())) { |
2671 _validateModifiersForOperator(modifiers); | 2671 _validateModifiersForOperator(modifiers); |
2672 return _parseOperator( | 2672 return _parseOperator( |
2673 commentAndMetadata, | 2673 commentAndMetadata, |
2674 modifiers.externalKeyword, | 2674 modifiers.externalKeyword, |
2675 null); | 2675 null); |
2676 } else if (!_matchesIdentifier()) { | 2676 } else if (!_matchesIdentifier()) { |
2677 if (_isOperator(_currentToken)) { | 2677 // |
| 2678 // Recover from an error. |
| 2679 // |
| 2680 if (_matchesKeyword(Keyword.CLASS)) { |
| 2681 _reportErrorForCurrentToken(ParserErrorCode.CLASS_IN_CLASS); |
| 2682 // TODO(brianwilkerson) We don't currently have any way to capture the |
| 2683 // class that was parsed. |
| 2684 _parseClassDeclaration(commentAndMetadata, null); |
| 2685 return null; |
| 2686 } else if (_matchesKeyword(Keyword.ABSTRACT) && _tokenMatchesKeyword(_peek
(), Keyword.CLASS)) { |
| 2687 _reportErrorForToken(ParserErrorCode.CLASS_IN_CLASS, _peek()); |
| 2688 // TODO(brianwilkerson) We don't currently have any way to capture the |
| 2689 // class that was parsed. |
| 2690 _parseClassDeclaration(commentAndMetadata, andAdvance); |
| 2691 return null; |
| 2692 } else if (_isOperator(_currentToken)) { |
2678 // | 2693 // |
2679 // We appear to have found an operator declaration without the | 2694 // We appear to have found an operator declaration without the |
2680 // 'operator' keyword. | 2695 // 'operator' keyword. |
2681 // | 2696 // |
2682 _validateModifiersForOperator(modifiers); | 2697 _validateModifiersForOperator(modifiers); |
2683 return _parseOperator( | 2698 return _parseOperator( |
2684 commentAndMetadata, | 2699 commentAndMetadata, |
2685 modifiers.externalKeyword, | 2700 modifiers.externalKeyword, |
2686 null); | 2701 null); |
2687 } | 2702 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2774 modifiers.finalKeyword == null && | 2789 modifiers.finalKeyword == null && |
2775 modifiers.varKeyword == null) { | 2790 modifiers.varKeyword == null) { |
2776 _reportErrorForCurrentToken( | 2791 _reportErrorForCurrentToken( |
2777 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE); | 2792 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE); |
2778 } | 2793 } |
2779 return _parseInitializedIdentifierList( | 2794 return _parseInitializedIdentifierList( |
2780 commentAndMetadata, | 2795 commentAndMetadata, |
2781 modifiers.staticKeyword, | 2796 modifiers.staticKeyword, |
2782 _validateModifiersForField(modifiers), | 2797 _validateModifiersForField(modifiers), |
2783 null); | 2798 null); |
| 2799 } else if (_matchesKeyword(Keyword.TYPEDEF)) { |
| 2800 _reportErrorForCurrentToken(ParserErrorCode.TYPEDEF_IN_CLASS); |
| 2801 // TODO(brianwilkerson) We don't currently have any way to capture the |
| 2802 // function type alias that was parsed. |
| 2803 _parseFunctionTypeAlias(commentAndMetadata, andAdvance); |
| 2804 return null; |
2784 } | 2805 } |
2785 TypeName type = parseTypeName(); | 2806 TypeName type = parseTypeName(); |
2786 if (_matchesKeyword(Keyword.GET) && _tokenMatchesIdentifier(_peek())) { | 2807 if (_matchesKeyword(Keyword.GET) && _tokenMatchesIdentifier(_peek())) { |
2787 _validateModifiersForGetterOrSetterOrMethod(modifiers); | 2808 _validateModifiersForGetterOrSetterOrMethod(modifiers); |
2788 return _parseGetter( | 2809 return _parseGetter( |
2789 commentAndMetadata, | 2810 commentAndMetadata, |
2790 modifiers.externalKeyword, | 2811 modifiers.externalKeyword, |
2791 modifiers.staticKeyword, | 2812 modifiers.staticKeyword, |
2792 type); | 2813 type); |
2793 } else if (_matchesKeyword(Keyword.SET) && | 2814 } else if (_matchesKeyword(Keyword.SET) && |
(...skipping 7284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10078 | 10099 |
10079 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_RETHROW = | 10100 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_RETHROW = |
10080 const ParserErrorCode( | 10101 const ParserErrorCode( |
10081 'ASSERT_DOES_NOT_TAKE_RETHROW', | 10102 'ASSERT_DOES_NOT_TAKE_RETHROW', |
10082 "Assert cannot be called on rethrows"); | 10103 "Assert cannot be called on rethrows"); |
10083 | 10104 |
10084 static const ParserErrorCode BREAK_OUTSIDE_OF_LOOP = const ParserErrorCode( | 10105 static const ParserErrorCode BREAK_OUTSIDE_OF_LOOP = const ParserErrorCode( |
10085 'BREAK_OUTSIDE_OF_LOOP', | 10106 'BREAK_OUTSIDE_OF_LOOP', |
10086 "A break statement cannot be used outside of a loop or switch statement"); | 10107 "A break statement cannot be used outside of a loop or switch statement"); |
10087 | 10108 |
| 10109 static const ParserErrorCode CLASS_IN_CLASS = const ParserErrorCode( |
| 10110 'CLASS_IN_CLASS', |
| 10111 "Classes cannot be declared inside other classes"); |
| 10112 |
10088 static const ParserErrorCode CONST_AND_FINAL = const ParserErrorCode( | 10113 static const ParserErrorCode CONST_AND_FINAL = const ParserErrorCode( |
10089 'CONST_AND_FINAL', | 10114 'CONST_AND_FINAL', |
10090 "Members cannot be declared to be both 'const' and 'final'"); | 10115 "Members cannot be declared to be both 'const' and 'final'"); |
10091 | 10116 |
10092 static const ParserErrorCode CONST_AND_VAR = const ParserErrorCode( | 10117 static const ParserErrorCode CONST_AND_VAR = const ParserErrorCode( |
10093 'CONST_AND_VAR', | 10118 'CONST_AND_VAR', |
10094 "Members cannot be declared to be both 'const' and 'var'"); | 10119 "Members cannot be declared to be both 'const' and 'var'"); |
10095 | 10120 |
10096 static const ParserErrorCode CONST_CLASS = const ParserErrorCode( | 10121 static const ParserErrorCode CONST_CLASS = const ParserErrorCode( |
10097 'CONST_CLASS', | 10122 'CONST_CLASS', |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10638 | 10663 |
10639 static const ParserErrorCode SWITCH_HAS_MULTIPLE_DEFAULT_CASES = | 10664 static const ParserErrorCode SWITCH_HAS_MULTIPLE_DEFAULT_CASES = |
10640 const ParserErrorCode( | 10665 const ParserErrorCode( |
10641 'SWITCH_HAS_MULTIPLE_DEFAULT_CASES', | 10666 'SWITCH_HAS_MULTIPLE_DEFAULT_CASES', |
10642 "The 'default' case can only be declared once"); | 10667 "The 'default' case can only be declared once"); |
10643 | 10668 |
10644 static const ParserErrorCode TOP_LEVEL_OPERATOR = const ParserErrorCode( | 10669 static const ParserErrorCode TOP_LEVEL_OPERATOR = const ParserErrorCode( |
10645 'TOP_LEVEL_OPERATOR', | 10670 'TOP_LEVEL_OPERATOR', |
10646 "Operators must be declared within a class"); | 10671 "Operators must be declared within a class"); |
10647 | 10672 |
| 10673 static const ParserErrorCode TYPEDEF_IN_CLASS = const ParserErrorCode( |
| 10674 'TYPEDEF_IN_CLASS', |
| 10675 "Function type aliases cannot be declared inside classes"); |
| 10676 |
10648 static const ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = | 10677 static const ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = |
10649 const ParserErrorCode( | 10678 const ParserErrorCode( |
10650 'UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', | 10679 'UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', |
10651 "There is no '{0}' to open a parameter group"); | 10680 "There is no '{0}' to open a parameter group"); |
10652 | 10681 |
10653 static const ParserErrorCode UNEXPECTED_TOKEN = | 10682 static const ParserErrorCode UNEXPECTED_TOKEN = |
10654 const ParserErrorCode('UNEXPECTED_TOKEN', "Unexpected token '{0}'"); | 10683 const ParserErrorCode('UNEXPECTED_TOKEN', "Unexpected token '{0}'"); |
10655 | 10684 |
10656 static const ParserErrorCode WITH_BEFORE_EXTENDS = const ParserErrorCode( | 10685 static const ParserErrorCode WITH_BEFORE_EXTENDS = const ParserErrorCode( |
10657 'WITH_BEFORE_EXTENDS', | 10686 'WITH_BEFORE_EXTENDS', |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12127 * Copy resolution data from one node to another. | 12156 * Copy resolution data from one node to another. |
12128 * | 12157 * |
12129 * @param fromNode the node from which resolution information will be copied | 12158 * @param fromNode the node from which resolution information will be copied |
12130 * @param toNode the node to which resolution information will be copied | 12159 * @param toNode the node to which resolution information will be copied |
12131 */ | 12160 */ |
12132 static void copyResolutionData(AstNode fromNode, AstNode toNode) { | 12161 static void copyResolutionData(AstNode fromNode, AstNode toNode) { |
12133 ResolutionCopier copier = new ResolutionCopier(); | 12162 ResolutionCopier copier = new ResolutionCopier(); |
12134 copier._isEqualNodes(fromNode, toNode); | 12163 copier._isEqualNodes(fromNode, toNode); |
12135 } | 12164 } |
12136 } | 12165 } |
OLD | NEW |