Index: pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart |
diff --git a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart |
index 5a14cae0ff85418224322eeffdf0f131ad1e142a..35a38ec3d38d931e1f54350af2c603d7e494282f 100644 |
--- a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart |
+++ b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart |
@@ -1311,6 +1311,42 @@ class AstBuilder extends ScopeListener { |
} |
@override |
+ void endFields( |
+ int count, Token covariantKeyword, Token beginToken, Token endToken) { |
+ debugEvent("Fields"); |
+ List<VariableDeclaration> variables = popList(count); |
+ TypeAnnotation type = pop(); |
+ List<Token> modifiers = pop(); |
+ Token staticKeyword; |
+ Token keyword; |
+ for (Token modifier in modifiers) { |
ahe
2017/03/01 15:20:31
Would it make sense to have something more like pk
Paul Berry
2017/03/01 21:08:22
Unfortunately that wouldn't be quite enough; the a
|
+ String value = modifier.stringValue; |
+ if (identical('static', value)) { |
+ // TODO(paulberry): Check the order and uniqueness. |
ahe
2017/03/01 15:20:31
I think we should have the parser do that (while s
Paul Berry
2017/03/01 21:08:22
Agreed. There are several TODOs that say this, so
|
+ staticKeyword = modifier; |
+ } else if (identical('var', value)) { |
+ // TODO(paulberry): Check the order and uniqueness. |
+ keyword = modifier; |
+ } else { |
+ // TODO(paulberry): Report error. |
+ internalError("Invalid modifier ($value). Report an error."); |
+ } |
+ } |
+ var variableList = ast.variableDeclarationList( |
+ null, null, toAnalyzerToken(keyword), type, variables); |
+ List<Annotation> metadata = pop(); |
+ // TODO(paulberry): capture doc comments. See dartbug.com/28851. |
+ Comment comment = null; |
+ push(ast.fieldDeclaration2( |
+ comment: comment, |
+ metadata: metadata, |
+ covariantKeyword: toAnalyzerToken(covariantKeyword), |
+ staticKeyword: toAnalyzerToken(staticKeyword), |
+ fieldList: variableList, |
+ semicolon: toAnalyzerToken(endToken))); |
+ } |
+ |
+ @override |
void handleOperatorName(Token operatorKeyword, Token token) { |
debugEvent("OperatorName"); |
push(new _OperatorName(operatorKeyword, |