| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dev_compiler.src.testing; | 5 library dev_compiler.src.testing; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; | 9 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; |
| 10 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 /// testChecker({ | 42 /// testChecker({ |
| 43 /// '/main.dart': ''' | 43 /// '/main.dart': ''' |
| 44 /// testMethod() { | 44 /// testMethod() { |
| 45 /// dynamic x = /*warning:Box*/3; | 45 /// dynamic x = /*warning:Box*/3; |
| 46 /// } | 46 /// } |
| 47 /// ''' | 47 /// ''' |
| 48 /// }); | 48 /// }); |
| 49 /// | 49 /// |
| 50 CheckerResults testChecker(Map<String, String> testFiles, | 50 CheckerResults testChecker(Map<String, String> testFiles, |
| 51 {bool allowConstCasts: true, String sdkDir, CheckerReporter reporter, | 51 {bool allowConstCasts: true, String sdkDir, CheckerReporter reporter, |
| 52 covariantGenerics: true, relaxedCasts: true, inferFromOverrides: true, | 52 covariantGenerics: true, relaxedCasts: true, |
| 53 inferFromOverrides: ResolverOptions.INFER_FROM_OVERRIDES_DEFAULT, |
| 53 inferStaticsFromIdentifiers: false, inferInNonStableOrder: false, | 54 inferStaticsFromIdentifiers: false, inferInNonStableOrder: false, |
| 54 nonnullableTypes: TypeOptions.NONNULLABLE_TYPES}) { | 55 nonnullableTypes: TypeOptions.NONNULLABLE_TYPES}) { |
| 55 expect(testFiles.containsKey('/main.dart'), isTrue, | 56 expect(testFiles.containsKey('/main.dart'), isTrue, |
| 56 reason: '`/main.dart` is missing in testFiles'); | 57 reason: '`/main.dart` is missing in testFiles'); |
| 57 | 58 |
| 58 // Create a resolver that can load test files from memory. | 59 // Create a resolver that can load test files from memory. |
| 59 var testUriResolver = new TestUriResolver(testFiles); | 60 var testUriResolver = new TestUriResolver(testFiles); |
| 60 var options = new CompilerOptions( | 61 var options = new CompilerOptions( |
| 61 allowConstCasts: allowConstCasts, | 62 allowConstCasts: allowConstCasts, |
| 62 covariantGenerics: covariantGenerics, | 63 covariantGenerics: covariantGenerics, |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 321 |
| 321 SourceSpan spanFor(AstNode node) { | 322 SourceSpan spanFor(AstNode node) { |
| 322 final begin = node is AnnotatedNode | 323 final begin = node is AnnotatedNode |
| 323 ? node.firstTokenAfterCommentAndMetadata.offset | 324 ? node.firstTokenAfterCommentAndMetadata.offset |
| 324 : node.offset; | 325 : node.offset; |
| 325 return _file.span(begin, node.end); | 326 return _file.span(begin, node.end); |
| 326 } | 327 } |
| 327 | 328 |
| 328 String toString() => '[$runtimeType: $uri]'; | 329 String toString() => '[$runtimeType: $uri]'; |
| 329 } | 330 } |
| OLD | NEW |