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

Side by Side Diff: pkg/compiler/lib/src/kernel/no_such_method_resolver.dart

Issue 2904493002: Use KernelToElementMap (more) directly in KernelSsaBuilder (Closed)
Patch Set: Created 3 years, 7 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 dart2js.kernel.element_map; 5 part of dart2js.kernel.element_map;
6 6
7 class KernelNoSuchMethodResolver implements NoSuchMethodResolver { 7 class KernelNoSuchMethodResolver implements NoSuchMethodResolver {
8 final KernelToElementMapImpl elementMap; 8 final KernelToElementMapImpl elementMap;
9 9
10 KernelNoSuchMethodResolver(this.elementMap); 10 KernelNoSuchMethodResolver(this.elementMap);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (body is ir.ReturnStatement) { 58 if (body is ir.ReturnStatement) {
59 expr = body.expression; 59 expr = body.expression;
60 } else if (body is ir.ExpressionStatement) { 60 } else if (body is ir.ExpressionStatement) {
61 expr = body.expression; 61 expr = body.expression;
62 } 62 }
63 return expr is ir.Throw; 63 return expr is ir.Throw;
64 } 64 }
65 65
66 @override 66 @override
67 FunctionEntity getSuperNoSuchMethod(FunctionEntity method) { 67 FunctionEntity getSuperNoSuchMethod(FunctionEntity method) {
68 ClassEntity cls = method.enclosingClass; 68 return elementMap.getSuperNoSuchMethod(method.enclosingClass);
69 while (cls != null) {
70 cls = _elementEnvironment.getSuperClass(cls);
71 MemberEntity member =
72 _elementEnvironment.lookupClassMember(cls, Identifiers.noSuchMethod_);
73 if (member != null) {
74 if (member.isFunction) {
75 FunctionEntity function = member;
76 if (function.parameterStructure.positionalParameters >= 1) {
77 return function;
78 }
79 }
80 // If [member] is not a valid `noSuchMethod` the target is
81 // `Object.superNoSuchMethod`.
82 break;
83 }
84 }
85 FunctionEntity function = _elementEnvironment.lookupClassMember(
86 _commonElements.objectClass, Identifiers.noSuchMethod_);
87 assert(invariant(method, function != null,
88 message: "No super noSuchMethod found for $method."));
89 return function;
90 } 69 }
91 } 70 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_map.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698