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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // TODO(ahe): Implement jump targets. | 62 // TODO(ahe): Implement jump targets. |
63 return null; | 63 return null; |
64 } | 64 } |
65 | 65 |
66 void beginLiteralString(Token token) { | 66 void beginLiteralString(Token token) { |
67 debugEvent("beginLiteralString"); | 67 debugEvent("beginLiteralString"); |
68 push(token); | 68 push(token); |
69 } | 69 } |
70 | 70 |
71 @override | 71 @override |
| 72 void handleNoConstructorReferenceContinuationAfterTypeArguments(Token token) { |
| 73 debugEvent("NoConstructorReferenceContinuationAfterTypeArguments"); |
| 74 push(NullValue.ConstructorReferenceContinuationAfterTypeArguments); |
| 75 } |
| 76 |
| 77 @override |
| 78 void endConstructorReference( |
| 79 Token start, Token periodBeforeName, Token endToken) { |
| 80 debugEvent("ConstructorReference"); |
| 81 SimpleIdentifier constructorName = pop(); |
| 82 TypeArgumentList typeArguments = pop(); |
| 83 Identifier typeNameIdentifier = pop(); |
| 84 push(ast.constructorName(ast.typeName(typeNameIdentifier, typeArguments), |
| 85 toAnalyzerToken(periodBeforeName), constructorName)); |
| 86 } |
| 87 |
| 88 @override |
| 89 void handleNewExpression(Token token) { |
| 90 debugEvent("NewExpression"); |
| 91 MethodInvocation arguments = pop(); |
| 92 ConstructorName constructorName = pop(); |
| 93 push(ast.instanceCreationExpression( |
| 94 toAnalyzerToken(token), constructorName, arguments.argumentList)); |
| 95 } |
| 96 |
| 97 @override |
72 void handleParenthesizedExpression(BeginGroupToken token) { | 98 void handleParenthesizedExpression(BeginGroupToken token) { |
73 debugEvent("ParenthesizedExpression"); | 99 debugEvent("ParenthesizedExpression"); |
74 Expression expression = pop(); | 100 Expression expression = pop(); |
75 push(ast.parenthesizedExpression( | 101 push(ast.parenthesizedExpression( |
76 toAnalyzerToken(token), expression, toAnalyzerToken(token.endGroup))); | 102 toAnalyzerToken(token), expression, toAnalyzerToken(token.endGroup))); |
77 } | 103 } |
78 | 104 |
79 void handleStringPart(Token token) { | 105 void handleStringPart(Token token) { |
80 debugEvent("StringPart"); | 106 debugEvent("StringPart"); |
81 push(token); | 107 push(token); |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 } | 1427 } |
1402 | 1428 |
1403 /// Data structure placed on the stack to represent the keyword "operator" | 1429 /// Data structure placed on the stack to represent the keyword "operator" |
1404 /// followed by a token. | 1430 /// followed by a token. |
1405 class _OperatorName { | 1431 class _OperatorName { |
1406 final Token operatorKeyword; | 1432 final Token operatorKeyword; |
1407 final SimpleIdentifier name; | 1433 final SimpleIdentifier name; |
1408 | 1434 |
1409 _OperatorName(this.operatorKeyword, this.name); | 1435 _OperatorName(this.operatorKeyword, this.name); |
1410 } | 1436 } |
OLD | NEW |