| 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'; |
| 11 | 11 |
| 12 import 'package:analyzer/dart/ast/token.dart' as analyzer show Token; | 12 import 'package:analyzer/dart/ast/token.dart' as analyzer show Token; |
| 13 | 13 |
| 14 import 'package:analyzer/dart/element/element.dart' show Element; | 14 import 'package:analyzer/dart/element/element.dart' show Element; |
| 15 | 15 |
| 16 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; | 16 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; |
| 17 | 17 |
| 18 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; | 18 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; |
| 19 | 19 |
| 20 import 'package:kernel/ast.dart' show AsyncMarker; | 20 import 'package:kernel/ast.dart' show AsyncMarker; |
| 21 | 21 |
| 22 import '../errors.dart' show internalError; | 22 import '../errors.dart' show internalError; |
| 23 | 23 |
| 24 import '../source/scope_listener.dart' | 24 import '../source/scope_listener.dart' |
| 25 show JumpTargetKind, NullValue, Scope, ScopeListener; | 25 show JumpTargetKind, NullValue, Scope, ScopeListener; |
| 26 | 26 |
| 27 import '../kernel/kernel_builder.dart' | 27 import '../kernel/kernel_builder.dart' |
| 28 show Builder, KernelLibraryBuilder, ProcedureBuilder; | 28 show Builder, KernelLibraryBuilder, ProcedureBuilder; |
| 29 | 29 |
| 30 import '../parser/parser.dart' show optional; |
| 31 |
| 30 import '../quote.dart'; | 32 import '../quote.dart'; |
| 31 | 33 |
| 32 import '../source/outline_builder.dart' show asyncMarkerFromTokens; | 34 import '../source/outline_builder.dart' show asyncMarkerFromTokens; |
| 33 | 35 |
| 34 import 'element_store.dart' | 36 import 'element_store.dart' |
| 35 show | 37 show |
| 36 AnalyzerLocalVariableElemment, | 38 AnalyzerLocalVariableElemment, |
| 37 AnalyzerParameterElement, | 39 AnalyzerParameterElement, |
| 38 ElementStore, | 40 ElementStore, |
| 39 KernelClassElement; | 41 KernelClassElement; |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 withClause = ast.withClause( | 791 withClause = ast.withClause( |
| 790 toAnalyzerToken(supertype.withKeyword), supertype.mixinTypes); | 792 toAnalyzerToken(supertype.withKeyword), supertype.mixinTypes); |
| 791 } else { | 793 } else { |
| 792 internalError('Unexpected kind of supertype ${supertype.runtimeType}'); | 794 internalError('Unexpected kind of supertype ${supertype.runtimeType}'); |
| 793 } | 795 } |
| 794 TypeParameterList typeParameters = pop(); | 796 TypeParameterList typeParameters = pop(); |
| 795 SimpleIdentifier name = pop(); | 797 SimpleIdentifier name = pop(); |
| 796 Token classKeyword; | 798 Token classKeyword; |
| 797 // TODO(paulberry,ahe): This is a hack. The parser should give us the class | 799 // TODO(paulberry,ahe): This is a hack. The parser should give us the class |
| 798 // keyword. | 800 // keyword. |
| 799 if (identical(beginToken.value, 'abstract')) { | 801 if (optional('abstract', beginToken)) { |
| 800 classKeyword = beginToken.next; | 802 classKeyword = beginToken.next; |
| 801 } else { | 803 } else { |
| 802 classKeyword = beginToken; | 804 classKeyword = beginToken; |
| 803 } | 805 } |
| 804 var modifiers = pop(); | 806 var modifiers = pop(); |
| 805 assert(modifiers == null); // TODO(paulberry) | 807 assert(modifiers == null); // TODO(paulberry) |
| 806 analyzer.Token abstractKeyword; | 808 analyzer.Token abstractKeyword; |
| 807 List<Annotation> metadata = pop(); | 809 List<Annotation> metadata = pop(); |
| 808 Comment comment = null; // TODO(paulberry) | 810 Comment comment = null; // TODO(paulberry) |
| 809 push(ast.classDeclaration( | 811 push(ast.classDeclaration( |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 /// [ClassDeclaration] or [ClassTypeAlias] object. | 967 /// [ClassDeclaration] or [ClassTypeAlias] object. |
| 966 class _MixinApplication { | 968 class _MixinApplication { |
| 967 final TypeName supertype; | 969 final TypeName supertype; |
| 968 | 970 |
| 969 final Token withKeyword; | 971 final Token withKeyword; |
| 970 | 972 |
| 971 final List<TypeName> mixinTypes; | 973 final List<TypeName> mixinTypes; |
| 972 | 974 |
| 973 _MixinApplication(this.supertype, this.withKeyword, this.mixinTypes); | 975 _MixinApplication(this.supertype, this.withKeyword, this.mixinTypes); |
| 974 } | 976 } |
| OLD | NEW |