| 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..ebc7cec37798c9823a032b33ed547f79bae18f36 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 in combination 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) {
|
|
|