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

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

Issue 2771583002: Parse SuperConstructorInvocation 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 | « no previous file | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | 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 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 FormalParameterList parameters = pop(); 1456 FormalParameterList parameters = pop();
1457 TypeParameterList typeParameters = pop(); // TODO(paulberry) 1457 TypeParameterList typeParameters = pop(); // TODO(paulberry)
1458 var name = pop(); 1458 var name = pop();
1459 TypeAnnotation returnType = pop(); // TODO(paulberry) 1459 TypeAnnotation returnType = pop(); // TODO(paulberry)
1460 _Modifiers modifiers = pop(); 1460 _Modifiers modifiers = pop();
1461 List<Annotation> metadata = pop(); 1461 List<Annotation> metadata = pop();
1462 Comment comment = pop(); 1462 Comment comment = pop();
1463 1463
1464 var initializers = <ConstructorInitializer>[]; 1464 var initializers = <ConstructorInitializer>[];
1465 for (Object initializerObject in initializerObjects) { 1465 for (Object initializerObject in initializerObjects) {
1466 if (initializerObject is AssignmentExpression) { 1466 if (initializerObject is FunctionExpressionInvocation) {
1467 var superExpression = initializerObject.function as SuperExpression;
1468 initializers.add(ast.superConstructorInvocation(
1469 superExpression.superKeyword,
1470 null,
1471 null,
1472 initializerObject.argumentList));
1473 } else if (initializerObject is MethodInvocation) {
1474 var superExpression = initializerObject.target as SuperExpression;
1475 initializers.add(ast.superConstructorInvocation(
1476 superExpression.superKeyword,
1477 initializerObject.operator,
1478 initializerObject.methodName,
1479 initializerObject.argumentList));
1480 } else if (initializerObject is AssignmentExpression) {
1467 analyzer.Token thisKeyword; 1481 analyzer.Token thisKeyword;
1468 analyzer.Token period; 1482 analyzer.Token period;
1469 SimpleIdentifier fieldName; 1483 SimpleIdentifier fieldName;
1470 Expression left = initializerObject.leftHandSide; 1484 Expression left = initializerObject.leftHandSide;
1471 if (left is PropertyAccess) { 1485 if (left is PropertyAccess) {
1472 var thisExpression = left.target as ThisExpression; 1486 var thisExpression = left.target as ThisExpression;
1473 thisKeyword = thisExpression.thisKeyword; 1487 thisKeyword = thisExpression.thisKeyword;
1474 period = left.operator; 1488 period = left.operator;
1475 fieldName = left.propertyName; 1489 fieldName = left.propertyName;
1476 } else { 1490 } else {
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 } else if (identical('static', s)) { 1807 } else if (identical('static', s)) {
1794 staticKeyword = token; 1808 staticKeyword = token;
1795 } else if (identical('var', s)) { 1809 } else if (identical('var', s)) {
1796 finalConstOrVarKeyword = token; 1810 finalConstOrVarKeyword = token;
1797 } else { 1811 } else {
1798 internalError('Unhandled modifier: $s'); 1812 internalError('Unhandled modifier: $s');
1799 } 1813 }
1800 } 1814 }
1801 } 1815 }
1802 } 1816 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698