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

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

Issue 1384523003: Refactor resolution of foreign calls. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/behavior.dart ('k') | pkg/compiler/lib/src/native/native.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/native/enqueue.dart
diff --git a/pkg/compiler/lib/src/native/enqueue.dart b/pkg/compiler/lib/src/native/enqueue.dart
index 25a4b26e5d00ed55f21a85af97f42ddf2a2986d3..a6d20fb37eb729ce51208e11fab741496cb697dc 100644
--- a/pkg/compiler/lib/src/native/enqueue.dart
+++ b/pkg/compiler/lib/src/native/enqueue.dart
@@ -34,42 +34,6 @@ class NativeEnqueuer {
/// Returns whether native classes are being used.
bool hasInstantiatedNativeClasses() => false;
- /**
- * Handles JS-calls, 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')
- *
- */
- // TODO(sra): The entry from codegen will not have a resolver.
- void registerJsCall(Send node, ResolverVisitor resolver) {}
-
- /**
- * Handles JS-embedded global calls, which can be an instantiation point for
- * types.
- *
- * For example, the following code instantiates and returns a String class
- *
- * JS_EMBEDDED_GLOBAL('String', 'foo')
- *
- */
- // TODO(sra): The entry from codegen will not have a resolver.
- void registerJsEmbeddedGlobalCall(Send node, ResolverVisitor resolver) {}
-
- /**
- * Handles JS-compiler builtin calls, which can be an instantiation point for
- * types.
- *
- * For example, the following code instantiates and returns a String class
- *
- * JS_BUILTIN('String', 'int2string', 0)
- *
- */
- // TODO(sra): The entry from codegen will not have a resolver.
- void registerJsBuiltinCall(Send node, ResolverVisitor resolver) {}
-
/// Emits a summary information using the [log] function.
void logSummary(log(message)) {}
@@ -489,26 +453,6 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
registerNativeBehavior(NativeBehavior.ofFieldStore(field, compiler), field);
}
- void registerJsCall(Send node, ResolverVisitor resolver) {
- NativeBehavior behavior = NativeBehavior.ofJsCall(node, compiler, resolver);
- registerNativeBehavior(behavior, node);
- nativeBehaviors[node] = behavior;
- }
-
- void registerJsEmbeddedGlobalCall(Send node, ResolverVisitor resolver) {
- NativeBehavior behavior =
- NativeBehavior.ofJsEmbeddedGlobalCall(node, compiler, resolver);
- registerNativeBehavior(behavior, node);
- nativeBehaviors[node] = behavior;
- }
-
- void registerJsBuiltinCall(Send node, ResolverVisitor resolver) {
- NativeBehavior behavior =
- NativeBehavior.ofJsBuiltinCall(node, compiler, resolver);
- registerNativeBehavior(behavior, node);
- nativeBehaviors[node] = behavior;
- }
-
NativeBehavior getNativeBehaviorOf(Send node) => nativeBehaviors[node];
processNativeBehavior(NativeBehavior behavior, cause) {
@@ -622,6 +566,55 @@ class NativeResolutionEnqueuer extends NativeEnqueuerBase {
log('Resolved ${registeredClasses.length} native elements used, '
'${unusedClasses.length} native elements dead.');
}
+
+ /**
+ * Handles JS-calls, 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')
+ *
+ */
+ void registerJsCall(Send node, ForeignResolver resolver) {
+ NativeBehavior behavior = NativeBehavior.ofJsCall(node, compiler, resolver);
+ registerNativeBehavior(behavior, node);
+ nativeBehaviors[node] = behavior;
+ }
+
+
+ /**
+ * Handles JS-embedded global calls, which can be an instantiation point for
+ * types.
+ *
+ * For example, the following code instantiates and returns a String class
+ *
+ * JS_EMBEDDED_GLOBAL('String', 'foo')
+ *
+ */
+ void registerJsEmbeddedGlobalCall(Send node, ForeignResolver resolver) {
+ NativeBehavior behavior =
+ NativeBehavior.ofJsEmbeddedGlobalCall(node, compiler, resolver);
+ registerNativeBehavior(behavior, node);
+ nativeBehaviors[node] = behavior;
+ }
+
+
+ /**
+ * Handles JS-compiler builtin calls, which can be an instantiation point for
+ * types.
+ *
+ * For example, the following code instantiates and returns a String class
+ *
+ * JS_BUILTIN('String', 'int2string', 0)
+ *
+ */
+ void registerJsBuiltinCall(Send node, ForeignResolver resolver) {
+ NativeBehavior behavior =
+ NativeBehavior.ofJsBuiltinCall(node, compiler, resolver);
+ registerNativeBehavior(behavior, node);
+ nativeBehaviors[node] = behavior;
+ }
}
« no previous file with comments | « pkg/compiler/lib/src/native/behavior.dart ('k') | pkg/compiler/lib/src/native/native.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698