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

Unified Diff: pkg/front_end/lib/src/fasta/target_implementation.dart

Issue 2913013003: Move enableNative to target, turn it on by default (Closed)
Patch Set: Created 3 years, 7 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/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 708795af65bb2c1722f76b4e9d4e9c4b58a04487..c2926f6bf291d2fa186a8ee3caf66f5bdf49525e 100644
--- a/pkg/front_end/lib/src/fasta/target_implementation.dart
+++ b/pkg/front_end/lib/src/fasta/target_implementation.dart
@@ -8,6 +8,8 @@ import 'package:kernel/target/targets.dart' as backend show Target;
import 'builder/builder.dart' show Builder, ClassBuilder, LibraryBuilder;
+import 'source/source_library_builder.dart' show SourceLibraryBuilder;
+
import 'parser/dart_vm_native.dart' as vm show skipNativeClause;
import '../scanner/token.dart' show Token;
@@ -88,6 +90,18 @@ 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
ahe 2017/05/31 09:07:50 I would really like to get this only enabled for d
Siggi Cherem (dart-lang) 2017/05/31 20:26:15 Done.
+ /// 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.
+ bool enableNative(SourceLibraryBuilder library) => true;
Siggi Cherem (dart-lang) 2017/05/30 20:33:59 currently I use SourceLibraryBuilder because this
ahe 2017/05/31 09:07:50 I'm not sure the builder hierarchies make a lot of
Siggi Cherem (dart-lang) 2017/05/31 14:25:43 I was hesitant too. The main reason I thought Sour
ahe 2017/05/31 14:31:25 That's up to you. An alternative is to do a type t
Siggi Cherem (dart-lang) 2017/05/31 20:26:14 turns out that dart2js doesn't have any `native` i
+
Token skipNativeClause(Token token) => vm.skipNativeClause(token);
String extractNativeMethodName(Token token) =>

Powered by Google App Engine
This is Rietveld 408576698