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

Unified Diff: dart/frog/leg/ssa/codegen.dart

Issue 9753007: Implement super-send to non-function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 8 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 | « dart/frog/leg/ssa/builder.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/ssa/codegen.dart
diff --git a/dart/frog/leg/ssa/codegen.dart b/dart/frog/leg/ssa/codegen.dart
index 0f58f29cd7a6ee9c84bf7f883acd856c5dddfdca..322cf34a1462e921f26f1a831d1798baf824c35c 100644
--- a/dart/frog/leg/ssa/codegen.dart
+++ b/dart/frog/leg/ssa/codegen.dart
@@ -638,8 +638,21 @@ class SsaCodeGenerator implements HVisitor {
// Remove the element and 'this'.
int argumentCount = node.inputs.length - 2;
String className = compiler.namer.isolatePropertyAccess(superClass);
- String methodName = compiler.namer.instanceMethodName(
- currentLibrary, superMethod.name, argumentCount);
+ String methodName;
+ if (superMethod.kind == ElementKind.FUNCTION ||
+ superMethod.kind == ElementKind.GENERATIVE_CONSTRUCTOR) {
+ methodName = compiler.namer.instanceMethodName(
+ currentLibrary, superMethod.name, argumentCount);
+ } else {
+ methodName = compiler.namer.getterName(currentLibrary, superMethod.name);
+ // We need to register the name to ensure that the emitter
+ // generates the necessary getter.
+ // TODO(ahe): This is not optimal for tree-shaking, but we lack
+ // API to register the precise information. In this case, the
+ // enclosingElement of superMethod needs the getter, no other
+ // class (not even its subclasses).
+ compiler.registerDynamicGetter(superMethod.name);
+ }
buffer.add('$className.prototype.$methodName.call');
visitArguments(node.inputs);
endExpression(JSPrecedence.CALL_PRECEDENCE);
« no previous file with comments | « dart/frog/leg/ssa/builder.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698