Closed
Description
As a follow-up to #51115 and in hopes to ease the pain of #36983 (#36983 (comment)) the message should refer to local variables that are on the path to captured context.
So the example generated exception should reference variable x
:
$ cat s.dart
import 'dart:isolate';
foo() {
final x = RawReceivePort();
RawReceivePort().sendPort.send(() => print("$x"));
}
main() {
foo();
}
$ out/ReleaseX64/dart s.dart
Unhandled exception:
Invalid argument(s): Illegal argument in isolate message: (object is a ReceivePort)
<- Context num_variables: 1
<- Closure: () => void (from dart:core)
#0 _SendPort._sendInternal (dart:isolate-patch/isolate_patch.dart:244:43)
#1 _SendPort.send (dart:isolate-patch/isolate_patch.dart:225:5)
#2 foo (file:///usr/local/google/home/aam/p/d/dart-sdk/sdk/s.dart:5:29)
#3 main (file:///usr/local/google/home/aam/p/d/dart-sdk/sdk/s.dart:9:4)
#4 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:291:19)
#5 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)