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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart

Issue 11688010: NoSuchMethod on different super accesses/invocations handled. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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/ssa/codegen.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
index ffab93a9846d3692d28e8fd0fb98c52bd8848836..da57fe07026b264b93e75bb6a527c2ef306df6da 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -1677,7 +1677,7 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
visitInvokeSuper(HInvokeSuper node) {
Element superMethod = node.element;
Element superClass = superMethod.getEnclosingClass();
- if (superMethod.kind == ElementKind.FIELD) {
+ if (superMethod.isField()) {
ClassElement currentClass = work.element.getEnclosingClass();
if (currentClass.isClosure()) {
ClosureClassElement closure = currentClass;
@@ -1701,25 +1701,38 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
push(access, node);
}
} else {
+ bool isPropertyAccess = false;
String methodName;
- if (superMethod.kind == ElementKind.FUNCTION ||
- superMethod.kind == ElementKind.GENERATIVE_CONSTRUCTOR) {
- methodName = backend.namer.instanceMethodName(superMethod);
- } else if (superMethod.kind == ElementKind.GETTER) {
+ if (superMethod.isGetter()) {
methodName =
backend.namer.getterName(currentLibrary, superMethod.name);
- } else {
- assert(superMethod.kind == ElementKind.SETTER);
+ } else if (node.isSetter || superMethod.isSetter()) {
methodName =
backend.namer.setterName(currentLibrary, superMethod.name);
+ } else if (superMethod.isFunction() ||
+ superMethod.isGenerativeConstructor()) {
+ if (node.isGetter) {
+ methodName =
+ backend.namer.getterName(currentLibrary, superMethod.name);
+ isPropertyAccess = true;
+ } else {
+ methodName = backend.namer.instanceMethodName(superMethod);
+ }
}
String className = backend.namer.isolateAccess(superClass);
js.VariableUse classReference = new js.VariableUse(className);
js.PropertyAccess prototype =
new js.PropertyAccess.field(classReference, "prototype");
- js.PropertyAccess method =
- new js.PropertyAccess.field(prototype, methodName);
- push(jsPropertyCall(method, "call", visitArguments(node.inputs)), node);
+ if (isPropertyAccess) {
+ // Property access of a function. Obtain the bound closure instead of
+ // invoking the function.
+ push(jsPropertyCall(prototype, methodName,
+ visitArguments(node.inputs)), node);
+ } else {
+ js.PropertyAccess method =
+ new js.PropertyAccess.field(prototype, methodName);
+ push(jsPropertyCall(method, "call", visitArguments(node.inputs)), node);
+ }
}
world.registerStaticUse(superMethod);
}

Powered by Google App Engine
This is Rietveld 408576698