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

Unified Diff: sdk/lib/_internal/compiler/implementation/native_handler.dart

Issue 11308257: - Parse the return type of JS during resolution to know what can be instantiated there. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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: sdk/lib/_internal/compiler/implementation/native_handler.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/native_handler.dart (revision 15508)
+++ sdk/lib/_internal/compiler/implementation/native_handler.dart (working copy)
@@ -56,7 +56,7 @@
*
*/
// TODO(sra): The entry from codegen will not have a resolver.
- void registerJsCall(Send node, ResolverVisitor resolver) {}
+ void registerJsCall(Send node, Enqueuer enqueuer, ResolverVisitor resolver) {}
sra1 2012/11/29 16:45:50 enqueuer already available in implementations as t
/// Emits a summary information using the [log] function.
void logSummary(log(message)) {}
@@ -218,9 +218,9 @@
flushQueue();
}
- void registerJsCall(Send node, ResolverVisitor resolver) {
+ void registerJsCall(Send node, Enqueuer enqueuer, ResolverVisitor resolver) {
processNativeBehavior(
- NativeBehavior.ofJsCall(node, compiler, resolver),
+ NativeBehavior.ofJsCall(node, compiler, enqueuer, resolver),
node);
flushQueue();
}
@@ -401,7 +401,8 @@
//NativeBehavior();
- static NativeBehavior ofJsCall(Send jsCall, Compiler compiler, resolver) {
+ static NativeBehavior ofJsCall(
+ Send jsCall, Compiler compiler, Enqueuer enqueuer, resolver) {
// The first argument of a JS-call is a string encoding various attributes
// of the code.
//
@@ -430,6 +431,13 @@
var type = _parseType(typeString, compiler,
(name) => resolver.resolveTypeFromString(name),
jsCall);
+ if (type == SpecialType.JsArray) {
+ enqueuer.registerInstantiatedClass(compiler.listClass);
sra1 2012/11/29 16:45:50 NativeBehavior is data. There should be no side e
ngeoffray 2012/11/30 11:30:00 Done.
+ } else if (type == SpecialType.JsObject) {
+ enqueuer.registerInstantiatedClass(compiler.objectClass);
+ } else if (type is InterfaceType) {
+ enqueuer.registerInstantiatedClass(type.element);
sra1 2012/11/29 16:45:50 I assume this is how 'int' gets instantiated. Is
ngeoffray 2012/11/30 11:30:00 Yeah, just unconditionally registering will lead t
+ }
behavior.typesInstantiated.add(type);
behavior.typesReturned.add(type);
}

Powered by Google App Engine
This is Rietveld 408576698