def push_globaldo(self, node_): # Just a clone, unlike the others using AbstractContext.push -- will # visit the target AST but finding the AST itself does not need to push # the Context (the do statement itself is not structural, i.e. affecting # node_ and context parents) clone = self.clone() scope = globaldo_get_scope(node_) proto = globaldo_get_target_full_name(self, node_) if scope != globaldo_EMPTY_SCOPE_NAME: clone._push_scope(scope) # Current scope clone._push_scope_level( ) # Scopes encountered at this "scope level" # Also need to treat recLabs? for unscoped do? to avoid false shadowing do_frame = clone.peek_do_chain() # Tracking the "do-chain" (although as a key set -- order doesn't # matter) to detect recursive chains #gpd = clone.get_member(proto) #roles = globalprotocoldecl_get_roles(gpd) #params = globalprotocoldecl_get_parameters(gpd) roles = globaldo_get_role_args(node_) params = globaldo_get_argument_args(node_) #if proto not in do_frame.keys(): if not clone.do_instance_in_chain(proto, roles, params): # True means a (recursive) do to this proto is permitted (set False # by push_globalparallel and push_globalinterruptible) clone._add_do_instance(proto, roles, params) else: # Checked in globaldo: shouldn't be visiting a recursive do-target raise Exception("Shouldn't get in here: ", proto) return clone
def push_globaldo(self, node_): # Just a clone, unlike the others using AbstractContext.push -- will # visit the target AST but finding the AST itself does not need to push # the Context (the do statement itself is not structural, i.e. affecting # node_ and context parents) clone = self.clone() scope = globaldo_get_scope(node_) proto = globaldo_get_target_full_name(self, node_) if scope != globaldo_EMPTY_SCOPE_NAME: clone._push_scope(scope) # Current scope clone._push_scope_level() # Scopes encountered at this "scope level" # Also need to treat recLabs? for unscoped do? to avoid false shadowing do_frame = clone.peek_do_chain() # Tracking the "do-chain" (although as a key set -- order doesn't # matter) to detect recursive chains #gpd = clone.get_member(proto) #roles = globalprotocoldecl_get_roles(gpd) #params = globalprotocoldecl_get_parameters(gpd) roles = globaldo_get_role_args(node_) params = globaldo_get_argument_args(node_) #if proto not in do_frame.keys(): if not clone.do_instance_in_chain(proto, roles, params): # True means a (recursive) do to this proto is permitted (set False # by push_globalparallel and push_globalinterruptible) clone._add_do_instance(proto, roles, params) else: # Checked in globaldo: shouldn't be visiting a recursive do-target raise Exception("Shouldn't get in here: ", proto) return clone
def pop_globaldo(self, node_): clone = self.clone() scope = globaldo_get_scope(node_) proto = globaldo_get_target_full_name(self, node_) if scope != globaldo_EMPTY_SCOPE_NAME: clone._pop_scope(scope) clone._pop_scope_level() do_frame = clone.peek_do_chain() del (do_frame[proto]) return clone
def _visit_globaldo(self, node_): _scope = globaldo_get_scope(node_) if _scope == globaldo_EMPTY_SCOPE_NAME: children = [] scopenode = globaldo_get_scope_child(node_) children.append(self._replace_scope_node(scopenode)) children.append(globaldo_get_argumentlist_child(node_)) children.append(globaldo_get_roleinstantiationlist_child(node_)) children.extend(globaldo_get_target_name_children(node_)) node_ = util.antlr_dupnode_and_replace_children(node_, children) return node_
def pop_globaldo(self, node_): clone = self.clone() scope = globaldo_get_scope(node_) proto = globaldo_get_target_full_name(self, node_) if scope != globaldo_EMPTY_SCOPE_NAME: clone._pop_scope(scope) clone._pop_scope_level() #do_frame = clone.peek_do_chain() #del(do_frame[proto]) gpd = self.get_member(proto) #roles = globalprotocoldecl_get_roles(gpd) #params = globalprotocoldecl_get_parameters(gpd) roles = globaldo_get_role_args(node_) params = globaldo_get_argument_args(node_) clone._remove_do_instance(proto, roles, params) return clone
def _visit_globaldo(self, node_): scope = globaldo_get_scope(node_) if scope != globaldo_EMPTY_SCOPE_NAME: self._collect_scopes_aux(scope) return node_