Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| index 277be1e64bbff78bb51e8cc6782a6cef8886a738..8402d3c4699a9839a274febe9e111d8cbac76cf8 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| @@ -3133,23 +3133,26 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
| generateSuperNoSuchMethodSend(Send node) { |
| Selector selector = elements.getSelector(node); |
| - SourceString name = selector.name; |
| - |
| + String name = selector.invocationMirrorMemberName; |
| ClassElement cls = work.element.getEnclosingClass(); |
| + if (cls is ClosureClassElement) { |
| + ClosureClassElement closureClass = cls; |
| + cls = closureClass.methodElement.getEnclosingClass(); |
| + } |
| Element element = cls.lookupSuperMember(Compiler.NO_SUCH_METHOD); |
| if (element.enclosingElement.declaration != compiler.objectClass) { |
| // Register the call as dynamic if [:noSuchMethod:] on the super class |
| // is _not_ the default implementation from [:Object:]. |
| - compiler.enqueuer.codegen.registerDynamicInvocation(name, selector); |
| + compiler.enqueuer.codegen.registerDynamicInvocation(selector.name, |
| + selector); |
| } |
| HStatic target = new HStatic(element); |
| add(target); |
| HInstruction self = localsHandler.readThis(); |
| Constant nameConstant = constantSystem.createString( |
| - new DartString.literal(name.slowToString()), node); |
| + new DartString.literal(name), node); |
| - String internalName = backend.namer.instanceMethodInvocationName( |
| - currentLibrary, name, selector); |
| + String internalName = backend.namer.invocationMirrorInternalName(selector); |
| Constant internalNameConstant = |
| constantSystem.createString(new DartString.literal(internalName), node); |
| @@ -3209,7 +3212,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
| add(target); |
| var inputs = <HInstruction>[target, context]; |
| if (node.isPropertyAccess) { |
| - push(new HInvokeSuper(inputs)); |
| + push(new HInvokeSuper(inputs, isGetter: true)); |
| } else if (element.isFunction() || element.isGenerativeConstructor()) { |
| // TODO(5347): Try to avoid the need for calling [implementation] before |
| // calling [addStaticSendArgumentsToList]. |
| @@ -3217,7 +3220,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
| bool succeeded = addStaticSendArgumentsToList(selector, node.arguments, |
| function, inputs); |
| if (!succeeded) { |
| - generateWrongArgumentCountError(node, element, node.arguments); |
| + generateSuperNoSuchMethodSend(node); |
| } else { |
| push(new HInvokeSuper(inputs)); |
| } |
| @@ -3644,7 +3647,24 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
| } |
| Operator op = node.assignmentOperator; |
| if (node.isSuperCall) { |
| - if (element == null) return generateSuperNoSuchMethodSend(node); |
| + bool assignable = true; |
|
ngeoffray
2012/12/28 10:24:03
Maybe a Elements.isAssignable helper method could
Johnni Winther
2012/12/28 22:32:31
Done.
|
| + if (element == null) { |
| + assignable = false; |
| + } else if (element.isFunction()) { |
| + assignable = false; |
| + } else if (element.isField()) { |
| + if (element.modifiers.isFinalOrConst()) { |
| + assignable = false; |
| + } |
| + } else if (element.isAbstractField()) { |
| + AbstractFieldElement abstractFieldElement = element; |
| + if (abstractFieldElement.setter == null) { |
| + assignable = false; |
| + } |
| + } |
| + if (!assignable) { |
| + return generateSuperNoSuchMethodSend(node); |
| + } |
| HInstruction target = new HStatic(element); |
| HInstruction context = localsHandler.readThis(); |
| add(target); |