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

Unified Diff: pkg/dev_compiler/web/web_command.dart

Issue 2757753002: Migrate DDC to the new analysis driver.
Patch Set: Rebase Created 3 years, 6 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 | « pkg/dev_compiler/tool/build_sdk.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/web/web_command.dart
diff --git a/pkg/dev_compiler/web/web_command.dart b/pkg/dev_compiler/web/web_command.dart
index 00da902503a2bea26c8ad7c2c1b1c46e2ea785ae..32ef21c020d415a511aadcce1e76312fb249ed9f 100644
--- a/pkg/dev_compiler/web/web_command.dart
+++ b/pkg/dev_compiler/web/web_command.dart
@@ -19,7 +19,6 @@ import 'package:analyzer/dart/element/element.dart'
import 'package:analyzer/file_system/file_system.dart' show ResourceUriResolver;
import 'package:analyzer/file_system/memory_file_system.dart'
show MemoryResourceProvider;
-import 'package:analyzer/src/context/context.dart' show AnalysisContextImpl;
import 'package:analyzer/src/summary/idl.dart' show PackageBundle;
import 'package:analyzer/src/summary/package_bundle_reader.dart'
show SummaryDataStore, InSummaryUriResolver, InSummarySource;
@@ -168,8 +167,6 @@ class WebCompileCommand extends Command {
resourceProvider: resourceProvider,
summaryData: summaryDataStore);
- var context = compiler.context as AnalysisContextImpl;
-
var compilerOptions = new CompilerOptions.fromArguments(argResults);
var resolveFn = (String url) {
@@ -232,7 +229,7 @@ class WebCompileCommand extends Command {
};
CompileModule compileFn = (String imports, String body, String libraryName,
- String existingLibrary, String fileName) {
+ String existingLibrary, String fileName) async {
// Instead of returning a single function, return a pair of functions.
// Create a new virtual File that contains the given Dart source.
String sourceCode;
@@ -242,12 +239,13 @@ class WebCompileCommand extends Command {
var dir = path.dirname(existingLibrary);
// Need to pull in all the imports from the existing library and
// re-export all privates as privates in this library.
- var source = context.sourceFactory.forUri(existingLibrary);
+ var source = compiler.driver.sourceFactory.forUri(existingLibrary);
if (source == null) {
throw "Unable to load source for library $existingLibrary";
}
- LibraryElement libraryElement = context.computeLibraryElement(source);
+ var unitResult = await compiler.driver.getUnitElement(source.fullName);
+ LibraryElement libraryElement = unitResult.element.library;
if (libraryElement == null) {
throw "Unable to get library element.";
}
@@ -300,7 +298,7 @@ class WebCompileCommand extends Command {
var unit = new BuildUnit(libraryName, "", [fileName], _moduleForLibrary);
- JSModuleFile module = compiler.compile(unit, compilerOptions);
+ JSModuleFile module = await compiler.compile(unit, compilerOptions);
var moduleCode = '';
if (module.isValid) {
« no previous file with comments | « pkg/dev_compiler/tool/build_sdk.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698