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

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
« no previous file with comments | « lib/src/report.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/testing.dart
diff --git a/lib/src/testing.dart b/lib/src/testing.dart
index 4c83c567d22f3152e38bced33938722e19ef61d0..9ef50d0da35e935f36d0ecc01cc6dbb6d3b3cd66 100644
--- a/lib/src/testing.dart
+++ b/lib/src/testing.dart
@@ -6,7 +6,8 @@ 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;
@@ -51,7 +52,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,
@@ -81,11 +83,14 @@ 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: resolver, reporter: reporter).run();
@@ -147,6 +152,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] = {};
« no previous file with comments | « lib/src/report.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698