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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 1678053002: Fix super noSuchMethod handling. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of ssa; 5 part of ssa;
6 6
7 class SsaFunctionCompiler implements FunctionCompiler { 7 class SsaFunctionCompiler implements FunctionCompiler {
8 final SsaCodeGeneratorTask generator; 8 final SsaCodeGeneratorTask generator;
9 final SsaBuilderTask builder; 9 final SsaBuilderTask builder;
10 final SsaOptimizerTask optimizer; 10 final SsaOptimizerTask optimizer;
(...skipping 4533 matching lines...) Expand 10 before | Expand all | Expand 10 after
4544 targetCanThrow: false) 4544 targetCanThrow: false)
4545 ..sourceInformation = sourceInformation); 4545 ..sourceInformation = sourceInformation);
4546 } 4546 }
4547 4547
4548 generateSuperNoSuchMethodSend(ast.Send node, 4548 generateSuperNoSuchMethodSend(ast.Send node,
4549 Selector selector, 4549 Selector selector,
4550 List<HInstruction> arguments) { 4550 List<HInstruction> arguments) {
4551 String name = selector.name; 4551 String name = selector.name;
4552 4552
4553 ClassElement cls = currentNonClosureClass; 4553 ClassElement cls = currentNonClosureClass;
4554 Element element = cls.lookupSuperMember(Identifiers.noSuchMethod_); 4554 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_);
4555 if (!Selectors.noSuchMethod_.signatureApplies(element)) {
4556 element = coreClasses.objectClass.lookupMember(Identifiers.noSuchMethod_);
4557 }
4555 if (compiler.enabledInvokeOn && !element.enclosingClass.isObject) { 4558 if (compiler.enabledInvokeOn && !element.enclosingClass.isObject) {
4556 // Register the call as dynamic if [noSuchMethod] on the super 4559 // Register the call as dynamic if [noSuchMethod] on the super
4557 // class is _not_ the default implementation from [Object], in 4560 // class is _not_ the default implementation from [Object], in
4558 // case the [noSuchMethod] implementation calls 4561 // case the [noSuchMethod] implementation calls
4559 // [JSInvocationMirror._invokeOn]. 4562 // [JSInvocationMirror._invokeOn].
4560 // TODO(johnniwinther): Register this more precisely. 4563 // TODO(johnniwinther): Register this more precisely.
4561 registry?.registerDynamicUse(new DynamicUse(selector, null)); 4564 registry?.registerDynamicUse(new DynamicUse(selector, null));
4562 } 4565 }
4563 String publicName = name; 4566 String publicName = name;
4564 if (selector.isSetter) publicName += '='; 4567 if (selector.isSetter) publicName += '=';
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
4684 4687
4685 @override 4688 @override
4686 void visitUnresolvedSuperGet( 4689 void visitUnresolvedSuperGet(
4687 ast.Send node, 4690 ast.Send node,
4688 Element element, 4691 Element element,
4689 _) { 4692 _) {
4690 handleUnresolvedSuperInvoke(node); 4693 handleUnresolvedSuperInvoke(node);
4691 } 4694 }
4692 4695
4693 @override 4696 @override
4697 void visitUnresolvedSuperSet(
4698 ast.Send node,
4699 Element element,
4700 ast.Node rhs,
4701 _) {
4702 handleUnresolvedSuperInvoke(node);
4703 }
4704
4705 @override
4694 void visitSuperSetterGet( 4706 void visitSuperSetterGet(
4695 ast.Send node, 4707 ast.Send node,
4696 MethodElement setter, 4708 MethodElement setter,
4697 _) { 4709 _) {
4698 handleUnresolvedSuperInvoke(node); 4710 handleUnresolvedSuperInvoke(node);
4699 } 4711 }
4700 4712
4701 @override 4713 @override
4702 void visitUnresolvedSuperInvoke( 4714 void visitUnresolvedSuperInvoke(
4703 ast.Send node, 4715 ast.Send node,
(...skipping 4524 matching lines...) Expand 10 before | Expand all | Expand 10 after
9228 if (unaliased is TypedefType) throw 'unable to unalias $type'; 9240 if (unaliased is TypedefType) throw 'unable to unalias $type';
9229 unaliased.accept(this, builder); 9241 unaliased.accept(this, builder);
9230 } 9242 }
9231 9243
9232 void visitDynamicType(DynamicType type, SsaBuilder builder) { 9244 void visitDynamicType(DynamicType type, SsaBuilder builder) {
9233 JavaScriptBackend backend = builder.compiler.backend; 9245 JavaScriptBackend backend = builder.compiler.backend;
9234 ClassElement cls = backend.helpers.DynamicRuntimeType; 9246 ClassElement cls = backend.helpers.DynamicRuntimeType;
9235 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 9247 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
9236 } 9248 }
9237 } 9249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698