Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(532)

Unified Diff: lib/src/testing.dart

Issue 1141013002: Fixes #179 -- compile error if editing files during server mode (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/src/testing.dart
diff --git a/lib/src/testing.dart b/lib/src/testing.dart
index b0014a5692c51c41460b8b297797ca613e568d0a..aa8ab8b640b99a2feb52819957dea15bd5e81c1e 100644
--- a/lib/src/testing.dart
+++ b/lib/src/testing.dart
@@ -6,7 +6,7 @@ library dev_compiler.src.testing;
import 'package:analyzer/src/generated/ast.dart';
import 'package:analyzer/src/generated/element.dart';
-import 'package:analyzer/src/generated/engine.dart' show TimestampedData;
+import 'package:analyzer/src/generated/engine.dart' show AnalysisContext, TimestampedData;
import 'package:analyzer/src/generated/source.dart';
import 'package:logging/logging.dart';
import 'package:path/path.dart' as path;
@@ -50,7 +50,8 @@ import 'dependency_graph.dart' show runtimeFilesForServerMode;
/// });
///
CheckerResults testChecker(Map<String, String> testFiles,
- {bool allowConstCasts: true, String sdkDir, CheckerReporter reporter,
+ {bool allowConstCasts: true, String sdkDir,
+ CheckerReporter createReporter(AnalysisContext context),
covariantGenerics: true, relaxedCasts: true,
inferDownwards: RulesOptions.inferDownwardsDefault,
inferFromOverrides: ResolverOptions.inferFromOverridesDefault,
@@ -80,11 +81,13 @@ CheckerResults testChecker(Map<String, String> testFiles,
otherResolvers: [testUriResolver])
: new TypeResolver.fromDir(sdkDir, options,
otherResolvers: [testUriResolver]);
+ var context = resolver.context;
// Run the checker on /main.dart.
var mainFile = new Uri.file('/main.dart');
- var checkExpectations = reporter == null;
- if (reporter == null) reporter = new TestReporter();
+ var checkExpectations = createReporter == null;
+ var reporter = (createReporter == null) ? new TestReporter(context) :
+ createReporter(context);
var results = new Compiler(options, resolver, reporter).run();
// Extract expectations from the comments in the test files.
@@ -145,6 +148,8 @@ class TestReporter extends SummaryReporter {
Map<Uri, Map<AstNode, List<StaticInfo>>> infoMap = {};
Uri _current;
+ TestReporter(AnalysisContext context) : super(context);
+
void enterLibrary(Uri uri) {
super.enterLibrary(uri);
infoMap[uri] = {};

Powered by Google App Engine
This is Rietveld 408576698