@@ -1039,6 +1039,10 @@ class BytecodeGenerator extends RecursiveVisitor {
1039
1039
1040
1040
late Library ? dartFfiLibrary = libraryIndex.tryGetLibrary ('dart:ffi' );
1041
1041
1042
+ // Selector for implicit dynamic calls 'foo(...)' where
1043
+ // variable 'foo' has type 'dynamic'.
1044
+ late final implicitCallName = Name ('implicit:call' );
1045
+
1042
1046
void _recordSourcePosition (int fileOffset) {
1043
1047
asm.currentSourcePosition = fileOffset;
1044
1048
maxSourcePosition = math.max (maxSourcePosition, fileOffset);
@@ -3128,12 +3132,13 @@ class BytecodeGenerator extends RecursiveVisitor {
3128
3132
3129
3133
@override
3130
3134
void visitDynamicInvocation (DynamicInvocation node) {
3131
- _genMethodInvocation (node, null );
3135
+ final targetName = node.isImplicitCall ? implicitCallName : node.name;
3136
+ _genMethodInvocation (node, null , targetName);
3132
3137
}
3133
3138
3134
3139
@override
3135
3140
void visitInstanceInvocation (InstanceInvocation node) {
3136
- _genMethodInvocation (node, node.interfaceTarget);
3141
+ _genMethodInvocation (node, node.interfaceTarget, node.name );
3137
3142
}
3138
3143
3139
3144
@override
@@ -3151,8 +3156,8 @@ class BytecodeGenerator extends RecursiveVisitor {
3151
3156
asm.emitSpecializedBytecode (Opcode .kEqualsNull);
3152
3157
}
3153
3158
3154
- void _genMethodInvocation (
3155
- InstanceInvocationExpression node, Procedure ? interfaceTarget) {
3159
+ void _genMethodInvocation (InstanceInvocationExpression node,
3160
+ Procedure ? interfaceTarget, Name targetName ) {
3156
3161
final Opcode ? opcode = recognizedMethods.specializedBytecodeFor (node);
3157
3162
if (opcode != null ) {
3158
3163
_genMethodInvocationUsingSpecializedBytecode (opcode, node);
@@ -3172,7 +3177,7 @@ class BytecodeGenerator extends RecursiveVisitor {
3172
3177
final argDesc =
3173
3178
objectTable.getArgDescHandleByArguments (args, hasReceiver: true );
3174
3179
3175
- _genInstanceCall (node, InvocationKind .method, interfaceTarget, node.name ,
3180
+ _genInstanceCall (node, InvocationKind .method, interfaceTarget, targetName ,
3176
3181
node.receiver, totalArgCount, argDesc);
3177
3182
}
3178
3183
0 commit comments