| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.analyzer.ast_builder; | 5 library fasta.analyzer.ast_builder; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; | 8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; |
| 9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; | 9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; |
| 10 import 'package:analyzer/dart/ast/token.dart' as analyzer show Token; | 10 import 'package:analyzer/dart/ast/token.dart' as analyzer show Token; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 void handleIdentifier(Token token, IdentifierContext context) { | 176 void handleIdentifier(Token token, IdentifierContext context) { |
| 177 debugEvent("handleIdentifier"); | 177 debugEvent("handleIdentifier"); |
| 178 analyzer.Token analyzerToken = toAnalyzerToken(token); | 178 analyzer.Token analyzerToken = toAnalyzerToken(token); |
| 179 | 179 |
| 180 if (context.inSymbol) { | 180 if (context.inSymbol) { |
| 181 push(analyzerToken); | 181 push(analyzerToken); |
| 182 return; | 182 return; |
| 183 } | 183 } |
| 184 | 184 |
| 185 SimpleIdentifier identifier = ast.simpleIdentifier(analyzerToken); | 185 SimpleIdentifier identifier = ast.simpleIdentifier(analyzerToken, |
| 186 isDeclaration: context.inDeclaration); |
| 186 if (context.inLibraryOrPartOfDeclaration) { | 187 if (context.inLibraryOrPartOfDeclaration) { |
| 187 if (!context.isContinuation) { | 188 if (!context.isContinuation) { |
| 188 push([identifier]); | 189 push([identifier]); |
| 189 } else { | 190 } else { |
| 190 push(identifier); | 191 push(identifier); |
| 191 } | 192 } |
| 192 } else if (context == IdentifierContext.enumValueDeclaration) { | 193 } else if (context == IdentifierContext.enumValueDeclaration) { |
| 193 // TODO(paulberry): analyzer's ASTs allow for enumerated values to have | 194 // TODO(paulberry): analyzer's ASTs allow for enumerated values to have |
| 194 // metadata, but the spec doesn't permit it. | 195 // metadata, but the spec doesn't permit it. |
| 195 List<Annotation> metadata; | 196 List<Annotation> metadata; |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 Comment comment = pop(); | 1307 Comment comment = pop(); |
| 1307 | 1308 |
| 1308 void constructor(SimpleIdentifier returnType, analyzer.Token period, | 1309 void constructor(SimpleIdentifier returnType, analyzer.Token period, |
| 1309 SimpleIdentifier name) { | 1310 SimpleIdentifier name) { |
| 1310 push(ast.constructorDeclaration( | 1311 push(ast.constructorDeclaration( |
| 1311 comment, | 1312 comment, |
| 1312 metadata, | 1313 metadata, |
| 1313 toAnalyzerToken(modifiers?.externalKeyword), | 1314 toAnalyzerToken(modifiers?.externalKeyword), |
| 1314 toAnalyzerToken(modifiers?.finalConstOrVarKeyword), | 1315 toAnalyzerToken(modifiers?.finalConstOrVarKeyword), |
| 1315 null, // TODO(paulberry): factoryKeyword | 1316 null, // TODO(paulberry): factoryKeyword |
| 1316 returnType, | 1317 ast.simpleIdentifier(returnType.token), |
| 1317 period, | 1318 period, |
| 1318 name, | 1319 name, |
| 1319 parameters, | 1320 parameters, |
| 1320 toAnalyzerToken(separator), | 1321 toAnalyzerToken(separator), |
| 1321 initializers, | 1322 initializers, |
| 1322 redirectedConstructor, | 1323 redirectedConstructor, |
| 1323 body)); | 1324 body)); |
| 1324 } | 1325 } |
| 1325 | 1326 |
| 1326 void method(Token operatorKeyword, SimpleIdentifier name) { | 1327 void method(Token operatorKeyword, SimpleIdentifier name) { |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 } else if (identical('static', s)) { | 1599 } else if (identical('static', s)) { |
| 1599 staticKeyword = token; | 1600 staticKeyword = token; |
| 1600 } else if (identical('var', s)) { | 1601 } else if (identical('var', s)) { |
| 1601 finalConstOrVarKeyword = token; | 1602 finalConstOrVarKeyword = token; |
| 1602 } else { | 1603 } else { |
| 1603 internalError('Unhandled modifier: $s'); | 1604 internalError('Unhandled modifier: $s'); |
| 1604 } | 1605 } |
| 1605 } | 1606 } |
| 1606 } | 1607 } |
| 1607 } | 1608 } |
| OLD | NEW |