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

Unified Diff: pkg/kernel/lib/target/targets.dart

Issue 2976543002: Reapply "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service."" (Closed)
Patch Set: fix Created 3 years, 5 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
Index: pkg/kernel/lib/target/targets.dart
diff --git a/pkg/kernel/lib/target/targets.dart b/pkg/kernel/lib/target/targets.dart
index c47c117fe972d1c61487e542d1d93fa44f648396..3227f012c7b72a3ae7ef275653378886a0a37049 100644
--- a/pkg/kernel/lib/target/targets.dart
+++ b/pkg/kernel/lib/target/targets.dart
@@ -121,6 +121,29 @@ abstract class Target {
void performGlobalTransformations(CoreTypes coreTypes, Program program,
{void logger(String msg)});
+ /// Whether a platform library may define a restricted type, such as `bool`,
+ /// `int`, `double`, `num`, and `String`.
+ ///
+ /// By default only `dart:core` may define restricted types, but some target
+ /// implementations override this.
+ bool mayDefineRestrictedType(Uri uri) =>
+ uri.scheme == 'dart' && uri.path == 'core';
+
+ /// Whether the `native` language extension is supported within [library].
+ ///
+ /// The `native` language extension is not part of the language specification,
+ /// it means something else to each target, and it is enabled under different
+ /// circumstances for each target implementation. For example, the VM target
+ /// enables it everywhere because of existing support for "dart-ext:" native
+ /// extensions, but targets like dart2js only enable it on the core libraries.
+ bool enableNative(Uri uri) => false;
+
+ /// There are two variants of the `native` language extension. The VM expects
+ /// the native token to be followed by string, whereas dart2js and DDC do not.
+ // TODO(sigmund, ahe): ideally we should remove the `native` syntax, if not,
+ // we should at least unify the VM and non-VM variants.
+ bool get nativeExtensionExpectsString => false;
+
/// Builds an expression that instantiates an [Invocation] that can be passed
/// to [noSuchMethod].
Expression instantiateInvocation(CoreTypes coreTypes, Expression receiver,

Powered by Google App Engine
This is Rietveld 408576698