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

Unified Diff: pkg/compiler/lib/src/native/resolver.dart

Issue 2778803002: Move resolve* from NativeResolutionEnqueuer to NativeDataResolver (Closed)
Patch Set: Created 3 years, 9 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/compiler/lib/src/native/enqueue.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/native/resolver.dart
diff --git a/pkg/compiler/lib/src/native/resolver.dart b/pkg/compiler/lib/src/native/resolver.dart
index f6b60064bf0ef946ef36410136cafcc235fac100..557e9698c9920a6297f09a41a6aab771c43e52f6 100644
--- a/pkg/compiler/lib/src/native/resolver.dart
+++ b/pkg/compiler/lib/src/native/resolver.dart
@@ -25,6 +25,8 @@ import '../patch_parser.dart';
import '../tree/tree.dart';
import 'behavior.dart';
+/// Interface for computing native members and [NativeBehavior]s in member code
+/// based on the AST.
abstract class NativeDataResolver {
/// Returns `true` if [element] is a JsInterop member.
bool isJsInteropMember(MemberElement element);
@@ -32,6 +34,35 @@ abstract class NativeDataResolver {
/// Computes whether [element] is native or JsInterop and, if so, registers
/// its [NativeBehavior]s to [registry].
void resolveNativeMember(MemberElement element, NativeRegistry registry);
+
+ /// Computes the [NativeBehavior] for a `JS` call, which can be an
+ /// instantiation point for types.
+ ///
+ /// For example, the following code instantiates and returns native classes
+ /// that are `_DOMWindowImpl` or a subtype.
+ ///
+ /// JS('_DOMWindowImpl', 'window')
+ ///
+ NativeBehavior resolveJsCall(Send node, ForeignResolver resolver);
+
+ /// Computes the [NativeBehavior] for a `JS_EMBEDDED_GLOBAL` call, which can
+ /// be an instantiation point for types.
+ ///
+ /// For example, the following code instantiates and returns a String class
+ ///
+ /// JS_EMBEDDED_GLOBAL('String', 'foo')
+ ///
+ NativeBehavior resolveJsEmbeddedGlobalCall(
+ Send node, ForeignResolver resolver);
+
+ /// Computes the [NativeBehavior] for a `JS_BUILTIN` call, which can be an
+ /// instantiation point for types.
+ ///
+ /// For example, the following code instantiates and returns a String class
+ ///
+ /// JS_BUILTIN('String', 'int2string', 0)
+ ///
+ NativeBehavior resolveJsBuiltinCall(Send node, ForeignResolver resolver);
}
class NativeDataResolverImpl implements NativeDataResolver {
@@ -217,6 +248,25 @@ class NativeDataResolverImpl implements NativeDataResolver {
}
return name;
}
+
+ @override
+ NativeBehavior resolveJsCall(Send node, ForeignResolver resolver) {
+ return NativeBehavior.ofJsCallSend(node, _reporter,
+ _compiler.parsingContext, _compiler.commonElements, resolver);
+ }
+
+ @override
+ NativeBehavior resolveJsEmbeddedGlobalCall(
+ Send node, ForeignResolver resolver) {
+ return NativeBehavior.ofJsEmbeddedGlobalCallSend(
+ node, _reporter, _compiler.commonElements, resolver);
+ }
+
+ @override
+ NativeBehavior resolveJsBuiltinCall(Send node, ForeignResolver resolver) {
+ return NativeBehavior.ofJsBuiltinCallSend(
+ node, _reporter, _compiler.commonElements, resolver);
+ }
}
/// Check whether [cls] has a `@Native(...)` annotation, and if so, set its
« no previous file with comments | « pkg/compiler/lib/src/native/enqueue.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698