| 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:front_end/src/fasta/scanner/token.dart' | 7 import 'package:front_end/src/fasta/scanner/token.dart' |
| 8 show BeginGroupToken, Token; | 8 show BeginGroupToken, Token; |
| 9 | 9 |
| 10 import 'package:analyzer/analyzer.dart'; | 10 import 'package:analyzer/analyzer.dart'; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 bool isFirstIdentifier = false; | 56 bool isFirstIdentifier = false; |
| 57 | 57 |
| 58 @override | 58 @override |
| 59 final Uri uri; | 59 final Uri uri; |
| 60 | 60 |
| 61 /// If `true`, the first call to [handleIdentifier] should push a | 61 /// If `true`, the first call to [handleIdentifier] should push a |
| 62 /// List<SimpleIdentifier> on the stack, and [handleQualified] should append | 62 /// List<SimpleIdentifier> on the stack, and [handleQualified] should append |
| 63 /// to the list. | 63 /// to the list. |
| 64 var accumulateIdentifierComponents = false; | 64 var accumulateIdentifierComponents = false; |
| 65 | 65 |
| 66 | |
| 67 AstBuilder(this.library, this.member, this.elementStore, Scope scope, | 66 AstBuilder(this.library, this.member, this.elementStore, Scope scope, |
| 68 [Uri uri]) | 67 [Uri uri]) |
| 69 : uri = uri ?? library.fileUri, super(scope); | 68 : uri = uri ?? library.fileUri, |
| 69 super(scope); |
| 70 | 70 |
| 71 createJumpTarget(JumpTargetKind kind, int charOffset) { | 71 createJumpTarget(JumpTargetKind kind, int charOffset) { |
| 72 // TODO(ahe): Implement jump targets. | 72 // TODO(ahe): Implement jump targets. |
| 73 return null; | 73 return null; |
| 74 } | 74 } |
| 75 | 75 |
| 76 void beginLiteralString(Token token) { | 76 void beginLiteralString(Token token) { |
| 77 debugEvent("beginLiteralString"); | 77 debugEvent("beginLiteralString"); |
| 78 push(token); | 78 push(token); |
| 79 } | 79 } |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 Expression initializer = pop(); | 973 Expression initializer = pop(); |
| 974 SimpleIdentifier name = pop(); | 974 SimpleIdentifier name = pop(); |
| 975 push(ast.variableDeclaration( | 975 push(ast.variableDeclaration( |
| 976 name, toAnalyzerToken(assignment), initializer)); | 976 name, toAnalyzerToken(assignment), initializer)); |
| 977 } | 977 } |
| 978 | 978 |
| 979 void endTopLevelFields(int count, Token beginToken, Token endToken) { | 979 void endTopLevelFields(int count, Token beginToken, Token endToken) { |
| 980 debugEvent("TopLevelFields"); | 980 debugEvent("TopLevelFields"); |
| 981 List<VariableDeclaration> variables = popList(count); | 981 List<VariableDeclaration> variables = popList(count); |
| 982 TypeAnnotation type = pop(); | 982 TypeAnnotation type = pop(); |
| 983 // TODO(paulberry): the var/const/final keyword should be pointed to by | 983 var keyword; |
| 984 // beginToken. | 984 if (optional('var', beginToken) || |
| 985 var keyword = null; // TODO(paulberry) | 985 optional('const', beginToken) || |
| 986 optional('final', beginToken)) { |
| 987 keyword = beginToken; |
| 988 } |
| 986 var variableList = ast.variableDeclarationList( | 989 var variableList = ast.variableDeclarationList( |
| 987 null, null, toAnalyzerToken(keyword), type, variables); | 990 null, null, toAnalyzerToken(keyword), type, variables); |
| 988 var modifiers = pop(); | 991 var modifiers = pop(); |
| 989 assert(modifiers == null); // TODO(paulberry) | 992 assert(modifiers == null); // TODO(paulberry) |
| 990 List<Annotation> metadata = pop(); | 993 List<Annotation> metadata = pop(); |
| 991 Comment comment = null; // TODO(paulberry) | 994 Comment comment = null; // TODO(paulberry) |
| 992 push(ast.topLevelVariableDeclaration( | 995 push(ast.topLevelVariableDeclaration( |
| 993 comment, metadata, variableList, toAnalyzerToken(endToken))); | 996 comment, metadata, variableList, toAnalyzerToken(endToken))); |
| 994 } | 997 } |
| 995 } | 998 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1017 /// [ClassDeclaration] or [ClassTypeAlias] object. | 1020 /// [ClassDeclaration] or [ClassTypeAlias] object. |
| 1018 class _MixinApplication { | 1021 class _MixinApplication { |
| 1019 final TypeName supertype; | 1022 final TypeName supertype; |
| 1020 | 1023 |
| 1021 final Token withKeyword; | 1024 final Token withKeyword; |
| 1022 | 1025 |
| 1023 final List<TypeName> mixinTypes; | 1026 final List<TypeName> mixinTypes; |
| 1024 | 1027 |
| 1025 _MixinApplication(this.supertype, this.withKeyword, this.mixinTypes); | 1028 _MixinApplication(this.supertype, this.withKeyword, this.mixinTypes); |
| 1026 } | 1029 } |
| OLD | NEW |