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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 void endLiteralSymbol(Token hashToken, int identifierCount) { | 437 void endLiteralSymbol(Token hashToken, int identifierCount) { |
438 debugEvent("LiteralSymbol"); | 438 debugEvent("LiteralSymbol"); |
439 List<analyzer.Token> components = new List<analyzer.Token>(identifierCount); | 439 List<analyzer.Token> components = new List<analyzer.Token>(identifierCount); |
440 for (int i = identifierCount - 1; i >= 0; i--) { | 440 for (int i = identifierCount - 1; i >= 0; i--) { |
441 SimpleIdentifier identifier = pop(); | 441 SimpleIdentifier identifier = pop(); |
442 components[i] = identifier.token; | 442 components[i] = identifier.token; |
443 } | 443 } |
444 push(ast.symbolLiteral(toAnalyzerToken(hashToken), components)); | 444 push(ast.symbolLiteral(toAnalyzerToken(hashToken), components)); |
445 } | 445 } |
446 | 446 |
| 447 @override |
| 448 void handleSuperExpression(Token token) { |
| 449 debugEvent("SuperExpression"); |
| 450 push(ast.superExpression(toAnalyzerToken(token))); |
| 451 } |
| 452 |
447 void handleType(Token beginToken, Token endToken) { | 453 void handleType(Token beginToken, Token endToken) { |
448 debugEvent("Type"); | 454 debugEvent("Type"); |
449 TypeArgumentList arguments = pop(); | 455 TypeArgumentList arguments = pop(); |
450 Identifier name = pop(); | 456 Identifier name = pop(); |
451 // TODO(paulberry,ahe): what if the type doesn't resolve to a class | 457 // TODO(paulberry,ahe): what if the type doesn't resolve to a class |
452 // element? Try to share code with BodyBuilder.builderToFirstExpression. | 458 // element? Try to share code with BodyBuilder.builderToFirstExpression. |
453 KernelClassElement cls = name.staticElement; | 459 KernelClassElement cls = name.staticElement; |
454 push(ast.typeName(name, arguments)..type = cls?.rawType); | 460 push(ast.typeName(name, arguments)..type = cls?.rawType); |
455 } | 461 } |
456 | 462 |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 | 1345 |
1340 /// Data structure placed on the stack as a container for optional parameters. | 1346 /// Data structure placed on the stack as a container for optional parameters. |
1341 class _OptionalFormalParameters { | 1347 class _OptionalFormalParameters { |
1342 final List<FormalParameter> parameters; | 1348 final List<FormalParameter> parameters; |
1343 final Token leftDelimiter; | 1349 final Token leftDelimiter; |
1344 final Token rightDelimiter; | 1350 final Token rightDelimiter; |
1345 | 1351 |
1346 _OptionalFormalParameters( | 1352 _OptionalFormalParameters( |
1347 this.parameters, this.leftDelimiter, this.rightDelimiter); | 1353 this.parameters, this.leftDelimiter, this.rightDelimiter); |
1348 } | 1354 } |
OLD | NEW |