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..1d4526a9b52ca88caeae7c37c25f3b7b18d64764 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 AbstractCompiler; |
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 AbstractCompiler compiler; |
final String outDir; |
final Uri root; |
final TypeRules rules; |
+ final AnalysisContext context; |
+ final CompilerOptions options; |
+ |
+ CodeGenerator(AbstractCompiler 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); |
} |