Commit f6e4b77
[vm] Remove the only cases where TokenPositions are mutated.
The Next() method on TokenPositions used to increment the internal
value_ field, but now creates a new TokenPosition with value_ + 1.
There are only three places this is used:
* Getting the token position after the end token position for
implicit closure functions in the scope builder.
* Getting the token position after the end token position for
variable declarations in the scope builder.
* Iterating over the token positions on a single source line in
the debugger.
So the overhead of creating new TokenPositions vs. mutating the original
should be limited, compared to the benefit of being able to assume
TokenPosition values are constant once created. There's too much
dependence on the copy and copy assignment operators due to the previous
possibility of mutation to make the internal field constant at the
moment without much more sweeping changes, unfortunately.
Also remove the copy assignment in initializing TokenPosition constants.
TEST=Tested using existing tests on trybots.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try
Change-Id: Ie18b7f45bd9c6a43647ecd189330d91a4dff373b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174922
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Clement Skau <cskau@google.com>1 parent a9d212b commit f6e4b77
File tree
4 files changed
+7
-8
lines changed- runtime/vm
- compiler/frontend
4 files changed
+7
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1274 | 1274 | | |
1275 | 1275 | | |
1276 | 1276 | | |
1277 | | - | |
| 1277 | + | |
1278 | 1278 | | |
1279 | 1279 | | |
1280 | 1280 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3033 | 3033 | | |
3034 | 3034 | | |
3035 | 3035 | | |
3036 | | - | |
| 3036 | + | |
3037 | 3037 | | |
3038 | 3038 | | |
3039 | 3039 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
| 101 | + | |
103 | 102 | | |
104 | 103 | | |
105 | 104 | | |
| |||
0 commit comments