Commit Graph

2 Commits

Author SHA1 Message Date
Paul Berry f679efb946 Migration: make an inverse function for Variables.uniqueIdentifierForSpan.
Change-Id: Id4c9f5683b147f5f47df889b95477f6770e9c57e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-01-21 22:50:29 +00:00
Paul Berry 5a7bb50905 Migration: generalize creation of unique IDs for source spans
Previously, we used the offset of an AST node as a unique ID to
represent it, with a special hack to make sure we can distinguish a
generic function type from its return type (which has the same
offset).  But in an upcoming CL, I will need to start associating
unique IDs with expressions, so that will bring up a whole bunch more
ambiguity.

This CL switches to a technique where we combine the offset and the
end of any source span into a single unique identifier.  The algorithm
produces an output that is no larger than the square of either input.
Since we have 64-bit integers in Dart, this should be adequate for any
reasonable input file size.

Change-Id: I68ce27533eb485cc824e1080326d02de98bff1e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132404
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-01-21 15:58:02 +00:00