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

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

Issue 2733913002: Fix for parsing 'const X()' with Fasta. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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: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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 Token start, Token periodBeforeName, Token endToken) { 70 Token start, Token periodBeforeName, Token endToken) {
71 debugEvent("ConstructorReference"); 71 debugEvent("ConstructorReference");
72 SimpleIdentifier constructorName = pop(); 72 SimpleIdentifier constructorName = pop();
73 TypeArgumentList typeArguments = pop(); 73 TypeArgumentList typeArguments = pop();
74 Identifier typeNameIdentifier = pop(); 74 Identifier typeNameIdentifier = pop();
75 push(ast.constructorName(ast.typeName(typeNameIdentifier, typeArguments), 75 push(ast.constructorName(ast.typeName(typeNameIdentifier, typeArguments),
76 toAnalyzerToken(periodBeforeName), constructorName)); 76 toAnalyzerToken(periodBeforeName), constructorName));
77 } 77 }
78 78
79 @override 79 @override
80 void handleNewExpression(Token token) { 80 void handleConstExpression(Token token) {
81 debugEvent("NewExpression"); 81 debugEvent("ConstExpression");
82 _handleInstanceCreation(token);
83 }
84
85 void _handleInstanceCreation(Token token) {
82 MethodInvocation arguments = pop(); 86 MethodInvocation arguments = pop();
83 ConstructorName constructorName = pop(); 87 ConstructorName constructorName = pop();
84 push(ast.instanceCreationExpression( 88 push(ast.instanceCreationExpression(
85 toAnalyzerToken(token), constructorName, arguments.argumentList)); 89 toAnalyzerToken(token), constructorName, arguments.argumentList));
86 } 90 }
87 91
88 @override 92 @override
93 void handleNewExpression(Token token) {
94 debugEvent("NewExpression");
95 _handleInstanceCreation(token);
96 }
97
98 @override
89 void handleParenthesizedExpression(BeginGroupToken token) { 99 void handleParenthesizedExpression(BeginGroupToken token) {
90 debugEvent("ParenthesizedExpression"); 100 debugEvent("ParenthesizedExpression");
91 Expression expression = pop(); 101 Expression expression = pop();
92 push(ast.parenthesizedExpression( 102 push(ast.parenthesizedExpression(
93 toAnalyzerToken(token), expression, toAnalyzerToken(token.endGroup))); 103 toAnalyzerToken(token), expression, toAnalyzerToken(token.endGroup)));
94 } 104 }
95 105
96 void handleStringPart(Token token) { 106 void handleStringPart(Token token) {
97 debugEvent("StringPart"); 107 debugEvent("StringPart");
98 push(token); 108 push(token);
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 } else if (identical('static', s)) { 1466 } else if (identical('static', s)) {
1457 staticKeyword = token; 1467 staticKeyword = token;
1458 } else if (identical('var', s)) { 1468 } else if (identical('var', s)) {
1459 finalConstOrVarKeyword = token; 1469 finalConstOrVarKeyword = token;
1460 } else { 1470 } else {
1461 internalError('Unhandled modifier: $s'); 1471 internalError('Unhandled modifier: $s');
1462 } 1472 }
1463 } 1473 }
1464 } 1474 }
1465 } 1475 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698