Index: pkg/front_end/lib/src/fasta/target_implementation.dart |
diff --git a/pkg/front_end/lib/src/fasta/target_implementation.dart b/pkg/front_end/lib/src/fasta/target_implementation.dart |
index 4bf7ed8dfea85b29e4ce14cf8eb17d80f70687f2..58781f6c1f174de970228bfff5e244d876dff0c6 100644 |
--- a/pkg/front_end/lib/src/fasta/target_implementation.dart |
+++ b/pkg/front_end/lib/src/fasta/target_implementation.dart |
@@ -8,8 +8,14 @@ import 'package:kernel/target/targets.dart' as backend show Target; |
import 'builder/builder.dart' show Builder, ClassBuilder, LibraryBuilder; |
+import 'parser/dart_vm_native.dart' as vm show skipNativeClause; |
+ |
+import '../scanner/token.dart' show Token; |
+ |
import 'loader.dart' show Loader; |
+import 'quote.dart' show unescapeString; |
+ |
import 'target.dart' show Target; |
import 'ticker.dart' show Ticker; |
@@ -96,6 +102,25 @@ abstract class TargetImplementation extends Target { |
} |
} |
+ /// Whether the `native` language extension is supported within [library]. |
+ /// |
+ /// The `native` language extension is not part of the language specification, |
+ /// means something else to each target, and is enabled differently 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. |
+ /// |
+ /// This default implementation assumes a VM target, but it can be overriden |
+ /// in subclasses to change the behavior. |
+ // TODO(sigmund,ahe): limit this to `dart-ext` libraries only (see |
+ // https://github.com/dart-lang/sdk/issues/29763). |
+ bool enableNative(LibraryBuilder library) => true; |
+ |
+ Token skipNativeClause(Token token) => vm.skipNativeClause(token); |
+ |
+ String extractNativeMethodName(Token token) => |
+ unescapeString(token.next.lexeme); |
+ |
void addSourceInformation( |
Uri uri, List<int> lineStarts, List<int> sourceCode); |