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

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

Issue 2675023002: Temporarily allow to import dart:io in client apps. (Closed)
Patch Set: cl comments Created 3 years, 10 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 | pkg/compiler/lib/src/resolved_uri_translator.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 d569bcdba7c004d9fd00336ebeaad3548362705d..e4368c2fb7f2cfb51d817a5ea48419dad6cb8ec4 100644
--- a/pkg/compiler/lib/src/apiimpl.dart
+++ b/pkg/compiler/lib/src/apiimpl.dart
@@ -222,7 +222,8 @@ class CompilerImpl extends Compiler {
.load(options.platformConfigUri, provider)
.then((Map<String, Uri> mapping) {
resolvedUriTranslator.resolvedUriTranslator =
- new ResolvedUriTranslator(mapping, reporter);
+ new ResolvedUriTranslator(
+ mapping, reporter, options.platformConfigUri);
});
});
}
@@ -392,6 +393,19 @@ class _Environment implements Environment {
}
return "true";
}
+
+ // Note: we return null on `dart:io` here, even if we allow users to
+ // unconditionally import it.
+ //
+ // In the past it was invalid to import `dart:io` for client apps. We just
+ // made it valid to import it as a stopgap measure to support packages like
+ // `http`. This is temporary until we support config-imports in the
+ // language.
+ //
+ // Because it is meant to be temporary and because the returned `dart:io`
+ // implementation will throw on most APIs, we still preserve that
+ // when compiling client apps the `dart:io` library is technically not
+ // supported, and so `const bool.fromEnvironment(dart.library.io)` is false.
return null;
}
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/resolved_uri_translator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698