Exemplo n.º 1
0
def test_get_symbol_table_copy_frames():
    non_copy_sts = []
    copy_sts = []
    for i in range(5):
        non_copy_sts.append(stack.get_symbol_table())
        copy_sts.append(stack.get_symbol_table(copy_locals=True))
    for j in range(5):
        assert non_copy_sts[j].locals["i"] == 4
        assert copy_sts[j].locals["i"] == j
Exemplo n.º 2
0
    def __init__(self,
                 debug: bool = False,
                 env: tp.Optional[SymbolTable] = None):
        if env is None:
            env = get_symbol_table([self.__init__])

        self.env = env
        self.debug = debug
Exemplo n.º 3
0
    def __init__(self,
                 debug: bool = False,
                 env: tp.Optional[SymbolTable] = None):
        warnings.warn(
            "begin_rewrite / end_rewrite are deprcated please use apply_ast_passes instead",
            DeprecationWarning)

        if env is None:
            env = get_symbol_table([self.__init__])

        self.env = env
        self.debug = debug
Exemplo n.º 4
0
 def __init__(self,
              passes: tp.Sequence[Pass],
              debug: bool = False,
              env: tp.Optional[SymbolTable] = None,
              path: tp.Optional[str] = None,
              file_name: tp.Optional[str] = None):
     if env is None:
         env = get_symbol_table([self.__init__])
     self.passes = passes
     self.env = env
     self.debug = debug
     self.path = path
     self.file_name = file_name
Exemplo n.º 5
0
def test_get_symbol_table():
    MAGIC = 'bar'
    st = stack.get_symbol_table()
    assert st.globals['MAGIC'] == 'foo'
    assert st.locals['MAGIC'] == 'bar'