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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 Expression condition = pop(); | 484 Expression condition = pop(); |
485 push(ast.conditionalExpression(condition, toAnalyzerToken(question), | 485 push(ast.conditionalExpression(condition, toAnalyzerToken(question), |
486 thenExpression, toAnalyzerToken(colon), elseExpression)); | 486 thenExpression, toAnalyzerToken(colon), elseExpression)); |
487 } | 487 } |
488 | 488 |
489 void endThrowExpression(Token throwToken, Token endToken) { | 489 void endThrowExpression(Token throwToken, Token endToken) { |
490 debugEvent("ThrowExpression"); | 490 debugEvent("ThrowExpression"); |
491 push(ast.throwExpression(toAnalyzerToken(throwToken), pop())); | 491 push(ast.throwExpression(toAnalyzerToken(throwToken), pop())); |
492 } | 492 } |
493 | 493 |
494 void endFormalParameter(Token thisKeyword) { | 494 void endFormalParameter(Token thisKeyword, Token period) { |
495 debugEvent("FormalParameter"); | 495 debugEvent("FormalParameter"); |
496 if (thisKeyword != null) { | |
497 internalError("'this' can't be used here."); | |
498 } | |
499 SimpleIdentifier name = pop(); | 496 SimpleIdentifier name = pop(); |
500 TypeName type = pop(); | 497 TypeName type = pop(); |
501 Token keyword = _popOptionalSingleModifier(); | 498 Token keyword = _popOptionalSingleModifier(); |
502 pop(); // Metadata. | 499 pop(); // Metadata. |
503 SimpleFormalParameter node = ast.simpleFormalParameter( | 500 |
504 null, null, toAnalyzerToken(keyword), type, name); | 501 FormalParameter node; |
| 502 if (thisKeyword == null) { |
| 503 node = ast.simpleFormalParameter( |
| 504 null, null, toAnalyzerToken(keyword), type, name); |
| 505 } else { |
| 506 TypeParameterList typeParameters; // TODO(scheglov) |
| 507 FormalParameterList formalParameters; // TODO(scheglov) |
| 508 node = ast.fieldFormalParameter( |
| 509 null, |
| 510 null, |
| 511 toAnalyzerToken(keyword), |
| 512 type, |
| 513 toAnalyzerToken(thisKeyword), |
| 514 toAnalyzerToken(period), |
| 515 name, |
| 516 typeParameters, |
| 517 formalParameters); |
| 518 } |
| 519 |
505 scope[name.name] = name.staticElement = new AnalyzerParameterElement(node); | 520 scope[name.name] = name.staticElement = new AnalyzerParameterElement(node); |
506 push(node); | 521 push(node); |
507 } | 522 } |
508 | 523 |
509 void endFormalParameters(int count, Token beginToken, Token endToken) { | 524 void endFormalParameters(int count, Token beginToken, Token endToken) { |
510 debugEvent("FormalParameters"); | 525 debugEvent("FormalParameters"); |
511 List<FormalParameter> parameters = popList(count) ?? <FormalParameter>[]; | 526 List<FormalParameter> parameters = popList(count) ?? <FormalParameter>[]; |
512 push(ast.formalParameterList(toAnalyzerToken(beginToken), parameters, null, | 527 push(ast.formalParameterList(toAnalyzerToken(beginToken), parameters, null, |
513 null, toAnalyzerToken(endToken))); | 528 null, toAnalyzerToken(endToken))); |
514 } | 529 } |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 /// [ClassDeclaration] or [ClassTypeAlias] object. | 1180 /// [ClassDeclaration] or [ClassTypeAlias] object. |
1166 class _MixinApplication { | 1181 class _MixinApplication { |
1167 final TypeName supertype; | 1182 final TypeName supertype; |
1168 | 1183 |
1169 final Token withKeyword; | 1184 final Token withKeyword; |
1170 | 1185 |
1171 final List<TypeName> mixinTypes; | 1186 final List<TypeName> mixinTypes; |
1172 | 1187 |
1173 _MixinApplication(this.supertype, this.withKeyword, this.mixinTypes); | 1188 _MixinApplication(this.supertype, this.withKeyword, this.mixinTypes); |
1174 } | 1189 } |
OLD | NEW |