Index: pkg/kernel/lib/target/targets.dart |
diff --git a/pkg/kernel/lib/target/targets.dart b/pkg/kernel/lib/target/targets.dart |
index 7389dc073975ac9726a1db5356a3e626a9a70199..5618162b9a9070b2cc77b48c959e20cbe0f44798 100644 |
--- a/pkg/kernel/lib/target/targets.dart |
+++ b/pkg/kernel/lib/target/targets.dart |
@@ -114,6 +114,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, |