예제 #1
0
def assign_convert(ast, visitor=None):
    """ make a copy of the AST that converts all writable variables into
    using cells. In addition, compute the state of the environment for
    every AST node that needs to know.

    The vars arguments in all the visit_* methods contain the variables that
    need to use cells. The env_structure is an instance of SymList (or None)
    describing the environment at that AST node.
    """
    if visitor is None:
        visitor = AssignConvertVisitor()
    return ast.visit(visitor, variable_set(), None)
예제 #2
0
파일: test_ast.py 프로젝트: 8l/pycket
def make_symbols(d):
    v = variable_set()
    for i, j in d.iteritems():
        v[ModuleVar(W_Symbol.make(i), None, W_Symbol.make(i))] = j
    return v
예제 #3
0
파일: test_ast.py 프로젝트: 8l/pycket
def make_symbols(d):
    v = variable_set()
    for i, j in d.iteritems():
        v[ModuleVar(W_Symbol.make(i), None, W_Symbol.make(i))] = j
    return v
예제 #4
0
파일: AST.py 프로젝트: yws/pycket-1
 def _mutated_vars(self):
     from pycket.interpreter import variable_set
     x = variable_set()
     for b in self.direct_children():
         x.update(b.mutated_vars())
     return x
예제 #5
0
 def body_muts(self, node):
     assert isinstance(node, SequencedBodyAST)
     muts = variable_set()
     for b in node.body:
         muts.update(b.mutated_vars(self.mutated_vars_cache))
     return muts
예제 #6
0
 def body_muts(node):
     assert isinstance(node, SequencedBodyAST)
     muts = variable_set()
     for b in node.body:
         muts.update(b.mutated_vars())
     return muts
예제 #7
0
def assign_convert(ast, visitor=None):
    if visitor is None:
        visitor = AssignConvertVisitor()
    return ast.visit(visitor, variable_set(), None)
예제 #8
0
def assign_convert(ast, visitor=None):
    if visitor is None:
        visitor = AssignConvertVisitor()
    return ast.visit(visitor, variable_set(), None)