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

Unified Diff: lib/src/codegen/code_generator.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/codegen/code_generator.dart
diff --git a/lib/src/codegen/code_generator.dart b/lib/src/codegen/code_generator.dart
index ee16c93d75a1a2a3036cc6fdf8a0d71699d6ad54..9ecefaf416ae5dbcd135aa3aacbbf618235363eb 100644
--- a/lib/src/codegen/code_generator.dart
+++ b/lib/src/codegen/code_generator.dart
@@ -9,16 +9,35 @@ import 'dart:io';
import 'package:analyzer/src/generated/ast.dart' show CompilationUnit;
import 'package:analyzer/src/generated/element.dart'
show CompilationUnitElement, LibraryElement;
+import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
import 'package:path/path.dart' as path;
+import 'package:dev_compiler/devc.dart' show CompilerContext;
import 'package:dev_compiler/src/info.dart';
import 'package:dev_compiler/src/utils.dart' show canonicalLibraryName;
import 'package:dev_compiler/src/checker/rules.dart';
+import 'package:dev_compiler/src/options.dart';
abstract class CodeGenerator {
+ final CompilerContext compiler;
final String outDir;
final Uri root;
final TypeRules rules;
+ final AnalysisContext context;
+ final CompilerOptions options;
+
+ CodeGenerator(CompilerContext compiler)
+ : compiler = compiler,
+ outDir = path.absolute(compiler.options.outputDir),
+ root = compiler.entryPointUri,
+ rules = compiler.rules,
+ context = compiler.context,
+ options = compiler.options;
+
+ /// Return a hash, if any, that can be used for caching purposes. When two
+ /// invocations to this function return the same hash, the underlying
+ /// code-generator generated the same code.
+ String generateLibrary(LibraryUnit unit, LibraryInfo info);
static List<String> _searchPaths = () {
// TODO(vsm): Can we remove redundancy with multi_package_resolver logic?
@@ -124,12 +143,4 @@ abstract class CodeGenerator {
return new Uri(
scheme: 'package', path: path.joinAll(parts.sublist(index + 1)));
}
-
- CodeGenerator(String outDir, this.root, this.rules)
- : outDir = path.absolute(outDir);
-
- /// Return a hash, if any, that can be used for caching purposes. When two
- /// invocations to this function return the same hash, the underlying
- /// code-generator generated the same code.
- String generateLibrary(LibraryUnit unit, LibraryInfo info);
}

Powered by Google App Engine
This is Rietveld 408576698