Ejemplo n.º 1
0
 def create_scope(self, scope_visibility, variables=None, functions=None,
                  child_scopes=None):
     scope = Scope(scope_visibility=scope_visibility)
     scope.functions=functions or {}
     scope.variables=variables or {}
     scope.child_scopes=child_scopes or []
     return scope
Ejemplo n.º 2
0
 def create_scope(self,
                  scope_visibility,
                  variables=None,
                  functions=None,
                  child_scopes=None):
     scope = Scope(scope_visibility=scope_visibility)
     scope.functions = functions or {}
     scope.variables = variables or {}
     scope.child_scopes = child_scopes or []
     return scope
Ejemplo n.º 3
0
        def enter_new_scope(
                self, scope_visibility):  # type: (ScopeVisibility) -> None
            current_scope = self.get_current_scope()
            new_scope = Scope(scope_visibility)
            self._add_symbol_table_variables(new_scope)

            # Build a lexical scope chain
            current_scope.child_scopes.append(new_scope)
            self._scope_stack.append(new_scope)
Ejemplo n.º 4
0
def create_scope(visibility): # type: (ScopeVisibility) -> Scope
    return Scope(scope_visibility=visibility)
Ejemplo n.º 5
0
        def __init__(self):
            self.link_registry = ScopeLinker.ScopeLinkRegistry()

            global_scope = Scope(ScopeVisibility.GLOBAL_LIKE)
            self._scope_stack = [global_scope]
            self._add_symbol_table_variables(global_scope)