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

Unified Diff: pkg/compiler/lib/src/apiimpl.dart

Issue 745533002: Support native extensions for analysis and docgen. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/apiimpl.dart
diff --git a/pkg/compiler/lib/src/apiimpl.dart b/pkg/compiler/lib/src/apiimpl.dart
index a81aabc837a3e89c78c6acd9d4c75bee50c21a53..9b8923588e63029e9892dca6dd9c2594420cddf2 100644
--- a/pkg/compiler/lib/src/apiimpl.dart
+++ b/pkg/compiler/lib/src/apiimpl.dart
@@ -78,7 +78,9 @@ class Compiler extends leg.Compiler {
forceIncrementalSupport ||
hasOption(options, '--incremental-support'),
suppressWarnings: hasOption(options, '--suppress-warnings'),
- enableAsyncAwait: hasOption(options, '--enable-async')) {
+ enableAsyncAwait: hasOption(options, '--enable-async'),
+ allowNativeExtensions:
+ hasOption(options, '--allow-native-extensions')) {
tasks.addAll([
userHandlerTask = new leg.GenericTask('Diagnostic handler', this),
userProviderTask = new leg.GenericTask('Input provider', this),
@@ -89,9 +91,16 @@ class Compiler extends leg.Compiler {
if (packageRoot != null && !packageRoot.path.endsWith("/")) {
throw new ArgumentError("packageRoot must end with a /");
}
- if (enableAsyncAwait && !analyzeOnly) {
- throw new ArgumentError(
- "--enable-async is currently only supported with --analyze-only");
+ if (!analyzeOnly) {
+ if (enableAsyncAwait) {
+ throw new ArgumentError(
+ "--enable-async is currently only supported with --analyze-only");
+ }
+ if (allowNativeExtensions) {
+ throw new ArgumentError(
+ "--allow-native-extensions is only supported with in combination "
floitsch 2014/11/21 13:26:11 -with-
Johnni Winther 2014/11/21 13:51:15 Done.
+ "with --analyze-only");
+ }
}
}
@@ -194,12 +203,23 @@ class Compiler extends leg.Compiler {
}
Uri resourceUri = translateUri(node, readableUri);
+ String resourceUriString = resourceUri.toString();
+ if (resourceUri.scheme == 'dart-ext') {
+ if (!allowNativeExtensions) {
+ withCurrentElement(element, () {
+ reportError(node, leg.MessageKind.DART_EXT_NOT_SUPPORTED);
+ });
+ }
+ return new Future.value(new leg.Script(readableUri, resourceUri,
+ new StringSourceFile(resourceUriString,
+ "// Synthetic source file generated for '$readableUri'.")));
+ }
+
// TODO(johnniwinther): Wrap the result from [provider] in a specialized
// [Future] to ensure that we never execute an asynchronous action without
// setting up the current element of the compiler.
return new Future.sync(() => callUserProvider(resourceUri)).then((data) {
SourceFile sourceFile;
- String resourceUriString = resourceUri.toString();
if (data is List<int>) {
sourceFile = new Utf8BytesSourceFile(resourceUriString, data);
} else if (data is String) {
« no previous file with comments | « no previous file | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698