| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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:analyzer/src/fasta/token_utils.dart'; | 5 import 'package:analyzer/src/fasta/token_utils.dart'; |
| 6 import 'package:front_end/src/fasta/scanner/abstract_scanner.dart' |
| 7 show fastaSupportsGenericMethodComments; |
| 6 import 'package:front_end/src/fasta/scanner/error_token.dart' as fasta; | 8 import 'package:front_end/src/fasta/scanner/error_token.dart' as fasta; |
| 7 import 'package:front_end/src/fasta/scanner/keyword.dart' as fasta; | 9 import 'package:front_end/src/fasta/scanner/keyword.dart' as fasta; |
| 8 import 'package:front_end/src/fasta/scanner/string_scanner.dart' as fasta; | 10 import 'package:front_end/src/fasta/scanner/string_scanner.dart' as fasta; |
| 9 import 'package:front_end/src/fasta/scanner/token.dart' as fasta; | 11 import 'package:front_end/src/fasta/scanner/token.dart' as fasta; |
| 10 import 'package:front_end/src/fasta/scanner/token_constants.dart' as fasta; | 12 import 'package:front_end/src/fasta/scanner/token_constants.dart' as fasta; |
| 11 import 'package:front_end/src/scanner/errors.dart'; | 13 import 'package:front_end/src/scanner/errors.dart'; |
| 12 import 'package:front_end/src/scanner/token.dart'; | 14 import 'package:front_end/src/scanner/token.dart'; |
| 13 import 'package:test/test.dart'; | 15 import 'package:test/test.dart'; |
| 14 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 16 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 15 | 17 |
| 16 import 'scanner_test.dart'; | 18 import 'scanner_test.dart'; |
| 17 | 19 |
| 18 main() { | 20 main() { |
| 19 defineReflectiveSuite(() { | 21 defineReflectiveSuite(() { |
| 20 defineReflectiveTests(ScannerTest_Fasta); | 22 defineReflectiveTests(ScannerTest_Fasta); |
| 21 defineReflectiveTests(ScannerTest_Fasta_Direct); | 23 defineReflectiveTests(ScannerTest_Fasta_Direct); |
| 22 defineReflectiveTests(ScannerTest_Fasta_Roundtrip); | 24 defineReflectiveTests(ScannerTest_Fasta_Roundtrip); |
| 23 }); | 25 }); |
| 24 } | 26 } |
| 25 | 27 |
| 26 @reflectiveTest | 28 @reflectiveTest |
| 27 class ScannerTest_Fasta extends ScannerTestBase { | 29 class ScannerTest_Fasta extends ScannerTestBase { |
| 28 @override | 30 @override |
| 29 Token scanWithListener(String source, ErrorListener listener, | 31 Token scanWithListener(String source, ErrorListener listener, |
| 30 {bool genericMethodComments: false, | 32 {bool genericMethodComments: false, |
| 31 bool lazyAssignmentOperators: false}) { | 33 bool lazyAssignmentOperators: false}) { |
| 32 if (genericMethodComments) { | 34 if (genericMethodComments && !fastaSupportsGenericMethodComments) { |
| 33 // Fasta doesn't support generic method comments. | 35 // Fasta doesn't support generic method comments. |
| 34 // TODO(paulberry): once the analyzer toolchain no longer needs generic | 36 // TODO(paulberry): once the analyzer toolchain no longer needs generic |
| 35 // method comments, remove tests that exercise them. | 37 // method comments, remove tests that exercise them. |
| 36 fail('No generic method comment support in Fasta'); | 38 fail('No generic method comment support in Fasta'); |
| 37 } | 39 } |
| 38 // Note: Fasta always supports lazy assignment operators (`&&=` and `||=`), | 40 // Note: Fasta always supports lazy assignment operators (`&&=` and `||=`), |
| 39 // so we can ignore the `lazyAssignmentOperators` flag. | 41 // so we can ignore the `lazyAssignmentOperators` flag. |
| 40 // TODO(paulberry): once lazyAssignmentOperators are fully supported by | 42 // TODO(paulberry): once lazyAssignmentOperators are fully supported by |
| 41 // Dart, remove this flag. | 43 // Dart, remove this flag. |
| 42 var scanner = new fasta.StringScanner(source, includeComments: true); | 44 var scanner = new fasta.StringScanner(source, includeComments: true); |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 final ErrorListener _listener; | 518 final ErrorListener _listener; |
| 517 | 519 |
| 518 ToAnalyzerTokenStreamConverter_WithListener(this._listener); | 520 ToAnalyzerTokenStreamConverter_WithListener(this._listener); |
| 519 | 521 |
| 520 @override | 522 @override |
| 521 void reportError( | 523 void reportError( |
| 522 ScannerErrorCode errorCode, int offset, List<Object> arguments) { | 524 ScannerErrorCode errorCode, int offset, List<Object> arguments) { |
| 523 _listener.errors.add(new TestError(offset, errorCode, arguments)); | 525 _listener.errors.add(new TestError(offset, errorCode, arguments)); |
| 524 } | 526 } |
| 525 } | 527 } |
| OLD | NEW |