Skip to content

Commit d8b27d1

Browse files
committed
mark a TODO
1 parent b9733a8 commit d8b27d1

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

unpythonic/syntax/autoref.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88

99
from ..dynassign import dyn
1010

11+
# TODO: suppport Attribute, Subscript in autoref
12+
# TODO: support nested autorefs
13+
# Consider:
14+
# with autoref(o):
15+
# x # --> (o.x if hasattr(o, "x") else x)
16+
# x.a # --> (o.x.a if hasattr(o, "x") else x.a)
17+
# x[s] # --> (o.x[s] if hasattr(o, "x") else x[s])
18+
# o # --> o
19+
# with autoref(p):
20+
# x # --> (p.x if hasattr(p, "x") else (o.x if hasattr(o, "x") else x))
21+
# x.a # --> (p.x.a if hasattr(p, "x") else (o.x.a if hasattr(o, "x") else x.a))
22+
# x[s] # --> (p.x[s] if hasattr(p, "x") else (o.x[s] if hasattr(o, "x") else x[s]))
23+
# o # --> (p.o if hasattr(p, "o") else o)
24+
# o.x # --> (p.o.x if hasattr(p, "o") else o.x)
25+
# o[s] # --> (p.o[s] if hasattr(p, "o") else o[s])
26+
1127
def autoref(block_body, args):
1228
assert len(args) == 1, "expected exactly one argument, the object to implicitly reference"
1329
assert block_body, "expected at least one statement in the 'with autoref' block"

0 commit comments

Comments
 (0)