| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, | 52 covariantGenerics: true, relaxedCasts: true, |
| 53 inferFromOverrides: ResolverOptions.INFER_FROM_OVERRIDES_DEFAULT, | 53 inferFromOverrides: ResolverOptions.INFER_FROM_OVERRIDES_DEFAULT, |
| 54 inferStaticsFromIdentifiers: false, inferInNonStableOrder: false, | 54 inferStaticsFromIdentifiers: ResolverOptions.INFER_STATICS_FROM_IDENTIFIERS_
DEFAULT, |
| 55 inferInNonStableOrder: ResolverOptions.INFER_IN_NON_STABLE_ORDER, |
| 55 nonnullableTypes: TypeOptions.NONNULLABLE_TYPES}) { | 56 nonnullableTypes: TypeOptions.NONNULLABLE_TYPES}) { |
| 56 expect(testFiles.containsKey('/main.dart'), isTrue, | 57 expect(testFiles.containsKey('/main.dart'), isTrue, |
| 57 reason: '`/main.dart` is missing in testFiles'); | 58 reason: '`/main.dart` is missing in testFiles'); |
| 58 | 59 |
| 59 // Create a resolver that can load test files from memory. | 60 // Create a resolver that can load test files from memory. |
| 60 var testUriResolver = new TestUriResolver(testFiles); | 61 var testUriResolver = new TestUriResolver(testFiles); |
| 61 var options = new CompilerOptions( | 62 var options = new CompilerOptions( |
| 62 allowConstCasts: allowConstCasts, | 63 allowConstCasts: allowConstCasts, |
| 63 covariantGenerics: covariantGenerics, | 64 covariantGenerics: covariantGenerics, |
| 64 relaxedCasts: relaxedCasts, | 65 relaxedCasts: relaxedCasts, |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 322 |
| 322 SourceSpan spanFor(AstNode node) { | 323 SourceSpan spanFor(AstNode node) { |
| 323 final begin = node is AnnotatedNode | 324 final begin = node is AnnotatedNode |
| 324 ? node.firstTokenAfterCommentAndMetadata.offset | 325 ? node.firstTokenAfterCommentAndMetadata.offset |
| 325 : node.offset; | 326 : node.offset; |
| 326 return _file.span(begin, node.end); | 327 return _file.span(begin, node.end); |
| 327 } | 328 } |
| 328 | 329 |
| 329 String toString() => '[$runtimeType: $uri]'; | 330 String toString() => '[$runtimeType: $uri]'; |
| 330 } | 331 } |
| OLD | NEW |