Module: RGen::Instantiator::ReferenceResolver
- Included in:
- QualifiedNameResolver
- Defined in:
- lib/rgen/instantiator/reference_resolver.rb
Overview
This module is meant to be mixed into a resolver class providing the method resolveIdentifier
Defined Under Namespace
Classes: UnresolvedReference
Instance Method Summary collapse
-
#resolveReferences(unresolvedReferences, problems = []) ⇒ Object
tries to resolve the given
unresolvedReferences
if resolution is successful, the proxy object will be removed otherwise there will be an error description inproblems
returns an array of the references which are still unresolved.
Instance Method Details
#resolveReferences(unresolvedReferences, problems = []) ⇒ Object
tries to resolve the given unresolvedReferences
if resolution is successful, the proxy object will be removed otherwise there will be an error description in problems
returns an array of the references which are still unresolved
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rgen/instantiator/reference_resolver.rb', line 17 def resolveReferences(unresolvedReferences, problems=[]) stillUnresolvedReferences = [] unresolvedReferences.each do |ur| target = resolveIdentifier(ur.proxy.targetIdentifier) if target && !target.is_a?(Array) if ur.element.hasManyMethods(ur.featureName) ur.element.removeGeneric(ur.featureName, ur.proxy) ur.element.addGeneric(ur.featureName, target) else # this will replace the proxy ur.element.setGeneric(ur.featureName, target) end elsif target problems << "identifier #{ur.proxy.targetIdentifier} not uniq" stillUnresolvedReferences << ur else problems << "identifier #{ur.proxy.targetIdentifier} not found" stillUnresolvedReferences << ur end end stillUnresolvedReferences end |