Files
sdk/runtime/vm
Martin Kustermann 587e6308bf [vm] Fix expression evaluation in context of closures
When evaluating an expressino at a breakpoint that's inside a closure,
the closure may refer to anything it closes over. That includes the
`this` from an enclosing method.

So depending on whether a closure's parent chain is an instance method
or a static method, the expression evaluation function is going to be an
instance method or a static method.

=> We walk up the parent chain to determine the correct enclosing class.
=> This avoids making a Type object with a cid from a top-level class (see [0])

Handling this correctly will now try to get the `this` when invoking an
eval function that has an enclosing instance method. Though we may often
have "<optimized out>" the `this` (e.g. due to not capturing it in
closure context chain).

=> We still allow running the expression evaluation function in this
case, but only if the expression being evaluated doesn't access `this`.

A similar issue occurs when trying to use variables in the eval
expression that the closure didn't capture. This results in a confusing
CFE compile-time error. This is a separate issue and tracked in [1].

=> We update the test to distinuish the cases that this CL makes passing
and those that are failing due to [1].

Fixes [0] https://github.com/dart-lang/sdk/issues/53061
See also [1] https://github.com/dart-lang/sdk/issues/53087

TEST=Fixes part of service/evaluate_activation_test failures

Change-Id: I3bb24e7338c7b2f12d5340311d944cb59a455641
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317540
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-08-04 11:07:46 +00:00
..
2023-03-06 22:06:59 +00:00
2023-03-06 22:06:59 +00:00
2023-06-28 01:00:18 +00:00
2023-06-28 01:00:18 +00:00
2023-06-28 01:00:18 +00:00
2023-01-20 12:37:49 +00:00
2023-06-28 01:00:18 +00:00
2023-06-28 01:00:18 +00:00
2023-06-28 01:00:18 +00:00
2023-06-28 01:00:18 +00:00
2023-06-23 20:35:00 +00:00
2023-06-23 20:35:00 +00:00
2023-06-23 20:35:00 +00:00
2023-06-23 20:35:00 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2023-06-23 20:35:00 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-09-12 12:33:57 +00:00
2022-09-12 12:33:57 +00:00
2023-03-29 18:11:49 +00:00
2023-06-23 20:35:00 +00:00
2022-01-20 00:57:57 +00:00
2023-06-30 14:03:03 +00:00
2023-04-28 19:29:36 +00:00
2022-12-29 10:18:02 +00:00
2023-06-28 01:00:18 +00:00
2023-06-28 01:00:18 +00:00
2023-01-06 07:48:22 +00:00
2022-07-29 18:11:01 +00:00
2023-04-12 22:18:54 +00:00
2023-03-06 22:06:59 +00:00
2023-01-09 15:48:57 +00:00
2023-06-23 20:35:00 +00:00
2023-06-28 01:00:18 +00:00
2022-09-10 15:12:35 +00:00
2023-04-21 22:41:28 +00:00