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

Unified Diff: lib/compiler/compiler.dart

Issue 10579019: First shot at source maps generation in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | « no previous file | lib/compiler/implementation/dart2js.dart » ('j') | lib/compiler/implementation/dart2js.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/compiler.dart
diff --git a/lib/compiler/compiler.dart b/lib/compiler/compiler.dart
index 4038fad3606ba13f5963af77807f6fcf7c9e30ca..3eb2d359fc251f79639a7c002019415c27a2ff93 100644
--- a/lib/compiler/compiler.dart
+++ b/lib/compiler/compiler.dart
@@ -6,6 +6,8 @@
#import('dart:uri');
#import('implementation/apiimpl.dart');
+#import('implementation/source_file.dart');
+#import('implementation/util/source_map_builder.dart');
// Unless explicitly allowed, passing null for any argument to the
// methods of library will result in a NullPointerException being
@@ -31,20 +33,29 @@ typedef Future<String> ReadUriFromString(Uri uri);
typedef void DiagnosticHandler(Uri uri, int begin, int end,
String message, bool fatal);
+class CompiledScript {
podivilov 2012/06/19 16:37:54 This is ugly, not sure how to return sourceMap fro
ahe 2012/06/19 17:00:41 Yes. Johnni will handle that. In the meantime, ho
podivilov 2012/06/20 09:37:14 Done.
+ String code;
+ String sourceMap;
+ CompiledScript(this.code, this.sourceMap);
+}
+
/**
* Returns [script] compiled to JavaScript. If the compilation fails,
* null is returned and [handler] will have been invoked at least once
* with [:fatal == true:].
*/
-Future<String> compile(Uri script,
- Uri libraryRoot,
- Uri packageRoot,
- ReadUriFromString provider,
- DiagnosticHandler handler,
- [List<String> options = const []]) {
+Future<CompiledScript> compile(Uri script,
+ Uri libraryRoot,
+ Uri packageRoot,
+ ReadUriFromString provider,
+ DiagnosticHandler handler,
+ [List<String> options = const []]) {
Compiler compiler = new Compiler(provider, handler, libraryRoot, packageRoot,
options);
compiler.run(script);
String code = compiler.assembledCode;
- return new Future.immediate(code);
+ SourceFile compiledFile = new SourceFile(null, code);
podivilov 2012/06/19 16:37:54 We could pass SourceMapListener interface/handler
+ String sourceMap = new SourceMapBuilder().build(
ahe 2012/06/19 17:00:41 This code does not belong here. I think the source
podivilov 2012/06/20 09:37:14 Done.
+ compiler.backend.emitter.sourceMappings, compiledFile);
+ return new Future.immediate(new CompiledScript(code, sourceMap));
}
« no previous file with comments | « no previous file | lib/compiler/implementation/dart2js.dart » ('j') | lib/compiler/implementation/dart2js.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698