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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 Token start, Token periodBeforeName, Token endToken) { | 75 Token start, Token periodBeforeName, Token endToken) { |
76 debugEvent("ConstructorReference"); | 76 debugEvent("ConstructorReference"); |
77 SimpleIdentifier constructorName = pop(); | 77 SimpleIdentifier constructorName = pop(); |
78 TypeArgumentList typeArguments = pop(); | 78 TypeArgumentList typeArguments = pop(); |
79 Identifier typeNameIdentifier = pop(); | 79 Identifier typeNameIdentifier = pop(); |
80 push(ast.constructorName(ast.typeName(typeNameIdentifier, typeArguments), | 80 push(ast.constructorName(ast.typeName(typeNameIdentifier, typeArguments), |
81 toAnalyzerToken(periodBeforeName), constructorName)); | 81 toAnalyzerToken(periodBeforeName), constructorName)); |
82 } | 82 } |
83 | 83 |
84 @override | 84 @override |
85 void handleConstExpression(Token token) { | 85 void endConstExpression(Token token) { |
86 debugEvent("ConstExpression"); | 86 debugEvent("ConstExpression"); |
87 _handleInstanceCreation(token); | 87 _handleInstanceCreation(token); |
88 } | 88 } |
89 | 89 |
90 void _handleInstanceCreation(Token token) { | 90 void _handleInstanceCreation(Token token) { |
91 MethodInvocation arguments = pop(); | 91 MethodInvocation arguments = pop(); |
92 ConstructorName constructorName = pop(); | 92 ConstructorName constructorName = pop(); |
93 push(ast.instanceCreationExpression( | 93 push(ast.instanceCreationExpression( |
94 toAnalyzerToken(token), constructorName, arguments.argumentList)); | 94 toAnalyzerToken(token), constructorName, arguments.argumentList)); |
95 } | 95 } |
96 | 96 |
97 @override | 97 @override |
98 void handleNewExpression(Token token) { | 98 void endNewExpression(Token token) { |
99 debugEvent("NewExpression"); | 99 debugEvent("NewExpression"); |
100 _handleInstanceCreation(token); | 100 _handleInstanceCreation(token); |
101 } | 101 } |
102 | 102 |
103 @override | 103 @override |
104 void handleParenthesizedExpression(BeginGroupToken token) { | 104 void handleParenthesizedExpression(BeginGroupToken token) { |
105 debugEvent("ParenthesizedExpression"); | 105 debugEvent("ParenthesizedExpression"); |
106 Expression expression = pop(); | 106 Expression expression = pop(); |
107 push(ast.parenthesizedExpression( | 107 push(ast.parenthesizedExpression( |
108 toAnalyzerToken(token), expression, toAnalyzerToken(token.endGroup))); | 108 toAnalyzerToken(token), expression, toAnalyzerToken(token.endGroup))); |
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 } else if (identical('static', s)) { | 1793 } else if (identical('static', s)) { |
1794 staticKeyword = token; | 1794 staticKeyword = token; |
1795 } else if (identical('var', s)) { | 1795 } else if (identical('var', s)) { |
1796 finalConstOrVarKeyword = token; | 1796 finalConstOrVarKeyword = token; |
1797 } else { | 1797 } else { |
1798 internalError('Unhandled modifier: $s'); | 1798 internalError('Unhandled modifier: $s'); |
1799 } | 1799 } |
1800 } | 1800 } |
1801 } | 1801 } |
1802 } | 1802 } |
OLD | NEW |