66646f312c
First, change LocationForPosition and TokenRangeAtLine to return whether they successfully located the offset/line. Also change the wrappers in Script (GetTokenLocation and TokenRangeAtLine) to return whether or not any information was successfully located. These methods now only change the out parameters in the case that appropriate information was found, so any unconditional uses of the out parameters need the out parameters to be appropriately initialized. We now allow negative lines to be requested in TokenRangeAtLine (with the failure behavior described above) so the line returned by LocationAtPosition can be fed into TokenRangeAtLine without intermediate checking. The calculation of the token length, which uses the script source and not the line starts array, has been moved to a new method, Script::GetTokenLength. The new method returns the length (or a negative value if the token length could not be determined) instead of using an out parameter. TEST=Existing tests on trybots, to ensure tests using current line/number info aren't affected. Bug: https://github.com/dart-lang/sdk/issues/44436 Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-product-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try Change-Id: Ibc048a226d11ff9a340a8d249654d07720fdf115 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175365 Commit-Queue: Tess Strickland <sstrickl@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Reviewed-by: Clement Skau <cskau@google.com>