def _fetch_resolved_traits(self, res_opt: 'ResolveOptions') -> 'ResolvedTraitSet': from cdm.resolvedmodel import ResolvedTraitSet, ResolvedTraitSetBuilder from cdm.utilities import SymbolSet was_previously_resolving = self.ctx.corpus._is_currently_resolving self.ctx.corpus._is_currently_resolving = True if not res_opt: res_opt = ResolveOptions(self, self.ctx.corpus.default_resolution_directives) kind = 'rtsb' ctx = self.ctx cache_tag_a = ctx.corpus._fetch_definition_cache_tag(res_opt, self, kind) rtsb_all = None # type: ResolvedTraitSetBuilder if self._trait_cache is None: self._trait_cache = {} elif cache_tag_a: rtsb_all = self._trait_cache.get(cache_tag_a) # store the previous document set, we will need to add it with # children found from the constructResolvedTraits call curr_doc_ref_set = res_opt._symbol_ref_set if curr_doc_ref_set is None: curr_doc_ref_set = SymbolSet() res_opt._symbol_ref_set = SymbolSet() if rtsb_all is None: rtsb_all = ResolvedTraitSetBuilder() if not self._resolving_traits: self._resolving_traits = True self._construct_resolved_traits(rtsb_all, res_opt) self._resolving_traits = False obj_def = self.fetch_object_definition(res_opt) if obj_def: # register set of possible docs ctx.corpus._register_definition_reference_symbols(obj_def, kind, res_opt._symbol_ref_set) if rtsb_all.resolved_trait_set is None: # nothing came back, but others will assume there is a set in this builder rtsb_all.resolved_trait_set = ResolvedTraitSet(res_opt) # get the new cache tag now that we have the list of docs cache_tag_a = ctx.corpus._fetch_definition_cache_tag(res_opt, self, kind) if cache_tag_a: self._trait_cache[cache_tag_a] = rtsb_all else: # cache was found # get the SymbolSet for this cached object from .cdm_corpus_def import CdmCorpusDefinition key = CdmCorpusDefinition._fetch_cache_key_from_object(self, kind) temp_doc_ref_set = ctx.corpus._definition_reference_symbols.get(key) res_opt._symbol_ref_set = temp_doc_ref_set # merge child document set with current curr_doc_ref_set._merge(res_opt._symbol_ref_set) res_opt._symbol_ref_set = curr_doc_ref_set self.ctx.corpus._is_currently_resolving = was_previously_resolving return rtsb_all.resolved_trait_set
def _fetch_resolved_traits_internal( self, res_opt: Optional['ResolveOptions'] = None) -> 'ResolvedTraitSet': from cdm.utilities import SymbolSet from .cdm_corpus_def import CdmCorpusDefinition kind = 'rts' # TODO: check the applied traits comparison if self.named_reference and self.applied_traits is None: ctx = self.ctx obj_def = self.fetch_object_definition(res_opt) cache_tag = ctx.corpus._fetch_definition_cache_tag( res_opt, self, kind, '', True, obj_def.at_corpus_path if obj_def else None) rts_result = ctx._cache.get(cache_tag) if cache_tag else None # store the previous reference symbol set, we will need to add it with # children found from the _construct_resolved_traits call curr_sym_ref_set = res_opt._symbol_ref_set or SymbolSet() res_opt._symbol_ref_set = SymbolSet() if rts_result is None: if obj_def: rts_result = obj_def._fetch_resolved_traits(res_opt) if rts_result: rts_result = rts_result.deep_copy() # register set of possible docs ctx.corpus._register_definition_reference_symbols( obj_def, kind, res_opt._symbol_ref_set) # get the new cache tag now that we have the list of docs cache_tag = ctx.corpus._fetch_definition_cache_tag( res_opt, self, kind, '', True, obj_def.at_corpus_path) if cache_tag: ctx._cache[cache_tag] = rts_result else: # cache was found # get the SymbolSet for this cached object key = CdmCorpusDefinition._fetch_cache_key_from_object( self, kind) res_opt._symbol_ref_set = ctx.corpus._definition_reference_symbols.get( key) # merge child symbol references set with current curr_sym_ref_set._merge(res_opt._symbol_ref_set) res_opt._symbol_ref_set = curr_sym_ref_set return rts_result return super()._fetch_resolved_traits(res_opt)
def _fetch_resolved_attributes( self, res_opt: 'ResolveOptions', acp_in_context: Optional['AttributeContextParameters'] = None ) -> 'ResolvedAttributeSet': from cdm.resolvedmodel import ResolvedAttributeSet from cdm.utilities import SymbolSet from .cdm_attribute_context import CdmAttributeContext from .cdm_corpus_def import CdmCorpusDefinition kind = 'rasb' ctx = self.ctx cache_tag = ctx.corpus._fetch_definition_cache_tag( res_opt, self, kind, 'ctx' if acp_in_context else '') rasb_cache = ctx.cache.get(cache_tag) if cache_tag else None under_ctx = None # store the previous symbol set, we will need to add it with # children found from the constructResolvedTraits call curr_sym_ref_set = res_opt.symbol_ref_set or SymbolSet() res_opt.symbol_ref_set = SymbolSet() from_moniker = res_opt._from_moniker res_opt._from_moniker = None if not rasb_cache: if self._resolving_attributes: # re-entered self attribute through some kind of self or looping reference. return ResolvedAttributeSet() self._resolving_attributes = True # if a new context node is needed for these attributes, make it now if acp_in_context: under_ctx = CdmAttributeContext._create_child_under( res_opt, acp_in_context) rasb_cache = self._construct_resolved_attributes( res_opt, under_ctx) self._resolving_attributes = False # register set of possible docs odef = self.fetch_object_definition(res_opt) if odef is not None: ctx.corpus._register_definition_reference_symbols( odef, kind, res_opt.symbol_ref_set) # get the new cache tag now that we have the list of symbols cache_tag = ctx.corpus._fetch_definition_cache_tag( res_opt, self, kind, 'ctx' if acp_in_context else '') # save this as the cached version if cache_tag: ctx.cache[cache_tag] = rasb_cache if from_moniker and acp_in_context and cast( 'CdmObjectReference', self).named_reference: # create a fresh context old_context = acp_in_context.under.contents[-1] acp_in_context.under.contents.pop() under_ctx = CdmAttributeContext._create_child_under( res_opt, acp_in_context) old_context._copy_attribute_context_tree( res_opt, under_ctx, rasb_cache.ras, None, from_moniker) else: # get the SymbolSet for this cached object and pass that back key = CdmCorpusDefinition._fetch_cache_key_from_object(self, kind) res_opt.symbol_ref_set = ctx.corpus._definition_reference_symbols.get( key) # cache found. if we are building a context, then fix what we got instead of making a new one if acp_in_context: # make the new context under_ctx = CdmAttributeContext._create_child_under( res_opt, acp_in_context) rasb_cache.ras.attribute_context._copy_attribute_context_tree( res_opt, under_ctx, rasb_cache.ras, None, from_moniker) # merge child reference symbols set with current curr_sym_ref_set.merge(res_opt.symbol_ref_set) res_opt.symbol_ref_set = curr_sym_ref_set return rasb_cache.ras
def _fetch_resolved_traits( self, res_opt: 'ResolveOptions') -> 'ResolvedTraitSet': from cdm.utilities import SymbolSet from .cdm_corpus_def import CdmCorpusDefinition res_opt = res_opt if res_opt is not None else ResolveOptions( self, self.ctx.corpus.default_resolution_directives) kind = 'rtsb' ctx = self.ctx # get referenced trait trait = self.fetch_object_definition(res_opt) rts_trait = None if not trait: return ctx.corpus._fetch_empty_resolved_trait_set(res_opt) # see if one is already cached # cache by name unless there are parameter if trait._this_is_known_to_have_parameters is None: # never been resolved, it will happen soon, so why not now? rts_trait = trait._fetch_resolved_traits(res_opt) cache_by_path = True if trait._this_is_known_to_have_parameters is not None: cache_by_path = not trait._this_is_known_to_have_parameters cache_tag = ctx.corpus._create_definition_cache_tag( res_opt, self, kind, '', cache_by_path, trait.at_corpus_path) rts_result = ctx._cache.get(cache_tag) if cache_tag else None # store the previous reference symbol set, we will need to add it with # children found from the _construct_resolved_traits call curr_sym_ref_set = res_opt._symbol_ref_set or SymbolSet() res_opt._symbol_ref_set = SymbolSet() # if not, then make one and save it if not rts_result: # get the set of resolutions, should just be this one trait if not rts_trait: # store current doc ref set new_doc_ref_set = res_opt._symbol_ref_set res_opt._symbol_ref_set = SymbolSet() rts_trait = trait._fetch_resolved_traits(res_opt) # bubble up symbol reference set from children if new_doc_ref_set: new_doc_ref_set._merge(res_opt._symbol_ref_set) res_opt._symbol_ref_set = new_doc_ref_set if rts_trait: rts_result = rts_trait.deep_copy() # now if there are argument for this application, set the values in the array if self.arguments and rts_result: # if never tried to line up arguments with parameters, do that if not self._resolved_arguments: self._resolved_arguments = True params = trait._fetch_all_parameters(res_opt) param_found = None a_value = None for index, argument in enumerate(self.arguments): param_found = params.resolve_parameter( index, argument.get_name()) argument._resolved_parameter = param_found a_value = argument.value a_value = ctx.corpus._const_type_check( res_opt, self.in_document, param_found, a_value) argument.value = a_value for argument in self.arguments: rts_result.set_parameter_value_from_argument( trait, argument) # register set of possible symbols ctx.corpus._register_definition_reference_symbols( self.fetch_object_definition(res_opt), kind, res_opt._symbol_ref_set) # get the new cache tag now that we have the list of docs cache_tag = ctx.corpus._create_definition_cache_tag( res_opt, self, kind, '', cache_by_path, trait.at_corpus_path) if cache_tag: ctx._cache[cache_tag] = rts_result else: # cache was found # get the SymbolSet for this cached object key = CdmCorpusDefinition._fetch_cache_key_from_object(self, kind) res_opt._symbol_ref_set = ctx.corpus._definition_reference_symbols.get( key) # merge child document set with current curr_sym_ref_set._merge(res_opt._symbol_ref_set) res_opt._symbol_ref_set = curr_sym_ref_set return rts_result
def _fetch_resolved_traits( self, res_opt: 'ResolveOptions') -> 'ResolvedTraitSet': from cdm.resolvedmodel import ResolvedTrait, ResolvedTraitSet from cdm.utilities import SymbolSet from .cdm_corpus_def import CdmCorpusDefinition kind = 'rtsb' ctx = self.ctx # this may happen 0, 1 or 2 times. so make it fast base_trait = None # type: CdmTraitDefinition base_values = None # type: List[CdmArgumentValue] def get_base_info(base_trait, base_values): if self.extends_trait: base_trait = self.extends_trait.fetch_object_definition( res_opt) if base_trait: base_rts = self.extends_trait._fetch_resolved_traits( res_opt) if base_rts and base_rts.size == 1: base_pv = base_rts.get( base_trait).parameter_values if base_rts.get( base_trait) else None if base_pv: base_values = base_pv.values return base_trait, base_values # see if one is already cached # if this trait has parameters, then the base trait found through the reference might be a different reference # because trait references are unique per argument value set. so use the base as a part of the cache tag # since it is expensive to figure out the extra tag, cache that too! if self._base_is_known_to_have_parameters is None: base_trait, base_values = get_base_info(base_trait, base_values) # is a cache tag needed? then make one self._base_is_known_to_have_parameters = False if base_values: self._base_is_known_to_have_parameters = True cache_tag_extra = '' if self._base_is_known_to_have_parameters: cache_tag_extra = str(self.extends_trait.id) cache_tag = ctx.corpus._fetch_definition_cache_tag( res_opt, self, kind, cache_tag_extra) rts_result = ctx._cache.get(cache_tag) if cache_tag else None # store the previous reference symbol set, we will need to add it with # children found from the _construct_resolved_traits call curr_sym_ref_set = res_opt._symbol_ref_set or SymbolSet() res_opt._symbol_ref_set = SymbolSet() # if not, then make one and save it if not rts_result: base_trait, base_values = get_base_info(base_trait, base_values) if base_trait: # get the resolution of the base class and use the values as a starting point for this trait's values if not self._has_set_flags: # inherit these flags if self.elevated is None: self.elevated = base_trait.elevated if self.ugly is None: self.ugly = base_trait.ugly if self.associated_properties is None: self.associated_properties = base_trait.associated_properties self._has_set_flags = True pc = self._fetch_all_parameters(res_opt) av = [] # type: List[CdmArgumentValue] was_set = [] # type: List[bool] self._this_is_known_to_have_parameters = bool(pc.sequence) for i in range(len(pc.sequence)): # either use the default value or (higher precidence) the value taken from the base reference value = pc.sequence[i].default_value if base_values and i < len(base_values): base_value = base_values[i] if base_value: value = base_value av.append(value) was_set.append(False) # save it res_trait = ResolvedTrait(self, pc, av, was_set) rts_result = ResolvedTraitSet(res_opt) rts_result.merge(res_trait, False) # register set of possible symbols ctx.corpus._register_definition_reference_symbols( self.fetch_object_definition(res_opt), kind, res_opt._symbol_ref_set) # get the new cache tag now that we have the list of docs cache_tag = ctx.corpus._fetch_definition_cache_tag( res_opt, self, kind, cache_tag_extra) if cache_tag: ctx._cache[cache_tag] = rts_result else: # cache found # get the SymbolSet for this cached object key = CdmCorpusDefinition._fetch_cache_key_from_object(self, kind) res_opt._symbol_ref_set = ctx.corpus._definition_reference_symbols.get( key) # merge child document set with current curr_sym_ref_set._merge(res_opt._symbol_ref_set) res_opt._symbol_ref_set = curr_sym_ref_set return rts_result
def _fetch_resolved_attributes( self, res_opt: 'ResolveOptions', acp_in_context: Optional['AttributeContextParameters'] = None ) -> 'ResolvedAttributeSet': from cdm.resolvedmodel import ResolvedAttributeSet from cdm.utilities import SymbolSet from .cdm_attribute_context import CdmAttributeContext from .cdm_corpus_def import CdmCorpusDefinition from .cdm_entity_attribute_def import CdmEntityAttributeDefinition from .cdm_entity_def import CdmEntityDefinition from cdm.resolvedmodel.resolved_attribute_set_builder import ResolvedAttributeSetBuilder was_previously_resolving = self.ctx.corpus._is_currently_resolving self.ctx.corpus._is_currently_resolving = True if not res_opt: res_opt = ResolveOptions( self, self.ctx.corpus.default_resolution_directives) in_circular_reference = False was_in_circular_reference = res_opt._in_circular_reference if isinstance(self, CdmEntityDefinition): in_circular_reference = self in res_opt._currently_resolving_entities res_opt._currently_resolving_entities.add(self) res_opt._in_circular_reference = in_circular_reference # uncomment this line as a test to turn off allowing cycles #if in_circular_reference: # return ResolvedAttributeSet() kind = 'rasb' ctx = self.ctx rasb_result = None rasb_cache = self._fetch_object_from_cache( res_opt, acp_in_context) # type: ResolvedAttributeSetBuilder under_ctx = None current_depth = res_opt._depth_info.current_depth # store the previous symbol set, we will need to add it with # children found from the constructResolvedTraits call curr_sym_ref_set = res_opt._symbol_ref_set or SymbolSet() res_opt._symbol_ref_set = SymbolSet() # if using the cache passes the maxDepth, we cannot use it if rasb_cache \ and res_opt._depth_info.max_depth \ and res_opt._depth_info.current_depth + rasb_cache._resolved_attribute_set._depth_traveled > res_opt._depth_info.max_depth: rasb_cache = None if not rasb_cache: # a new context node is needed for these attributes, # this tree will go into the cache, so we hang it off a placeholder parent # when it is used from the cache (or now), then this placeholder parent is ignored and the things under it are # put into the 'receiving' tree under_ctx = CdmAttributeContext._get_under_context_for_cache_context( res_opt, self.ctx, acp_in_context) rasb_cache = self._construct_resolved_attributes( res_opt, under_ctx) # type: ResolvedAttributeSetBuilder if rasb_cache: # register set of possible docs o_def = self.fetch_object_definition(res_opt) if o_def is not None: ctx.corpus._register_definition_reference_symbols( o_def, kind, res_opt._symbol_ref_set) # get the new cache tag now that we have the list of docs cache_tag = ctx.corpus._create_definition_cache_tag( res_opt, self, kind, 'ctx' if acp_in_context else None) # save this as the cached version if cache_tag: ctx._cache[cache_tag] = rasb_cache # get the 'under_ctx' of the attribute set from the acp that is wired into the target tree under_ctx = cast(ResolvedAttributeSetBuilder, rasb_cache)\ ._resolved_attribute_set.attribute_context\ ._get_under_context_from_cache_context(res_opt, acp_in_context) \ if cast(ResolvedAttributeSetBuilder, rasb_cache)._resolved_attribute_set.attribute_context else None else: # get the 'under_ctx' of the attribute set from the cache. The one stored there was build with a different # acp and is wired into the fake placeholder. so now build a new under_ctx wired into the output tree but with # copies of all cached children under_ctx = cast(ResolvedAttributeSetBuilder, rasb_cache) \ ._resolved_attribute_set.attribute_context \ ._get_under_context_from_cache_context(res_opt, acp_in_context) \ if cast(ResolvedAttributeSetBuilder, rasb_cache)._resolved_attribute_set.attribute_context else None # under_ctx._validate_lineage(res_opt) # debugging if rasb_cache: # either just built something or got from cache # either way, same deal: copy resolved attributes and copy the context tree associated with it # 1. deep copy the resolved att set (may have groups) and leave the attCtx pointers set to the old tree # 2. deep copy the tree. # # 1. deep copy the resolved att set (may have groups) and leave the attCtx pointers set to the old tree rasb_result = ResolvedAttributeSetBuilder() rasb_result._resolved_attribute_set = cast( ResolvedAttributeSetBuilder, rasb_cache)._resolved_attribute_set.copy() # 2. deep copy the tree and map the context references. if under_ctx: # null context? means there is no tree, probably 0 attributes came out if under_ctx.associate_tree_copy_with_attributes( res_opt, rasb_result._resolved_attribute_set) is False: return None if isinstance(self, CdmEntityAttributeDefinition): # if we hit the maxDepth, we are now going back up res_opt._depth_info.current_depth = current_depth # now at the top of the chain where max depth does not influence the cache if res_opt._depth_info.current_depth == 0: res_opt._depth_info.max_depth_exceeded = False if not in_circular_reference and self.object_type == CdmObjectType.ENTITY_DEF: # should be removed from the root level only # if it is in a circular reference keep it there res_opt._currently_resolving_entities.remove(self) res_opt._in_circular_reference = was_in_circular_reference # merge child reference symbols set with current curr_sym_ref_set._merge(res_opt._symbol_ref_set) res_opt._symbol_ref_set = curr_sym_ref_set self.ctx.corpus._is_currently_resolving = was_previously_resolving return rasb_result._resolved_attribute_set if rasb_result else rasb_result
def _fetch_resolved_attributes( self, res_opt: 'ResolveOptions', acp_in_context: Optional['AttributeContextParameters'] = None ) -> 'ResolvedAttributeSet': from cdm.resolvedmodel import ResolvedAttributeSet from cdm.utilities import SymbolSet from .cdm_attribute_context import CdmAttributeContext from .cdm_corpus_def import CdmCorpusDefinition was_previously_resolving = self.ctx.corpus._is_currently_resolving self.ctx.corpus._is_currently_resolving = True if not res_opt: res_opt = ResolveOptions(self) kind = 'rasb' ctx = self.ctx cache_tag = ctx.corpus._fetch_definition_cache_tag( res_opt, self, kind, 'ctx' if acp_in_context else '') rasb_cache = ctx._cache.get(cache_tag) if cache_tag else None under_ctx = None # store the previous symbol set, we will need to add it with # children found from the constructResolvedTraits call curr_sym_ref_set = res_opt._symbol_ref_set or SymbolSet() res_opt._symbol_ref_set = SymbolSet() # get the moniker that was found and needs to be appended to all # refs in the children attribute context nodes from_moniker = res_opt._from_moniker res_opt._from_moniker = None if not rasb_cache: if self._resolving_attributes: # re-entered self attribute through some kind of self or looping reference. self.ctx.corpus._is_currently_resolving = was_previously_resolving return ResolvedAttributeSet() self._resolving_attributes = True # if a new context node is needed for these attributes, make it now if acp_in_context: under_ctx = CdmAttributeContext._create_child_under( res_opt, acp_in_context) rasb_cache = self._construct_resolved_attributes( res_opt, under_ctx) if rasb_cache: self._resolving_attributes = False # register set of possible docs odef = self.fetch_object_definition(res_opt) if odef is not None: ctx.corpus._register_definition_reference_symbols( odef, kind, res_opt._symbol_ref_set) # get the new cache tag now that we have the list of symbols cache_tag = ctx.corpus._fetch_definition_cache_tag( res_opt, self, kind, 'ctx' if acp_in_context else '') # save this as the cached version if cache_tag: ctx._cache[cache_tag] = rasb_cache if from_moniker and acp_in_context and cast( 'CdmObjectReference', self).named_reference: # create a fresh context old_context = acp_in_context._under.contents[-1] acp_in_context._under.contents.pop( len(acp_in_context._under.contents) - 1) under_ctx = CdmAttributeContext._create_child_under( res_opt, acp_in_context) new_context = old_context._copy_attribute_context_tree( res_opt, under_ctx, rasb_cache.ras, None, from_moniker) # since THIS should be a refererence to a thing found in a moniker document, it already has a moniker in the reference # this function just added that same moniker to everything in the sub-tree but now this one symbol has too many # remove one moniker_path_added = from_moniker + '/' if new_context.definition and new_context.definition.named_reference and new_context.definition.named_reference.startswith( moniker_path_added): # slice it off the front new_context.definition.named_reference = new_context.definition.named_reference[ len(moniker_path_added):] else: # get the SymbolSet for this cached object and pass that back key = CdmCorpusDefinition._fetch_cache_key_from_object(self, kind) res_opt._symbol_ref_set = ctx.corpus._definition_reference_symbols.get( key) # cache found. if we are building a context, then fix what we got instead of making a new one if acp_in_context: # make the new context under_ctx = CdmAttributeContext._create_child_under( res_opt, acp_in_context) rasb_cache.ras.attribute_context._copy_attribute_context_tree( res_opt, under_ctx, rasb_cache.ras, None, from_moniker) # merge child reference symbols set with current curr_sym_ref_set._merge(res_opt._symbol_ref_set) res_opt._symbol_ref_set = curr_sym_ref_set self.ctx.corpus._is_currently_resolving = was_previously_resolving return rasb_cache.ras if rasb_cache else rasb_cache
def _fetch_resolved_traits( self, res_opt: Optional['ResolveOptions'] = None) -> 'ResolvedTraitSet': from cdm.utilities import SymbolSet from .cdm_corpus_def import CdmCorpusDefinition res_opt = res_opt if res_opt is not None else ResolveOptions( self, self.ctx.corpus.default_resolution_directives) kind = 'rtsb' ctx = self.ctx # get referenced trait trait = self.fetch_object_definition(res_opt) rts_trait = None if not trait: return ctx.corpus._fetch_empty_resolved_trait_set(res_opt) # see if one is already cached # cache by name unless there are parameter if trait._this_is_known_to_have_parameters is None: # never been resolved, it will happen soon, so why not now? rts_trait = trait._fetch_resolved_traits(res_opt) rts_result = None # store the previous reference symbol set, we will need to add it with # children found from the _construct_resolved_traits call curr_sym_ref_set = res_opt._symbol_ref_set or SymbolSet() res_opt._symbol_ref_set = SymbolSet() # get the set of resolutions, should just be this one trait if not rts_trait: # store current doc ref set new_doc_ref_set = res_opt._symbol_ref_set res_opt._symbol_ref_set = SymbolSet() rts_trait = trait._fetch_resolved_traits(res_opt) # bubble up symbol reference set from children if new_doc_ref_set: new_doc_ref_set._merge(res_opt._symbol_ref_set) res_opt._symbol_ref_set = new_doc_ref_set if rts_trait: rts_result = rts_trait.deep_copy() # now if there are argument for this application, set the values in the array if self.arguments and rts_result: # if never tried to line up arguments with parameters, do that if not self._resolved_arguments: self._resolved_arguments = True params = trait._fetch_all_parameters(res_opt) for argument_index, argument in enumerate(self.arguments): param_found = params.resolve_parameter( argument_index, argument.get_name()) argument._resolved_parameter = param_found argument.value = param_found._const_type_check( res_opt, self.in_document, argument.value) for argument in self.arguments: rts_result.set_parameter_value_from_argument(trait, argument) # register set of possible symbols ctx.corpus._register_definition_reference_symbols( self.fetch_object_definition(res_opt), kind, res_opt._symbol_ref_set) # merge child document set with current curr_sym_ref_set._merge(res_opt._symbol_ref_set) res_opt._symbol_ref_set = curr_sym_ref_set return rts_result