| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 import 'package:front_end/src/fasta/scanner.dart' | 5 import 'package:front_end/src/fasta/scanner.dart' show StringToken, Token; |
| 6 show BeginGroupToken, StringToken, Token; | |
| 7 import 'package:front_end/src/fasta/scanner.dart' as Tokens show EOF_TOKEN; | 6 import 'package:front_end/src/fasta/scanner.dart' as Tokens show EOF_TOKEN; |
| 7 import 'package:front_end/src/scanner/token.dart' show BeginToken; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common_elements.dart' show CommonElements, ElementEnvironment; | 10 import '../common_elements.dart' show CommonElements, ElementEnvironment; |
| 11 import '../common/backend_api.dart'; | 11 import '../common/backend_api.dart'; |
| 12 import '../common/resolution.dart'; | 12 import '../common/resolution.dart'; |
| 13 import '../compiler.dart' show Compiler; | 13 import '../compiler.dart' show Compiler; |
| 14 import '../constants/values.dart'; | 14 import '../constants/values.dart'; |
| 15 import '../elements/elements.dart' | 15 import '../elements/elements.dart' |
| 16 show | 16 show |
| 17 ClassElement, | 17 ClassElement, |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 // will slightly increase parse time and size and cause compiler errors and | 558 // will slightly increase parse time and size and cause compiler errors and |
| 559 // warnings to me emitted in more unused code. | 559 // warnings to me emitted in more unused code. |
| 560 | 560 |
| 561 // An alternative to this code is to extend the API of ClassElement to | 561 // An alternative to this code is to extend the API of ClassElement to |
| 562 // expose the name of the extended element. | 562 // expose the name of the extended element. |
| 563 | 563 |
| 564 // Pattern match the above cases in the token stream. | 564 // Pattern match the above cases in the token stream. |
| 565 // [abstract] class X extends [id.]* id | 565 // [abstract] class X extends [id.]* id |
| 566 | 566 |
| 567 Token skipTypeParameters(Token token) { | 567 Token skipTypeParameters(Token token) { |
| 568 BeginGroupToken beginGroupToken = token; | 568 BeginToken beginGroupToken = token; |
| 569 Token endToken = beginGroupToken.endGroup; | 569 Token endToken = beginGroupToken.endGroup; |
| 570 return endToken.next; | 570 return endToken.next; |
| 571 //for (;;) { | 571 //for (;;) { |
| 572 // token = token.next; | 572 // token = token.next; |
| 573 // if (token.stringValue == '>') return token.next; | 573 // if (token.stringValue == '>') return token.next; |
| 574 // if (token.stringValue == '<') return skipTypeParameters(token); | 574 // if (token.stringValue == '<') return skipTypeParameters(token); |
| 575 //} | 575 //} |
| 576 } | 576 } |
| 577 | 577 |
| 578 String scanForExtendsName(Token token) { | 578 String scanForExtendsName(Token token) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 | 615 |
| 616 Iterable<ConstantValue> fields = constructedObject.fields.values; | 616 Iterable<ConstantValue> fields = constructedObject.fields.values; |
| 617 // TODO(sra): Better validation of the constant. | 617 // TODO(sra): Better validation of the constant. |
| 618 if (fields.length != 1 || fields.single is! StringConstantValue) { | 618 if (fields.length != 1 || fields.single is! StringConstantValue) { |
| 619 throw new SpannableAssertionFailure( | 619 throw new SpannableAssertionFailure( |
| 620 spannable, 'Annotations needs one string: ${value.toStructuredText()}'); | 620 spannable, 'Annotations needs one string: ${value.toStructuredText()}'); |
| 621 } | 621 } |
| 622 StringConstantValue specStringConstant = fields.single; | 622 StringConstantValue specStringConstant = fields.single; |
| 623 return specStringConstant.primitiveValue; | 623 return specStringConstant.primitiveValue; |
| 624 } | 624 } |
| OLD | NEW |