def add(self, config, mergeCache=None): if self.readonly: raise Exception("This set is readonly") if config.semanticContext is not SemanticContext.NONE: self.hasSemanticContext = True if config.reachesIntoOuterContext > 0: self.dipsIntoOuterContext = True existing = self.getOrAdd(config) if existing is config: self.cachedHashCode = -1 self.configs.append(config) # track order here return True # a previous (s,i,pi,_), merge with it and save result rootIsWildcard = not self.fullCtx merged = merge(existing.context, config.context, rootIsWildcard, mergeCache) # no need to check for existing.context, config.context in cache # since only way to create new graphs is "call rule" and here. # We cache at both places. existing.reachesIntoOuterContext = max( existing.reachesIntoOuterContext, config.reachesIntoOuterContext) # make sure to preserve the precedence filter suppression during the merge if config.precedenceFilterSuppressed: existing.precedenceFilterSuppressed = True existing.context = merged # replace context; no need to alt mapping return True
def add(self, config, mergeCache=None): if self.readonly: raise Exception("This set is readonly") if config.semanticContext is not SemanticContext.NONE: self.hasSemanticContext = True if config.reachesIntoOuterContext > 0: self.dipsIntoOuterContext = True existing = self.getOrAdd(config) if existing is config: self.cachedHashCode = -1; self.configs.append(config) # track order here return True # a previous (s,i,pi,_), merge with it and save result rootIsWildcard = not self.fullCtx merged = merge(existing.context, config.context, rootIsWildcard, mergeCache) # no need to check for existing.context, config.context in cache # since only way to create new graphs is "call rule" and here. We # cache at both places. existing.reachesIntoOuterContext = max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext) existing.context = merged # replace context; no need to alt mapping return True