Index: pkg/fletchc/lib/src/fletch_compiler_implementation.dart |
diff --git a/pkg/fletchc/lib/src/fletch_compiler_implementation.dart b/pkg/fletchc/lib/src/fletch_compiler_implementation.dart |
index 8b905f2c0c9129f4326e739fa3b6a718a6d98782..f21e3dd04745ac5f14ad2be0a636a2b7de08cdc3 100644 |
--- a/pkg/fletchc/lib/src/fletch_compiler_implementation.dart |
+++ b/pkg/fletchc/lib/src/fletch_compiler_implementation.dart |
@@ -8,13 +8,15 @@ import 'dart:async' show |
EventSink; |
import 'package:sdk_library_metadata/libraries.dart' show |
- libraries, |
LibraryInfo; |
import 'package:compiler/compiler_new.dart' as api; |
import 'package:compiler/src/apiimpl.dart' as apiimpl; |
+import 'package:compiler/src/compiler.dart' show |
+ GlobalDependencyRegistry; |
+ |
import 'package:compiler/src/io/source_file.dart'; |
import 'package:compiler/src/source_file_provider.dart' show |
@@ -27,16 +29,17 @@ import 'package:compiler/src/elements/modelx.dart' show |
import 'package:compiler/compiler_new.dart' show |
CompilerOutput; |
-import 'package:compiler/src/util/uri_extras.dart' show |
- relativize; |
- |
-import 'package:compiler/src/dart2jslib.dart' show |
- CodegenRegistry, |
+import 'package:compiler/src/diagnostics/messages.dart' show |
Message, |
MessageKind, |
MessageTemplate; |
+import 'package:compiler/src/diagnostics/source_span.dart' show |
+ SourceSpan; |
+ |
+import 'package:compiler/src/diagnostics/diagnostic_listener.dart' show |
+ DiagnosticMessage; |
-import 'package:compiler/src/util/util.dart' show |
+import 'package:compiler/src/diagnostics/spannable.dart' show |
Spannable; |
import 'fletch_registry.dart' show |
@@ -51,8 +54,12 @@ import 'debug_info.dart'; |
import 'find_position_visitor.dart'; |
import 'fletch_context.dart'; |
+import 'fletch_enqueuer.dart' show |
+ FletchEnqueueTask; |
+ |
import '../fletch_system.dart'; |
+ |
ahe
2015/11/17 16:44:09
Extra line.
sigurdm
2015/11/19 14:33:47
Done.
|
const EXTRA_DART2JS_OPTIONS = const <String>[ |
// TODO(ahe): This doesn't completely disable type inference. Investigate. |
'--disable-type-inference', |
@@ -112,7 +119,7 @@ const Map<String, LibraryInfo> FLETCH_LIBRARIES = const { |
platforms: FLETCH_PLATFORM), |
}; |
-class FletchCompilerImplementation extends apiimpl.Compiler { |
+class FletchCompilerImplementation extends apiimpl.CompilerImpl { |
final Map<String, LibraryInfo> fletchLibraries = <String, LibraryInfo>{}; |
final Uri fletchVm; |
@@ -129,6 +136,9 @@ class FletchCompilerImplementation extends apiimpl.Compiler { |
// TODO(ahe): Clean this up and remove this. |
var helper; |
+ @override |
+ FletchEnqueueTask get enqueuer => super.enqueuer; |
+ |
FletchCompilerImplementation( |
api.CompilerInput provider, |
api.CompilerOutput outputProvider, |
@@ -144,9 +154,8 @@ class FletchCompilerImplementation extends apiimpl.Compiler { |
provider, outputProvider, handler, libraryRoot, null, |
EXTRA_DART2JS_OPTIONS.toList()..addAll(options), environment, |
packageConfig, null, FletchBackend.newInstance) { |
- CodegenRegistry global = globalDependencies; |
- globalDependencies = |
- new FletchRegistry(this, global.treeElements).asRegistry; |
+ GlobalDependencyRegistry global = globalDependencies; |
+ globalDependencies = new FletchRegistry(this, global).asRegistry; |
} |
bool get showPackageWarnings => true; |
@@ -160,50 +169,17 @@ class FletchCompilerImplementation extends apiimpl.Compiler { |
String fletchPatchLibraryFor(String name) => FLETCH_PATCHES[name]; |
- LibraryInfo lookupLibraryInfo(String name) { |
- return fletchLibraries.putIfAbsent(name, () { |
- // Let FLETCH_LIBRARIES shadow libraries. |
- if (FLETCH_LIBRARIES.containsKey(name)) { |
- return computeFletchLibraryInfo(name); |
- } |
- LibraryInfo info = libraries[name]; |
- if (info == null) { |
- return computeFletchLibraryInfo(name); |
- } |
- return new LibraryInfo( |
- info.path, |
- categories: info.categoriesString, |
- dart2jsPath: info.dart2jsPath, |
- dart2jsPatchPath: fletchPatchLibraryFor(name), |
- implementation: info.implementation, |
- documented: info.documented, |
- maturity: info.maturity, |
- platforms: info.platforms); |
- }); |
- } |
- |
- LibraryInfo computeFletchLibraryInfo(String name) { |
- LibraryInfo info = FLETCH_LIBRARIES[name]; |
- if (info == null) return null; |
- // Since this LibraryInfo is completely internal to Fletch, there's no need |
- // for dart2js extensions and patches. |
- assert(info.dart2jsPath == null); |
- assert(info.dart2jsPatchPath == null); |
- String path = relativize( |
- libraryRoot, patchRoot.resolve("lib/${info.path}"), false); |
- return new LibraryInfo( |
- '../$path', |
- categories: info.categoriesString, |
- implementation: info.implementation, |
- documented: info.documented, |
- maturity: info.maturity, |
- platforms: info.platforms); |
+ @override |
+ Uri lookupLibraryUri(String libraryName) { |
+ LibraryInfo info = FLETCH_LIBRARIES[libraryName]; |
+ if (info == null) return super.lookupLibraryUri(libraryName); |
+ return patchRoot.resolve("lib/${info.path}"); |
} |
Uri resolvePatchUri(String dartLibraryPath) { |
- String patchPath = lookupPatchPath(dartLibraryPath); |
+ String patchPath = fletchPatchLibraryFor(dartLibraryPath); |
if (patchPath == null) return null; |
- return patchRoot.resolve(patchPath); |
+ return patchRoot.resolve("lib/$patchPath"); |
} |
CompilationUnitElementX compilationUnitForUri(Uri uri) { |
@@ -266,13 +242,15 @@ class FletchCompilerImplementation extends apiimpl.Compiler { |
void reportVerboseInfo( |
Spannable node, |
- String message, |
+ String messageText, |
{bool forceVerbose: false}) { |
// TODO(johnniwinther): Use super.reportVerboseInfo once added. |
if (forceVerbose || verbose) { |
MessageTemplate template = MessageTemplate.TEMPLATES[MessageKind.GENERIC]; |
- reportDiagnostic( |
- node, template.message({'text': message}, true), api.Diagnostic.HINT); |
+ SourceSpan span = reporter.spanFromSpannable(node); |
+ Message message = template.message({'text': messageText}); |
+ reportDiagnostic(new DiagnosticMessage(span, node, message), |
+ [], api.Diagnostic.HINT); |
} |
} |
@@ -292,7 +270,7 @@ class FletchCompilerImplementation extends apiimpl.Compiler { |
messageKind = MessageKind.GENERIC; |
arguments = {'text': noMirrors}; |
} |
- super.reportError(node, messageKind, arguments); |
+ super.reporter.reportErrorMessage(node, messageKind, arguments); |
} |
} |