Skip to content

Commit 06ea249

Browse files
authored
Merge pull request github#11820 from yoff/python/fix-downgrades
Python: fix downgrade script
2 parents 9be9636 + ad95225 commit 06ea249

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

python/downgrades/503c0516fba2e5da9570f00eb34ef43025ecb8fb/py_exprs.ql

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@ class ExprParent_ extends @py_expr_parent {
2323
* New kinds have been inserted such that
2424
* `@py_Name` which used to have index 18 now has index 19.
2525
* Entries with lower indices are unchanged.
26+
*
27+
* Note that if `18 <= new_index < 19`, it does not correspond
28+
* to an old index.
2629
*/
2730
bindingset[new_index]
2831
int old_index(int new_index) {
29-
if new_index < 18 then result = new_index else result + (19 - 18) = new_index
32+
// before inserted range
33+
new_index < 18 and result = new_index
34+
or
35+
// after inserted range
36+
new_index >= 19 and result + (19 - 18) = new_index
3037
}
3138

3239
// The schema for py_exprs is:

python/downgrades/503c0516fba2e5da9570f00eb34ef43025ecb8fb/py_stmts.ql

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@ class StmtList_ extends @py_stmt_list {
2323
* New kinds have been inserted such that
2424
* `@py_Nonlocal` which used to have index 14 now has index 16.
2525
* Entries with lower indices are unchanged.
26+
*
27+
* Note that if `14 <= new_index < 16`, it does not correspond
28+
* to an old index.
2629
*/
2730
bindingset[new_index]
2831
int old_index(int new_index) {
29-
if new_index < 14 then result = new_index else result + (16 - 14) = new_index
32+
// before inserted range
33+
new_index < 14 and result = new_index
34+
or
35+
// after inserted range
36+
new_index >= 16 and result + (16 - 14) = new_index
3037
}
3138

3239
// The schema for py_stmts is:

0 commit comments

Comments
 (0)