OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |