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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 SimpleIdentifier name = pop(); | 1060 SimpleIdentifier name = pop(); |
1061 push(ast.label(name, colon)); | 1061 push(ast.label(name, colon)); |
1062 } | 1062 } |
1063 | 1063 |
1064 void handleNoExpression(Token token) { | 1064 void handleNoExpression(Token token) { |
1065 debugEvent("NoExpression"); | 1065 debugEvent("NoExpression"); |
1066 push(NullValue.Expression); | 1066 push(NullValue.Expression); |
1067 } | 1067 } |
1068 | 1068 |
1069 void handleIndexedExpression( | 1069 void handleIndexedExpression( |
1070 Token openCurlyBracket, Token closeCurlyBracket) { | 1070 Token openSquareBracket, Token closeSquareBracket) { |
1071 debugEvent("IndexedExpression"); | 1071 debugEvent("IndexedExpression"); |
1072 Expression index = pop(); | 1072 Expression index = pop(); |
1073 Expression target = pop(); | 1073 Expression target = pop(); |
1074 if (target == null) { | 1074 if (target == null) { |
1075 CascadeExpression receiver = pop(); | 1075 CascadeExpression receiver = pop(); |
1076 Token token = peek(); | 1076 Token token = peek(); |
1077 push(receiver); | 1077 push(receiver); |
1078 IndexExpression expression = ast.indexExpressionForCascade( | 1078 IndexExpression expression = ast.indexExpressionForCascade( |
1079 token, openCurlyBracket, index, closeCurlyBracket); | 1079 token, openSquareBracket, index, closeSquareBracket); |
1080 assert(expression.isCascaded); | 1080 assert(expression.isCascaded); |
1081 push(expression); | 1081 push(expression); |
1082 } else { | 1082 } else { |
1083 push(ast.indexExpressionForTarget( | 1083 push(ast.indexExpressionForTarget( |
1084 target, openCurlyBracket, index, closeCurlyBracket)); | 1084 target, openSquareBracket, index, closeSquareBracket)); |
1085 } | 1085 } |
1086 } | 1086 } |
1087 | 1087 |
1088 @override | 1088 @override |
1089 void handleInvalidExpression(Token token) { | 1089 void handleInvalidExpression(Token token) { |
1090 debugEvent("InvalidExpression"); | 1090 debugEvent("InvalidExpression"); |
1091 } | 1091 } |
1092 | 1092 |
1093 @override | 1093 @override |
1094 void handleInvalidFunctionBody(Token token) { | 1094 void handleInvalidFunctionBody(Token token) { |
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 } else if (identical('var', s)) { | 2021 } else if (identical('var', s)) { |
2022 finalConstOrVarKeyword = token; | 2022 finalConstOrVarKeyword = token; |
2023 } else if (identical('covariant', s)) { | 2023 } else if (identical('covariant', s)) { |
2024 covariantKeyword = token; | 2024 covariantKeyword = token; |
2025 } else { | 2025 } else { |
2026 internalError('Unhandled modifier: $s'); | 2026 internalError('Unhandled modifier: $s'); |
2027 } | 2027 } |
2028 } | 2028 } |
2029 } | 2029 } |
2030 } | 2030 } |
OLD | NEW |