Files
Pierre-Marie de Rodat 3170ac7b33 Lkt: rework collection subscript expressions
Introduce `a.at(i)` and `a?.at(i)` as out-of-bounds resilient
alternatives to `a[i]` and `a?[i]`. In addition, harmonize the effect of
`?` on there expressions with its effect on member access (`a?.b`): if
the prefix is null, the execution of the rest of the chain is
shortcircuited.
2025-03-27 14:14:24 +00:00

85 lines
1.6 KiB
Plaintext

main.py: Running...
# p_list_subscript
items=None, index=None:
<PropertyError: main.txt:2:5-4:15: dereferencing a null access>
items=None, index=1:
<PropertyError: main.txt:2:5-4:15: dereferencing a null access>
items=(), index=None:
<PropertyError: computing index from null node>
items=(a0), index=1:
<PropertyError: main.txt:2:5-4:15: out-of-bounds AST list access>
items=(b0 b1 b2), index=1:
b1
# p_list_at
items=None, index=None:
<PropertyError: main.txt:2:5-4:15: dereferencing a null access>
items=None, index=1:
<PropertyError: main.txt:2:5-4:15: dereferencing a null access>
items=(), index=None:
<PropertyError: computing index from null node>
items=(a0), index=1:
None
items=(b0 b1 b2), index=1:
b1
# p_list_nc_subscript
items=None, index=None:
None
items=None, index=1:
None
items=(), index=None:
<PropertyError: computing index from null node>
items=(a0), index=1:
<PropertyError: main.txt:2:5-4:15: out-of-bounds AST list access>
items=(b0 b1 b2), index=1:
b1
# p_list_nc_at
items=None, index=None:
None
items=None, index=1:
None
items=(), index=None:
<PropertyError: computing index from null node>
items=(a0), index=1:
None
items=(b0 b1 b2), index=1:
b1
# p_array_subscript
items=[a0], index=1:
<PropertyError: main.txt:2:5-4:15: out-of-bounds array access>
items=[b0. b1. b2], index=1:
b1
# p_array_at
items=[a0], index=1:
None
items=[b0. b1. b2], index=1:
b1
# p_array_nc_subscript
items=[a0], index=1:
<PropertyError: main.txt:2:5-4:15: out-of-bounds array access>
items=[b0. b1. b2], index=1:
b1
# p_array_nc_at
items=[a0], index=1:
None
items=[b0. b1. b2], index=1:
b1
main.py: Done.
Done