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

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

Issue 2803113002: Fix for parsing named factory constructors with Fasta. (Closed)
Patch Set: Restore toAnalyzerToken() invocation. Created 3 years, 8 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_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 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 body = ast.emptyFunctionBody(toAnalyzerToken(semicolon)); 1564 body = ast.emptyFunctionBody(toAnalyzerToken(semicolon));
1565 } else { 1565 } else {
1566 internalError('Unexpected body object: ${bodyObject.runtimeType}'); 1566 internalError('Unexpected body object: ${bodyObject.runtimeType}');
1567 } 1567 }
1568 1568
1569 FormalParameterList parameters = pop(); 1569 FormalParameterList parameters = pop();
1570 ConstructorName constructorName = pop(); 1570 ConstructorName constructorName = pop();
1571 _Modifiers modifiers = pop(); 1571 _Modifiers modifiers = pop();
1572 List<Annotation> metadata = pop(); 1572 List<Annotation> metadata = pop();
1573 Comment comment = pop(); 1573 Comment comment = pop();
1574
1575 // Decompose the preliminary ConstructorName into the type name and
1576 // the actual constructor name.
1577 SimpleIdentifier returnType;
1578 analyzer.Token period;
1579 SimpleIdentifier name;
1580 Identifier typeName = constructorName.type.name;
1581 if (typeName is SimpleIdentifier) {
1582 returnType = typeName;
1583 } else if (typeName is PrefixedIdentifier) {
1584 returnType = typeName.prefix;
1585 period = typeName.period;
1586 name =
1587 ast.simpleIdentifier(typeName.identifier.token, isDeclaration: true);
1588 }
1589
1574 push(ast.constructorDeclaration( 1590 push(ast.constructorDeclaration(
1575 comment, 1591 comment,
1576 metadata, 1592 metadata,
1577 toAnalyzerToken(modifiers?.externalKeyword), 1593 toAnalyzerToken(modifiers?.externalKeyword),
1578 toAnalyzerToken(modifiers?.finalConstOrVarKeyword), 1594 toAnalyzerToken(modifiers?.finalConstOrVarKeyword),
1579 toAnalyzerToken(factoryKeyword), 1595 toAnalyzerToken(factoryKeyword),
1580 constructorName.type.name, 1596 ast.simpleIdentifier(returnType.token),
1581 constructorName.period, 1597 period,
1582 constructorName.name, 1598 name,
1583 parameters, 1599 parameters,
1584 toAnalyzerToken(separator), 1600 toAnalyzerToken(separator),
1585 null, 1601 null,
1586 redirectedConstructor, 1602 redirectedConstructor,
1587 body)); 1603 body));
1588 } 1604 }
1589 1605
1590 void endFieldInitializer(Token assignment) { 1606 void endFieldInitializer(Token assignment) {
1591 debugEvent("FieldInitializer"); 1607 debugEvent("FieldInitializer");
1592 Expression initializer = pop(); 1608 Expression initializer = pop();
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 } else if (identical('static', s)) { 2004 } else if (identical('static', s)) {
1989 staticKeyword = token; 2005 staticKeyword = token;
1990 } else if (identical('var', s)) { 2006 } else if (identical('var', s)) {
1991 finalConstOrVarKeyword = token; 2007 finalConstOrVarKeyword = token;
1992 } else { 2008 } else {
1993 internalError('Unhandled modifier: $s'); 2009 internalError('Unhandled modifier: $s');
1994 } 2010 }
1995 } 2011 }
1996 } 2012 }
1997 } 2013 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698