mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
I introduced a new type of CFG instructions, similar to ConditionalInstruction, called RefutablePatternInstruction. The idea is that every pattern that can possibly fail to match is surrounded with a pair of such instructions, helping to describe how the control flow moves in each case. The PEP calls the opposite type of patterns that always match "irrefutable", hence the name. We need these synthetic instructions because otherwise some refutable patterns such as literal ones (e.g. "42") don't leave any nodes in the graph. Incorporating the information about irrefutable patterns right into the graph allows catching cases such as "wildcard/name capture makes remaining patterns unreachable", both in OR patterns and independent case clauses. GitOrigin-RevId: beebe1890a6a824b188e6954a2c92f7ec52079e0
20 lines
630 B
Plaintext
20 lines
630 B
Plaintext
0(1) element: null
|
|
1(2) element: PyMatchStatement
|
|
2(3,17) refutable pattern: [x] | (foo.bar as x)
|
|
3(4,6) refutable pattern: [x]
|
|
4(5) WRITE ACCESS: x
|
|
5(15) matched pattern: [x]
|
|
6(7,17) refutable pattern: (foo.bar as x)
|
|
7(8,17) refutable pattern: foo.bar as x
|
|
8(9,17) refutable pattern: foo.bar
|
|
9(10) READ ACCESS: foo
|
|
10(11) matched pattern: foo.bar
|
|
11(12) WRITE ACCESS: x
|
|
12(13) matched pattern: foo.bar as x
|
|
13(14) matched pattern: (foo.bar as x)
|
|
14(15) matched pattern: [x] | (foo.bar as x)
|
|
15(16) element: PyExpressionStatement
|
|
16(17) READ ACCESS: y
|
|
17(18) element: PyExpressionStatement
|
|
18(19) READ ACCESS: z
|
|
19() element: null |