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

Unified Diff: pkg/compiler/lib/src/kernel/element_map.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/kernel/no_such_method_resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/kernel/element_map.dart
diff --git a/pkg/compiler/lib/src/kernel/element_map.dart b/pkg/compiler/lib/src/kernel/element_map.dart
index 16577f36c5b874efab4f130f4ddb7fe3b7dac829..d0f7fbc22bbd2367965d2a06b407eff4c24c0667 100644
--- a/pkg/compiler/lib/src/kernel/element_map.dart
+++ b/pkg/compiler/lib/src/kernel/element_map.dart
@@ -142,6 +142,10 @@ abstract class KernelToElementMap {
/// Computes the [ConstantValue] for the constant [expression].
ConstantValue getConstantValue(ir.Expression expression);
+
+ /// Returns the `noSuchMethod` [FunctionEntity] call from a
+ /// `super.noSuchMethod` invocation within [cls].
+ FunctionEntity getSuperNoSuchMethod(ClassEntity cls);
}
/// Kinds of foreign functions.
@@ -472,6 +476,31 @@ abstract class KernelToElementMapMixin implements KernelToElementMap {
type, metadata, typeLookup(resolveAsRaw: false),
isJsInterop: isJsInterop);
}
+
+ @override
+ FunctionEntity getSuperNoSuchMethod(ClassEntity cls) {
+ while (cls != null) {
+ cls = elementEnvironment.getSuperClass(cls);
+ MemberEntity member =
+ elementEnvironment.lookupClassMember(cls, Identifiers.noSuchMethod_);
+ if (member != null) {
+ if (member.isFunction) {
+ FunctionEntity function = member;
+ if (function.parameterStructure.positionalParameters >= 1) {
+ return function;
+ }
+ }
+ // If [member] is not a valid `noSuchMethod` the target is
+ // `Object.superNoSuchMethod`.
+ break;
+ }
+ }
+ FunctionEntity function = elementEnvironment.lookupClassMember(
+ commonElements.objectClass, Identifiers.noSuchMethod_);
+ assert(invariant(cls, function != null,
+ message: "No super noSuchMethod found for class $cls."));
+ return function;
+ }
}
/// Visitor that converts string literals and concatenations of string literals
« no previous file with comments | « no previous file | pkg/compiler/lib/src/kernel/no_such_method_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698