Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart

Issue 2705153004: Handle TypeVariable and TypeVariables in AstBuilder. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 } 988 }
989 var variableList = ast.variableDeclarationList( 989 var variableList = ast.variableDeclarationList(
990 null, null, toAnalyzerToken(keyword), type, variables); 990 null, null, toAnalyzerToken(keyword), type, variables);
991 var modifiers = pop(); 991 var modifiers = pop();
992 assert(modifiers == null); // TODO(paulberry) 992 assert(modifiers == null); // TODO(paulberry)
993 List<Annotation> metadata = pop(); 993 List<Annotation> metadata = pop();
994 Comment comment = null; // TODO(paulberry) 994 Comment comment = null; // TODO(paulberry)
995 push(ast.topLevelVariableDeclaration( 995 push(ast.topLevelVariableDeclaration(
996 comment, metadata, variableList, toAnalyzerToken(endToken))); 996 comment, metadata, variableList, toAnalyzerToken(endToken)));
997 } 997 }
998
999 @override
1000 void endTypeVariable(Token token, Token extendsOrSuper) {
scheglov 2017/02/21 19:19:26 What means "OrSuper" here? Did I miss something fr
Paul Berry 2017/02/21 20:00:25 I copied it from the base class. I think it's a s
ahe 2017/02/22 10:35:45 Yes. This is a bug.
1001 // TODO(paulberry): set up scopes properly to resolve parameters and type
1002 // variables. Note that this is tricky due to the handling of initializers
1003 // in constructors, so the logic should be shared with BodyBuilder as much
1004 // as possible.
1005 debugEvent("TypeVariable");
1006 TypeAnnotation bound = pop();
1007 SimpleIdentifier name = pop();
1008 List<Annotation> metadata = null; // TODO(paulberry)
1009 Comment comment = null; // TODO(paulberry)
1010 push(ast.typeParameter(
1011 comment, metadata, name, toAnalyzerToken(extendsOrSuper), bound));
1012 }
1013
1014 void endTypeVariables(int count, Token beginToken, Token endToken) {
scheglov 2017/02/21 19:19:26 @override?
Paul Berry 2017/02/21 20:00:24 Done.
1015 debugEvent("TypeVariables");
1016 List<TypeParameter> typeParameters = popList(count);
1017 push(ast.typeParameterList(toAnalyzerToken(beginToken), typeParameters,
1018 toAnalyzerToken(endToken)));
1019 }
998 } 1020 }
999 1021
1000 /// Data structure placed on the stack to represent a class body. 1022 /// Data structure placed on the stack to represent a class body.
1001 /// 1023 ///
1002 /// This is needed because analyzer has no separate AST representation of a 1024 /// This is needed because analyzer has no separate AST representation of a
1003 /// class body; it simply stores all of the relevant data in the 1025 /// class body; it simply stores all of the relevant data in the
1004 /// [ClassDeclaration] object. 1026 /// [ClassDeclaration] object.
1005 class _ClassBody { 1027 class _ClassBody {
1006 final Token beginToken; 1028 final Token beginToken;
1007 1029
(...skipping 12 matching lines...) Expand all
1020 /// [ClassDeclaration] or [ClassTypeAlias] object. 1042 /// [ClassDeclaration] or [ClassTypeAlias] object.
1021 class _MixinApplication { 1043 class _MixinApplication {
1022 final TypeName supertype; 1044 final TypeName supertype;
1023 1045
1024 final Token withKeyword; 1046 final Token withKeyword;
1025 1047
1026 final List<TypeName> mixinTypes; 1048 final List<TypeName> mixinTypes;
1027 1049
1028 _MixinApplication(this.supertype, this.withKeyword, this.mixinTypes); 1050 _MixinApplication(this.supertype, this.withKeyword, this.mixinTypes);
1029 } 1051 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | pkg/front_end/lib/src/fasta/parser/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698