ed64348f68
This CL introduces an alternative way to calculate scopes for expression evaluations. Currently the previous method is kept as well. What this does is that it: * Finds all nodes that match the offset and uri. (Ideally there's only one, but that's not always the case --- it's the case for less than 60% of cases in the test added actually). * Calculate the scope along the way. * Return the scopes of all the found nodes that offset. A test that asks for ~all file offsets in the dill files in the sdk and compares the result with the scope the binary serialization computes is added. A single point can't always be found (for all dills in the sdk only ~58.93% returns a single result), but for each query the wanted scope is among the results returned. For the non-outline dills in the sdk, between ~87.93% and ~94.52% of the results are either a single result or multiple results with the same actual scope in all of them. Note that the test asks for ~all offsets, not just "debuggable" or "stopable" offsets (which will likely vary depending on the vm/web backend etc) --- likely the percentage will be higher for those points though. When this returns multiple results one can likely be picked by the client based on information it has about names of variables in scope etc. Note that the test is rather slow, on my machine with the platforms available there it makes 3,908,181 queries in ~3.5 minutes. (Which corresponds to roughly 18,610 per second or under 0.06 ms per query on average though, so it doesn't seem like a concert for actually using it.) Change-Id: I40b5360fcd935c70629543737e89a787de36ca16 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332204 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Jens Johansen <jensj@google.com>