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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 _ParameterDefaultValue defaultValue = pop(); | 499 _ParameterDefaultValue defaultValue = pop(); |
500 SimpleIdentifier name = pop(); | 500 SimpleIdentifier name = pop(); |
501 TypeName type = pop(); | 501 TypeName type = pop(); |
502 Token keyword = _popOptionalSingleModifier(); | 502 Token keyword = _popOptionalSingleModifier(); |
503 pop(); // TODO(paulberry): Metadata. | 503 pop(); // TODO(paulberry): Metadata. |
504 // TODO(paulberry): handle covariant keyword. | 504 // TODO(paulberry): handle covariant keyword. |
505 | 505 |
506 FormalParameter node; | 506 FormalParameter node; |
507 if (thisKeyword == null) { | 507 if (thisKeyword == null) { |
508 node = ast.simpleFormalParameter( | 508 node = ast.simpleFormalParameter( |
509 null, null, toAnalyzerToken(keyword), type, name); | 509 null, null, null, toAnalyzerToken(keyword), type, name); |
510 } else { | 510 } else { |
511 // TODO(scheglov): Ideally the period token should be passed in. | 511 // TODO(scheglov): Ideally the period token should be passed in. |
512 Token period = identical('.', thisKeyword.next?.stringValue) | 512 Token period = identical('.', thisKeyword.next?.stringValue) |
513 ? thisKeyword.next | 513 ? thisKeyword.next |
514 : null; | 514 : null; |
515 TypeParameterList typeParameters; // TODO(scheglov) | 515 TypeParameterList typeParameters; // TODO(scheglov) |
516 FormalParameterList formalParameters; // TODO(scheglov) | 516 FormalParameterList formalParameters; // TODO(scheglov) |
517 node = ast.fieldFormalParameter( | 517 node = ast.fieldFormalParameter( |
518 null, | 518 null, |
519 null, | 519 null, |
| 520 null, |
520 toAnalyzerToken(keyword), | 521 toAnalyzerToken(keyword), |
521 type, | 522 type, |
522 toAnalyzerToken(thisKeyword), | 523 toAnalyzerToken(thisKeyword), |
523 toAnalyzerToken(period), | 524 toAnalyzerToken(period), |
524 name, | 525 name, |
525 typeParameters, | 526 typeParameters, |
526 formalParameters); | 527 formalParameters); |
527 } | 528 } |
528 | 529 |
529 if (defaultValue != null) { | 530 if (defaultValue != null) { |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 } | 1252 } |
1252 | 1253 |
1253 /// Data structure placed on the stack to represent the default parameter | 1254 /// Data structure placed on the stack to represent the default parameter |
1254 /// value with the separator token. | 1255 /// value with the separator token. |
1255 class _ParameterDefaultValue { | 1256 class _ParameterDefaultValue { |
1256 final Token separator; | 1257 final Token separator; |
1257 final Expression value; | 1258 final Expression value; |
1258 | 1259 |
1259 _ParameterDefaultValue(this.separator, this.value); | 1260 _ParameterDefaultValue(this.separator, this.value); |
1260 } | 1261 } |
OLD | NEW |