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

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

Issue 2748763003: Add support for parsing annotations 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_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 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 @override 1463 @override
1464 void beginMetadataStar(Token token) { 1464 void beginMetadataStar(Token token) {
1465 debugEvent("beginMetadataStar"); 1465 debugEvent("beginMetadataStar");
1466 if (token.precedingComments != null) { 1466 if (token.precedingComments != null) {
1467 push(_toAnalyzerComment(token.precedingComments)); 1467 push(_toAnalyzerComment(token.precedingComments));
1468 } else { 1468 } else {
1469 push(NullValue.Comments); 1469 push(NullValue.Comments);
1470 } 1470 }
1471 } 1471 }
1472 1472
1473 @override
1474 void endMetadata(Token beginToken, Token periodBeforeName, Token endToken) {
1475 debugEvent("Metadata");
1476 MethodInvocation invocation = pop();
1477 SimpleIdentifier constructorName = periodBeforeName != null ? pop() : null;
1478 pop(); // Type arguments, not allowed.
1479 Identifier name = pop();
1480 push(ast.annotation(
1481 toAnalyzerToken(beginToken),
1482 name,
1483 toAnalyzerToken(periodBeforeName),
1484 constructorName,
1485 invocation?.argumentList));
1486 }
1487
1473 ParameterKind _toAnalyzerParameterKind(FormalParameterType type) { 1488 ParameterKind _toAnalyzerParameterKind(FormalParameterType type) {
1474 if (type == FormalParameterType.POSITIONAL) { 1489 if (type == FormalParameterType.POSITIONAL) {
1475 return ParameterKind.POSITIONAL; 1490 return ParameterKind.POSITIONAL;
1476 } else if (type == FormalParameterType.NAMED) { 1491 } else if (type == FormalParameterType.NAMED) {
1477 return ParameterKind.NAMED; 1492 return ParameterKind.NAMED;
1478 } else { 1493 } else {
1479 return ParameterKind.REQUIRED; 1494 return ParameterKind.REQUIRED;
1480 } 1495 }
1481 } 1496 }
1482 1497
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 } else if (identical('static', s)) { 1604 } else if (identical('static', s)) {
1590 staticKeyword = token; 1605 staticKeyword = token;
1591 } else if (identical('var', s)) { 1606 } else if (identical('var', s)) {
1592 finalConstOrVarKeyword = token; 1607 finalConstOrVarKeyword = token;
1593 } else { 1608 } else {
1594 internalError('Unhandled modifier: $s'); 1609 internalError('Unhandled modifier: $s');
1595 } 1610 }
1596 } 1611 }
1597 } 1612 }
1598 } 1613 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/parser_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698