Skip to content

Commit 30b530b

Browse files
nshahanCommit Queue
authored and
Commit Queue
committed
[ddc] Handle Object members on extension types
Erase extension types when deciding to dispatch directly or to a helper method for Object members. Issue: #49735 Change-Id: I31081bf4ec64a0f667c8d40b08b94773e229ebe1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335601 Reviewed-by: Srujan Gaddam <[email protected]> Commit-Queue: Nicholas Shahan <[email protected]>
1 parent 2b4b9cb commit 30b530b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/dev_compiler/lib/src/kernel/compiler.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -5434,7 +5434,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
54345434
/// members at runtime.
54355435
bool _shouldCallObjectMemberHelper(Expression e) {
54365436
if (isNullable(e)) return true;
5437-
var type = e.getStaticType(_staticTypeContext);
5437+
var type = e.getStaticType(_staticTypeContext).extensionTypeErasure;
54385438
if (type is RecordType || type is FunctionType) return false;
54395439
if (type is InterfaceType) {
54405440
// TODO(nshahan): This could be expanded to any classes where we know all
@@ -5460,7 +5460,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
54605460
/// This is a simple approach and not an exhaustive search.
54615461
bool _triviallyConstNoInterop(Expression? e) {
54625462
if (e is ConstantExpression) {
5463-
var type = e.constant.getType(_staticTypeContext);
5463+
var type = e.constant.getType(_staticTypeContext).extensionTypeErasure;
54645464
if (type is InterfaceType) return !usesJSInterop(type.classNode);
54655465
} else if (e is StaticGet && e.target.isConst) {
54665466
var target = e.target;

0 commit comments

Comments
 (0)