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

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

Issue 2695633002: Annotate native methods. (Closed)
Patch Set: 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 | « pkg/front_end/lib/src/fasta/source/source_loader.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f2e2defe1c7a3b410f236bfb6b768fe89bfe6511..e03738c93af27460ad680ecc9046054860f9dfc1 100644
--- a/pkg/front_end/lib/src/fasta/target_implementation.dart
+++ b/pkg/front_end/lib/src/fasta/target_implementation.dart
@@ -25,6 +25,7 @@ import 'translate_uri.dart' show
abstract class TargetImplementation extends Target {
final TranslateUri uriTranslator;
Builder cachedCompileTimeError;
+ Builder cachedNativeAnnotation;
TargetImplementation(Ticker ticker, this.uriTranslator)
: super(ticker);
@@ -54,4 +55,13 @@ abstract class TargetImplementation extends Target {
return cachedCompileTimeError =
loader.coreLibrary.getConstructor("_CompileTimeError", isPrivate: true);
}
+
+ /// Returns a reference to the constructor used for creating `native`
+ /// annotations. The constructor is expected to accept a single argument of
+ /// type String, which is the name of the native method.
+ Builder getNativeAnnotation(Loader loader) {
+ if (cachedNativeAnnotation != null) return cachedNativeAnnotation;
+ LibraryBuilder internal = loader.read(Uri.parse("dart:_internal"));
+ return cachedNativeAnnotation = internal.getConstructor("ExternalName");
+ }
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/source_loader.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698