fixed inline context + added tests for inline context
This commit is contained in:
parent
f7f322148e
commit
7aed260d5d
3 changed files with 38 additions and 13 deletions
11
stl/ast.py
11
stl/ast.py
|
|
@ -78,6 +78,17 @@ class AST(object):
|
|||
def atomic_predicates(self):
|
||||
return set(AP_lens(self).Each().collect())
|
||||
|
||||
def inline_context(self, context):
|
||||
phi, phi2 = self, None
|
||||
|
||||
def update(aps):
|
||||
return tuple(context.get(ap, ap) for ap in aps)
|
||||
|
||||
while phi2 != phi:
|
||||
phi2, phi = phi, AP_lens(phi).modify(update)
|
||||
# TODO: this is hack to flatten the AST. Fix!
|
||||
return phi
|
||||
|
||||
|
||||
class _Top(AST):
|
||||
__slots__ = ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue