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 library engine.parser; | 5 library engine.parser; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import "dart:math" as math; | 8 import "dart:math" as math; |
9 | 9 |
10 import 'ast.dart'; | 10 import 'ast.dart'; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 'parseCombinators_0': | 189 'parseCombinators_0': |
190 new MethodTrampoline(0, (Parser target) => target._parseCombinators()), | 190 new MethodTrampoline(0, (Parser target) => target._parseCombinators()), |
191 'parseCommentAndMetadata_0': new MethodTrampoline( | 191 'parseCommentAndMetadata_0': new MethodTrampoline( |
192 0, (Parser target) => target._parseCommentAndMetadata()), | 192 0, (Parser target) => target._parseCommentAndMetadata()), |
193 'parseCommentReference_2': new MethodTrampoline(2, | 193 'parseCommentReference_2': new MethodTrampoline(2, |
194 (Parser target, arg0, arg1) => target._parseCommentReference(arg0, arg1)), | 194 (Parser target, arg0, arg1) => target._parseCommentReference(arg0, arg1)), |
195 'parseCommentReferences_1': new MethodTrampoline( | 195 'parseCommentReferences_1': new MethodTrampoline( |
196 1, (Parser target, arg0) => target._parseCommentReferences(arg0)), | 196 1, (Parser target, arg0) => target._parseCommentReferences(arg0)), |
197 'parseCompilationUnitMember_1': new MethodTrampoline( | 197 'parseCompilationUnitMember_1': new MethodTrampoline( |
198 1, (Parser target, arg0) => target._parseCompilationUnitMember(arg0)), | 198 1, (Parser target, arg0) => target._parseCompilationUnitMember(arg0)), |
199 'parseConfiguration_0': | |
200 new MethodTrampoline(0, (Parser target) => target._parseConfiguration()), | |
199 'parseConstExpression_0': new MethodTrampoline( | 201 'parseConstExpression_0': new MethodTrampoline( |
200 0, (Parser target) => target._parseConstExpression()), | 202 0, (Parser target) => target._parseConstExpression()), |
201 'parseConstructor_8': new MethodTrampoline( | 203 'parseConstructor_8': new MethodTrampoline( |
202 8, | 204 8, |
203 (Parser target, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) => target | 205 (Parser target, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) => target |
204 ._parseConstructor(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)), | 206 ._parseConstructor(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)), |
205 'parseConstructorFieldInitializer_0': new MethodTrampoline( | 207 'parseConstructorFieldInitializer_0': new MethodTrampoline( |
206 0, (Parser target) => target._parseConstructorFieldInitializer()), | 208 0, (Parser target) => target._parseConstructorFieldInitializer()), |
207 'parseContinueStatement_0': new MethodTrampoline( | 209 'parseContinueStatement_0': new MethodTrampoline( |
208 0, (Parser target) => target._parseContinueStatement()), | 210 0, (Parser target) => target._parseContinueStatement()), |
209 'parseDirective_1': new MethodTrampoline( | 211 'parseDirective_1': new MethodTrampoline( |
210 1, (Parser target, arg0) => target._parseDirective(arg0)), | 212 1, (Parser target, arg0) => target._parseDirective(arg0)), |
211 'parseDirectives_0': | 213 'parseDirectives_0': |
212 new MethodTrampoline(0, (Parser target) => target._parseDirectives()), | 214 new MethodTrampoline(0, (Parser target) => target._parseDirectives()), |
213 'parseDocumentationComment_0': new MethodTrampoline( | 215 'parseDocumentationComment_0': new MethodTrampoline( |
214 0, (Parser target) => target._parseDocumentationComment()), | 216 0, (Parser target) => target._parseDocumentationComment()), |
215 'parseDoStatement_0': | 217 'parseDoStatement_0': |
216 new MethodTrampoline(0, (Parser target) => target._parseDoStatement()), | 218 new MethodTrampoline(0, (Parser target) => target._parseDoStatement()), |
219 'parseDottedName_0': | |
220 new MethodTrampoline(0, (Parser target) => target._parseDottedName()), | |
217 'parseEmptyStatement_0': | 221 'parseEmptyStatement_0': |
218 new MethodTrampoline(0, (Parser target) => target._parseEmptyStatement()), | 222 new MethodTrampoline(0, (Parser target) => target._parseEmptyStatement()), |
219 'parseEnumConstantDeclaration_0': new MethodTrampoline( | 223 'parseEnumConstantDeclaration_0': new MethodTrampoline( |
220 0, (Parser target) => target._parseEnumConstantDeclaration()), | 224 0, (Parser target) => target._parseEnumConstantDeclaration()), |
221 'parseEnumDeclaration_1': new MethodTrampoline( | 225 'parseEnumDeclaration_1': new MethodTrampoline( |
222 1, (Parser target, arg0) => target._parseEnumDeclaration(arg0)), | 226 1, (Parser target, arg0) => target._parseEnumDeclaration(arg0)), |
223 'parseEqualityExpression_0': new MethodTrampoline( | 227 'parseEqualityExpression_0': new MethodTrampoline( |
224 0, (Parser target) => target._parseEqualityExpression()), | 228 0, (Parser target) => target._parseEqualityExpression()), |
225 'parseExportDirective_1': new MethodTrampoline( | 229 'parseExportDirective_1': new MethodTrampoline( |
226 1, (Parser target, arg0) => target._parseExportDirective(arg0)), | 230 1, (Parser target, arg0) => target._parseExportDirective(arg0)), |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
738 return _parser.parseIfNullExpression(); | 742 return _parser.parseIfNullExpression(); |
739 } else if (identical(_oldNode, node.thenExpression)) { | 743 } else if (identical(_oldNode, node.thenExpression)) { |
740 return _parser.parseExpressionWithoutCascade(); | 744 return _parser.parseExpressionWithoutCascade(); |
741 } else if (identical(_oldNode, node.elseExpression)) { | 745 } else if (identical(_oldNode, node.elseExpression)) { |
742 return _parser.parseExpressionWithoutCascade(); | 746 return _parser.parseExpressionWithoutCascade(); |
743 } | 747 } |
744 return _notAChild(node); | 748 return _notAChild(node); |
745 } | 749 } |
746 | 750 |
747 @override | 751 @override |
752 AstNode visitConfiguration(Configuration node) { | |
753 if (identical(_oldNode, node.name)) { | |
754 throw new InsufficientContextException(); | |
755 } else if (identical(_oldNode, node.value)) { | |
756 return _parser.parseStringLiteral(); | |
757 } else if (identical(_oldNode, node.libraryUri)) { | |
758 return _parser.parseStringLiteral(); | |
759 } | |
760 return _notAChild(node); | |
761 } | |
762 | |
763 @override | |
748 AstNode visitConstructorDeclaration(ConstructorDeclaration node) { | 764 AstNode visitConstructorDeclaration(ConstructorDeclaration node) { |
749 if (identical(_oldNode, node.documentationComment)) { | 765 if (identical(_oldNode, node.documentationComment)) { |
750 throw new InsufficientContextException(); | 766 throw new InsufficientContextException(); |
751 } else if (node.metadata.contains(_oldNode)) { | 767 } else if (node.metadata.contains(_oldNode)) { |
752 return _parser.parseAnnotation(); | 768 return _parser.parseAnnotation(); |
753 } else if (identical(_oldNode, node.returnType)) { | 769 } else if (identical(_oldNode, node.returnType)) { |
754 throw new InsufficientContextException(); | 770 throw new InsufficientContextException(); |
755 } else if (identical(_oldNode, node.name)) { | 771 } else if (identical(_oldNode, node.name)) { |
756 throw new InsufficientContextException(); | 772 throw new InsufficientContextException(); |
757 } else if (identical(_oldNode, node.parameters)) { | 773 } else if (identical(_oldNode, node.parameters)) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
822 AstNode visitDoStatement(DoStatement node) { | 838 AstNode visitDoStatement(DoStatement node) { |
823 if (identical(_oldNode, node.body)) { | 839 if (identical(_oldNode, node.body)) { |
824 return _parser.parseStatement2(); | 840 return _parser.parseStatement2(); |
825 } else if (identical(_oldNode, node.condition)) { | 841 } else if (identical(_oldNode, node.condition)) { |
826 return _parser.parseExpression2(); | 842 return _parser.parseExpression2(); |
827 } | 843 } |
828 return _notAChild(node); | 844 return _notAChild(node); |
829 } | 845 } |
830 | 846 |
831 @override | 847 @override |
848 AstNode visitDottedName(DottedName node) { | |
849 if (node.components.contains(_oldNode)) { | |
850 throw new InsufficientContextException(); | |
851 } | |
852 return _notAChild(node); | |
853 } | |
854 | |
855 @override | |
832 AstNode visitDoubleLiteral(DoubleLiteral node) => _notAChild(node); | 856 AstNode visitDoubleLiteral(DoubleLiteral node) => _notAChild(node); |
833 | 857 |
834 @override | 858 @override |
835 AstNode visitEmptyFunctionBody(EmptyFunctionBody node) => _notAChild(node); | 859 AstNode visitEmptyFunctionBody(EmptyFunctionBody node) => _notAChild(node); |
836 | 860 |
837 @override | 861 @override |
838 AstNode visitEmptyStatement(EmptyStatement node) => _notAChild(node); | 862 AstNode visitEmptyStatement(EmptyStatement node) => _notAChild(node); |
839 | 863 |
840 @override | 864 @override |
841 AstNode visitEnumConstantDeclaration(EnumConstantDeclaration node) { | 865 AstNode visitEnumConstantDeclaration(EnumConstantDeclaration node) { |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2111 */ | 2135 */ |
2112 bool _inSwitch = false; | 2136 bool _inSwitch = false; |
2113 | 2137 |
2114 /** | 2138 /** |
2115 * A flag indicating whether the parser is currently in a constructor field | 2139 * A flag indicating whether the parser is currently in a constructor field |
2116 * initializer, with no intervening parens, braces, or brackets. | 2140 * initializer, with no intervening parens, braces, or brackets. |
2117 */ | 2141 */ |
2118 bool _inInitializer = false; | 2142 bool _inInitializer = false; |
2119 | 2143 |
2120 /** | 2144 /** |
2145 * A flag indicating whether the parser is to parse conditional directives | |
2146 * syntax. | |
2147 */ | |
2148 bool parseConditionalDirectives = false; | |
2149 | |
2150 /** | |
2121 * A flag indicating whether the parser is to parse generic method syntax. | 2151 * A flag indicating whether the parser is to parse generic method syntax. |
2122 */ | 2152 */ |
2123 bool parseGenericMethods = false; | 2153 bool parseGenericMethods = false; |
2124 | 2154 |
2125 /** | 2155 /** |
2126 * Initialize a newly created parser to parse the content of the given | 2156 * Initialize a newly created parser to parse the content of the given |
2127 * [_source] and to report any errors that are found to the given | 2157 * [_source] and to report any errors that are found to the given |
2128 * [_errorListener]. | 2158 * [_errorListener]. |
2129 */ | 2159 */ |
2130 Parser(this._source, this._errorListener); | 2160 Parser(this._source, this._errorListener); |
(...skipping 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5214 } | 5244 } |
5215 return new TopLevelVariableDeclaration( | 5245 return new TopLevelVariableDeclaration( |
5216 commentAndMetadata.comment, | 5246 commentAndMetadata.comment, |
5217 commentAndMetadata.metadata, | 5247 commentAndMetadata.metadata, |
5218 _parseVariableDeclarationListAfterType( | 5248 _parseVariableDeclarationListAfterType( |
5219 null, _validateModifiersForTopLevelVariable(modifiers), returnType), | 5249 null, _validateModifiersForTopLevelVariable(modifiers), returnType), |
5220 _expect(TokenType.SEMICOLON)); | 5250 _expect(TokenType.SEMICOLON)); |
5221 } | 5251 } |
5222 | 5252 |
5223 /** | 5253 /** |
5254 * Parse a configuration in either an import or export directive. | |
5255 * | |
5256 * configuration ::= | |
5257 * 'if' '(' test ')' uri | |
5258 * | |
5259 * test ::= | |
5260 * dottedName ('==' stringLiteral)? | |
5261 * | |
5262 * dottedName ::= | |
5263 * identifier ('.' identifier)* | |
5264 */ | |
5265 Configuration _parseConfiguration() { | |
5266 Token ifKeyword = _expectKeyword(Keyword.IF); | |
5267 Token leftParenthesis = _expect(TokenType.OPEN_PAREN); | |
5268 DottedName name = _parseDottedName(); | |
5269 Token equalToken = null; | |
5270 StringLiteral value = null; | |
5271 if (_matches(TokenType.EQ_EQ)) { | |
5272 equalToken = getAndAdvance(); | |
5273 value = parseStringLiteral(); | |
Bob Nystrom
2015/10/22 00:24:47
This will allow interpolation, right? The proposal
Brian Wilkerson
2015/10/22 02:33:42
Good catch. Yes, it will allow string interpolatio
| |
5274 } | |
5275 Token rightParenthesis = _expect(TokenType.CLOSE_PAREN); | |
5276 StringLiteral libraryUri = _parseUri(); | |
5277 return new Configuration(ifKeyword, leftParenthesis, name, equalToken, | |
5278 value, rightParenthesis, libraryUri); | |
5279 } | |
5280 | |
5281 /** | |
5282 * Parse a list of configurations. If conditional directives are not | |
5283 * supported, return an empty list without attempting to parse anything. | |
5284 */ | |
5285 List<Configuration> _parseConfigurations() { | |
5286 List<Configuration> configurations = <Configuration>[]; | |
5287 if (parseConditionalDirectives) { | |
5288 while (_matchesKeyword(Keyword.IF)) { | |
5289 Configuration configuration = _parseConfiguration(); | |
5290 if (configuration != null) { | |
Paul Berry
2015/10/21 17:10:47
This is unnecessarily defensive. _parseConfigurat
Brian Wilkerson
2015/10/21 20:05:23
Done
| |
5291 configurations.add(configuration); | |
5292 } | |
5293 } | |
5294 } | |
5295 return configurations; | |
5296 } | |
5297 | |
5298 /** | |
5224 * Parse a const expression. Return the const expression that was parsed. | 5299 * Parse a const expression. Return the const expression that was parsed. |
5225 * | 5300 * |
5226 * constExpression ::= | 5301 * constExpression ::= |
5227 * instanceCreationExpression | 5302 * instanceCreationExpression |
5228 * | listLiteral | 5303 * | listLiteral |
5229 * | mapLiteral | 5304 * | mapLiteral |
5230 */ | 5305 */ |
5231 Expression _parseConstExpression() { | 5306 Expression _parseConstExpression() { |
5232 Token keyword = _expectKeyword(Keyword.CONST); | 5307 Token keyword = _expectKeyword(Keyword.CONST); |
5233 if (_matches(TokenType.OPEN_SQUARE_BRACKET) || _matches(TokenType.INDEX)) { | 5308 if (_matches(TokenType.OPEN_SQUARE_BRACKET) || _matches(TokenType.INDEX)) { |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5529 Token rightParenthesis = _expect(TokenType.CLOSE_PAREN); | 5604 Token rightParenthesis = _expect(TokenType.CLOSE_PAREN); |
5530 Token semicolon = _expect(TokenType.SEMICOLON); | 5605 Token semicolon = _expect(TokenType.SEMICOLON); |
5531 return new DoStatement(doKeyword, body, whileKeyword, leftParenthesis, | 5606 return new DoStatement(doKeyword, body, whileKeyword, leftParenthesis, |
5532 condition, rightParenthesis, semicolon); | 5607 condition, rightParenthesis, semicolon); |
5533 } finally { | 5608 } finally { |
5534 _inLoop = wasInLoop; | 5609 _inLoop = wasInLoop; |
5535 } | 5610 } |
5536 } | 5611 } |
5537 | 5612 |
5538 /** | 5613 /** |
5614 * Parse a dotted name. Return the dotted name that was parsed. | |
5615 * | |
5616 * dottedName ::= | |
5617 * identifier ('.' identifier)* | |
5618 */ | |
5619 DottedName _parseDottedName() { | |
5620 List<SimpleIdentifier> components = new List<SimpleIdentifier>(); | |
5621 components.add(parseSimpleIdentifier()); | |
5622 while (_matches(TokenType.PERIOD)) { | |
5623 _advance(); | |
5624 components.add(parseSimpleIdentifier()); | |
5625 } | |
5626 return new DottedName(components); | |
5627 } | |
5628 | |
5629 /** | |
5539 * Parse an empty statement. Return the empty statement that was parsed. | 5630 * Parse an empty statement. Return the empty statement that was parsed. |
5540 * | 5631 * |
5541 * emptyStatement ::= | 5632 * emptyStatement ::= |
5542 * ';' | 5633 * ';' |
5543 */ | 5634 */ |
5544 Statement _parseEmptyStatement() => new EmptyStatement(getAndAdvance()); | 5635 Statement _parseEmptyStatement() => new EmptyStatement(getAndAdvance()); |
5545 | 5636 |
5546 EnumConstantDeclaration _parseEnumConstantDeclaration() { | 5637 EnumConstantDeclaration _parseEnumConstantDeclaration() { |
5547 CommentAndMetadata commentAndMetadata = _parseCommentAndMetadata(); | 5638 CommentAndMetadata commentAndMetadata = _parseCommentAndMetadata(); |
5548 SimpleIdentifier name; | 5639 SimpleIdentifier name; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5635 leftEqualityExpression = true; | 5726 leftEqualityExpression = true; |
5636 } | 5727 } |
5637 return expression; | 5728 return expression; |
5638 } | 5729 } |
5639 | 5730 |
5640 /** | 5731 /** |
5641 * Parse an export directive. The [commentAndMetadata] is the metadata to be | 5732 * Parse an export directive. The [commentAndMetadata] is the metadata to be |
5642 * associated with the directive. Return the export directive that was parsed. | 5733 * associated with the directive. Return the export directive that was parsed. |
5643 * | 5734 * |
5644 * exportDirective ::= | 5735 * exportDirective ::= |
5645 * metadata 'export' stringLiteral combinator*';' | 5736 * metadata 'export' stringLiteral configuration* combinator*';' |
5646 */ | 5737 */ |
5647 ExportDirective _parseExportDirective(CommentAndMetadata commentAndMetadata) { | 5738 ExportDirective _parseExportDirective(CommentAndMetadata commentAndMetadata) { |
5648 Token exportKeyword = _expectKeyword(Keyword.EXPORT); | 5739 Token exportKeyword = _expectKeyword(Keyword.EXPORT); |
5649 StringLiteral libraryUri = _parseUri(); | 5740 StringLiteral libraryUri = _parseUri(); |
5741 List<Configuration> configurations = _parseConfigurations(); | |
5650 List<Combinator> combinators = _parseCombinators(); | 5742 List<Combinator> combinators = _parseCombinators(); |
5651 Token semicolon = _expectSemicolon(); | 5743 Token semicolon = _expectSemicolon(); |
5652 return new ExportDirective( | 5744 return new ExportDirective( |
5653 commentAndMetadata.comment, | 5745 commentAndMetadata.comment, |
5654 commentAndMetadata.metadata, | 5746 commentAndMetadata.metadata, |
5655 exportKeyword, | 5747 exportKeyword, |
5656 libraryUri, | 5748 libraryUri, |
5749 configurations, | |
5657 combinators, | 5750 combinators, |
5658 semicolon); | 5751 semicolon); |
5659 } | 5752 } |
5660 | 5753 |
5661 /** | 5754 /** |
5662 * Parse a list of expressions. Return the expression that was parsed. | 5755 * Parse a list of expressions. Return the expression that was parsed. |
5663 * | 5756 * |
5664 * expressionList ::= | 5757 * expressionList ::= |
5665 * expression (',' expression)* | 5758 * expression (',' expression)* |
5666 */ | 5759 */ |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6263 } | 6356 } |
6264 return new IfStatement(ifKeyword, leftParenthesis, condition, | 6357 return new IfStatement(ifKeyword, leftParenthesis, condition, |
6265 rightParenthesis, thenStatement, elseKeyword, elseStatement); | 6358 rightParenthesis, thenStatement, elseKeyword, elseStatement); |
6266 } | 6359 } |
6267 | 6360 |
6268 /** | 6361 /** |
6269 * Parse an import directive. The [commentAndMetadata] is the metadata to be | 6362 * Parse an import directive. The [commentAndMetadata] is the metadata to be |
6270 * associated with the directive. Return the import directive that was parsed. | 6363 * associated with the directive. Return the import directive that was parsed. |
6271 * | 6364 * |
6272 * importDirective ::= | 6365 * importDirective ::= |
6273 * metadata 'import' stringLiteral (deferred)? ('as' identifier)? comb inator*';' | 6366 * metadata 'import' stringLiteral configuration* (deferred)? ('as' id entifier)? combinator*';' |
6274 */ | 6367 */ |
6275 ImportDirective _parseImportDirective(CommentAndMetadata commentAndMetadata) { | 6368 ImportDirective _parseImportDirective(CommentAndMetadata commentAndMetadata) { |
6276 Token importKeyword = _expectKeyword(Keyword.IMPORT); | 6369 Token importKeyword = _expectKeyword(Keyword.IMPORT); |
6277 StringLiteral libraryUri = _parseUri(); | 6370 StringLiteral libraryUri = _parseUri(); |
6371 List<Configuration> configurations = _parseConfigurations(); | |
6278 Token deferredToken = null; | 6372 Token deferredToken = null; |
6279 Token asToken = null; | 6373 Token asToken = null; |
6280 SimpleIdentifier prefix = null; | 6374 SimpleIdentifier prefix = null; |
6281 if (_matchesKeyword(Keyword.DEFERRED)) { | 6375 if (_matchesKeyword(Keyword.DEFERRED)) { |
6282 deferredToken = getAndAdvance(); | 6376 deferredToken = getAndAdvance(); |
6283 } | 6377 } |
6284 if (_matchesKeyword(Keyword.AS)) { | 6378 if (_matchesKeyword(Keyword.AS)) { |
6285 asToken = getAndAdvance(); | 6379 asToken = getAndAdvance(); |
6286 prefix = parseSimpleIdentifier(); | 6380 prefix = parseSimpleIdentifier(); |
6287 } else if (deferredToken != null) { | 6381 } else if (deferredToken != null) { |
(...skipping 15 matching lines...) Expand all Loading... | |
6303 } | 6397 } |
6304 } | 6398 } |
6305 } | 6399 } |
6306 List<Combinator> combinators = _parseCombinators(); | 6400 List<Combinator> combinators = _parseCombinators(); |
6307 Token semicolon = _expectSemicolon(); | 6401 Token semicolon = _expectSemicolon(); |
6308 return new ImportDirective( | 6402 return new ImportDirective( |
6309 commentAndMetadata.comment, | 6403 commentAndMetadata.comment, |
6310 commentAndMetadata.metadata, | 6404 commentAndMetadata.metadata, |
6311 importKeyword, | 6405 importKeyword, |
6312 libraryUri, | 6406 libraryUri, |
6407 configurations, | |
6313 deferredToken, | 6408 deferredToken, |
6314 asToken, | 6409 asToken, |
6315 prefix, | 6410 prefix, |
6316 combinators, | 6411 combinators, |
6317 semicolon); | 6412 semicolon); |
6318 } | 6413 } |
6319 | 6414 |
6320 /** | 6415 /** |
6321 * Parse a list of initialized identifiers. The [commentAndMetadata] is the | 6416 * Parse a list of initialized identifiers. The [commentAndMetadata] is the |
6322 * documentation comment and metadata to be associated with the declaration. | 6417 * documentation comment and metadata to be associated with the declaration. |
(...skipping 3603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9926 _isEqualTokens(node.colon, toNode.colon), | 10021 _isEqualTokens(node.colon, toNode.colon), |
9927 _isEqualNodes(node.elseExpression, toNode.elseExpression))) { | 10022 _isEqualNodes(node.elseExpression, toNode.elseExpression))) { |
9928 toNode.propagatedType = node.propagatedType; | 10023 toNode.propagatedType = node.propagatedType; |
9929 toNode.staticType = node.staticType; | 10024 toNode.staticType = node.staticType; |
9930 return true; | 10025 return true; |
9931 } | 10026 } |
9932 return false; | 10027 return false; |
9933 } | 10028 } |
9934 | 10029 |
9935 @override | 10030 @override |
10031 bool visitConfiguration(Configuration node) { | |
10032 Configuration toNode = this._toNode as Configuration; | |
10033 if (_and( | |
10034 _isEqualTokens(node.ifKeyword, toNode.ifKeyword), | |
10035 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | |
10036 _isEqualNodes(node.name, toNode.name), | |
10037 _isEqualTokens(node.equalToken, toNode.equalToken), | |
10038 _isEqualNodes(node.value, toNode.value), | |
10039 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), | |
10040 _isEqualNodes(node.libraryUri, toNode.libraryUri))) { | |
10041 return true; | |
10042 } | |
10043 return false; | |
10044 } | |
10045 | |
10046 @override | |
9936 bool visitConstructorDeclaration(ConstructorDeclaration node) { | 10047 bool visitConstructorDeclaration(ConstructorDeclaration node) { |
9937 ConstructorDeclaration toNode = this._toNode as ConstructorDeclaration; | 10048 ConstructorDeclaration toNode = this._toNode as ConstructorDeclaration; |
9938 if (_and( | 10049 if (_and( |
9939 _isEqualNodes(node.documentationComment, toNode.documentationComment), | 10050 _isEqualNodes(node.documentationComment, toNode.documentationComment), |
9940 _isEqualNodeLists(node.metadata, toNode.metadata), | 10051 _isEqualNodeLists(node.metadata, toNode.metadata), |
9941 _isEqualTokens(node.externalKeyword, toNode.externalKeyword), | 10052 _isEqualTokens(node.externalKeyword, toNode.externalKeyword), |
9942 _isEqualTokens(node.constKeyword, toNode.constKeyword), | 10053 _isEqualTokens(node.constKeyword, toNode.constKeyword), |
9943 _isEqualTokens(node.factoryKeyword, toNode.factoryKeyword), | 10054 _isEqualTokens(node.factoryKeyword, toNode.factoryKeyword), |
9944 _isEqualNodes(node.returnType, toNode.returnType), | 10055 _isEqualNodes(node.returnType, toNode.returnType), |
9945 _isEqualTokens(node.period, toNode.period), | 10056 _isEqualTokens(node.period, toNode.period), |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10021 _isEqualTokens(node.doKeyword, toNode.doKeyword), | 10132 _isEqualTokens(node.doKeyword, toNode.doKeyword), |
10022 _isEqualNodes(node.body, toNode.body), | 10133 _isEqualNodes(node.body, toNode.body), |
10023 _isEqualTokens(node.whileKeyword, toNode.whileKeyword), | 10134 _isEqualTokens(node.whileKeyword, toNode.whileKeyword), |
10024 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | 10135 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), |
10025 _isEqualNodes(node.condition, toNode.condition), | 10136 _isEqualNodes(node.condition, toNode.condition), |
10026 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), | 10137 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), |
10027 _isEqualTokens(node.semicolon, toNode.semicolon)); | 10138 _isEqualTokens(node.semicolon, toNode.semicolon)); |
10028 } | 10139 } |
10029 | 10140 |
10030 @override | 10141 @override |
10142 bool visitDottedName(DottedName node) { | |
10143 DottedName toNode = this._toNode as DottedName; | |
10144 return _isEqualNodeLists(node.components, toNode.components); | |
10145 } | |
10146 | |
10147 @override | |
10031 bool visitDoubleLiteral(DoubleLiteral node) { | 10148 bool visitDoubleLiteral(DoubleLiteral node) { |
10032 DoubleLiteral toNode = this._toNode as DoubleLiteral; | 10149 DoubleLiteral toNode = this._toNode as DoubleLiteral; |
10033 if (_and(_isEqualTokens(node.literal, toNode.literal), | 10150 if (_and(_isEqualTokens(node.literal, toNode.literal), |
10034 node.value == toNode.value)) { | 10151 node.value == toNode.value)) { |
10035 toNode.propagatedType = node.propagatedType; | 10152 toNode.propagatedType = node.propagatedType; |
10036 toNode.staticType = node.staticType; | 10153 toNode.staticType = node.staticType; |
10037 return true; | 10154 return true; |
10038 } | 10155 } |
10039 return false; | 10156 return false; |
10040 } | 10157 } |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11053 } | 11170 } |
11054 | 11171 |
11055 /** | 11172 /** |
11056 * Copy resolution data from the [fromNode] to the [toNode]. | 11173 * Copy resolution data from the [fromNode] to the [toNode]. |
11057 */ | 11174 */ |
11058 static void copyResolutionData(AstNode fromNode, AstNode toNode) { | 11175 static void copyResolutionData(AstNode fromNode, AstNode toNode) { |
11059 ResolutionCopier copier = new ResolutionCopier(); | 11176 ResolutionCopier copier = new ResolutionCopier(); |
11060 copier._isEqualNodes(fromNode, toNode); | 11177 copier._isEqualNodes(fromNode, toNode); |
11061 } | 11178 } |
11062 } | 11179 } |
OLD | NEW |