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

Unified Diff: dart/lib/compiler/implementation/dart2js.dart

Issue 10151014: Run dart2js directly from test.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 8 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 | dart/tools/testing/dart/test_suite.dart » ('j') | dart/tools/testing/dart/test_suite.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/lib/compiler/implementation/dart2js.dart
diff --git a/dart/lib/compiler/implementation/dart2js.dart b/dart/lib/compiler/implementation/dart2js.dart
index fb84a947503d18192946a28c076d82507634c0e6..facb3c357d11f1cb6f747163d98f0961f1a3b405 100644
--- a/dart/lib/compiler/implementation/dart2js.dart
+++ b/dart/lib/compiler/implementation/dart2js.dart
@@ -21,6 +21,7 @@ void compile(List<String> argv) {
bool verbose = false;
Uri libraryRoot = cwd;
Uri out = cwd.resolve('out.js');
+ List<String> options = new List<String>();
List<String> arguments = <String>[];
for (String argument in argv) {
@@ -39,18 +40,20 @@ void compile(List<String> argv) {
String path =
nativeToUriPath(argument.substring(argument.indexOf('=') + 1));
out = cwd.resolve(path);
+ } else if (argument == '--allow-mock-compilation') {
Bill Hesse 2012/04/25 12:46:26 constant on RHS of comparison disagrees with above
ahe 2012/04/25 13:49:41 Done.
+ options.add(argument);
} else if (argument.startsWith('-')) {
- throw new AbortLeg('unknown option $argument');
+ fail('Unknown option $argument.');
} else {
arguments.add(nativeToUriPath(argument));
}
}
if (arguments.isEmpty()) {
- throw new AbortLeg('no files to compile');
+ fail('No files to compile.');
ngeoffray 2012/04/25 12:24:54 No files -> No file
ahe 2012/04/25 13:49:41 Done.
}
if (arguments.length > 1) {
var extra = arguments.getRange(1, arguments.length - 1);
- throw new AbortLeg('extra arguments: $extra');
+ fail('Extra arguments: $extra.');
}
Map<String, SourceFile> sourceFiles = <SourceFile>{};
@@ -93,8 +96,10 @@ void compile(List<String> argv) {
// TODO(ahe): We expect the future to be complete and call value
// directly. In effect, we don't support truly asynchronous API.
- String code = api.compile(uri, libraryRoot, provider, handler).value;
- if (code === null) throw new AbortLeg('compilation failed');
+ String code = api.compile(uri, libraryRoot, provider, handler, options).value;
+ if (code === null) {
+ fail('Compilation failed.');
+ }
writeString(out, code);
int jsBytesWritten = code.length;
info('compiled $dartBytesRead bytes Dart -> $jsBytesWritten bytes JS '
@@ -109,7 +114,7 @@ class AbortLeg {
void writeString(Uri uri, String text) {
if (uri.scheme != 'file') {
- throw new AbortLeg('unhandled scheme ${uri.scheme}');
+ fail('Unhandled scheme ${uri.scheme}.');
}
var file = new File(uriPathToNative(uri.path)).openSync(FileMode.WRITE);
file.writeStringSync(text);
@@ -124,3 +129,8 @@ String readAll(String filename) {
file.closeSync();
return new String.fromCharCodes(new Utf8Decoder(buffer).decodeRest());
}
+
+void fail(String message) {
+ print(message);
+ exit(1);
+}
« no previous file with comments | « no previous file | dart/tools/testing/dart/test_suite.dart » ('j') | dart/tools/testing/dart/test_suite.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698