ResolutionPass

com.ossuminc.riddl.passes.resolve.ResolutionPass
See theResolutionPass companion object

The Reference Resolution Pass. This pass traverses the entire model and resolves every reference it finds into the refmap in its output. See ReferenceMap for details. This resolution must be done before validation to make sure there are no cycles in the references. While it is at it, it also tracks which definition uses which other definition. See Usages for details. It also keeps a kindMap. See KindMap for details.

Reference Resolution is the process of turning a com.ossuminc.riddl.language.AST.PathIdentifier into the com.ossuminc.riddl.language.AST.Definition that is referenced by the com.ossuminc.riddl.language.AST.PathIdentifier. There are several ways to resolve a reference:

  1. If its already in the ReferenceMap then use that resolution

  2. A single identifier in the path is looked up in the symbol table and if it uniquely matches only one definition then that definition is the resolved definition.

  3. If there are multiple identifiers in the com.ossuminc.riddl.language.AST.PathIdentifier then we attempt to anchor the search using the first identifier. Anchoring is done by (a) checking to see if it is the "Root" node in which case that is the anchor, (b) checking to see if the first identifier is the name of one of the parent nodes from the location of the reference, and finally (c) looking up the first identifier in the symbol table and if it is unique then using that as the anchor. Once the anchor is determined, it is simply a matter of walking down tree of nodes from the anchor, one name at a time.

Value parameters

input

The input to the original pass.

outputs

THe outputs from preceding passes, which should only be the com.ossuminc.riddl.passes.symbols.SymbolsPass output.

Attributes

Companion
object
Source
ResolutionPass.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait UsageBase
class Pass
class Object
trait Matchable
class Any
Show all

Members list

Type members

Inherited types

Attributes

Inherited from:
UsageBase
Source
UsageResolution.scala

Attributes

Inherited from:
UsageBase
Source
UsageResolution.scala

Value members

Concrete methods

override def close(): Unit

Close any resources used so this can be used with AutoCloseable or Using.Manager

Close any resources used so this can be used with AutoCloseable or Using.Manager

Attributes

Definition Classes
Source
ResolutionPass.scala
override def name: String

THe name of the pass for inclusion in messages it produces.

THe name of the pass for inclusion in messages it produces. This must be implemented by the subclass

Attributes

Returns

A string value giving the name of this pass

Definition Classes
Source
ResolutionPass.scala
override def postProcess(root: Root): Unit

A signal that the processing is complete and no more calls to process will be made.

A signal that the processing is complete and no more calls to process will be made. This also gives the Pass subclass a chance to do post-processing as some computations can only be done after collecting data from the entire AST

Value parameters

root

The root of the parsed model just as a convenience for post-processing

Attributes

Definition Classes
Source
ResolutionPass.scala

The main implementation of the Pass.

The main implementation of the Pass. The AST is walked in a depth first manner calling this function for each definition it encounters.

Value parameters

definition

The definition to be processed

parents

The stack of definitions that are the parents of com.ossuminc.riddl.language.AST.Definition. This stack goes from immediate parent towards the root. The root is deepest in the stack.

Attributes

Source
ResolutionPass.scala
override def result(root: Root): ResolutionOutput

Generate the output of this Pass.

Generate the output of this Pass. This will only be called after all the calls to process have completed.

Value parameters

root

The new com.ossuminc.riddl.language.AST.Root of the model that the pass computed

Attributes

Returns

an instance of the output type

Definition Classes
Source
ResolutionPass.scala

Inherited methods

Attributes

Inherited from:
UsageResolution
Source
UsageResolution.scala

Attributes

Inherited from:
UsageResolution
Source
UsageResolution.scala
def addType(ty: Type): UsageResolution.this.type

Attributes

Inherited from:
UsageResolution
Source
UsageResolution.scala

Attributes

Inherited from:
UsageResolution
Source
UsageResolution.scala
def checkUnused(): UsageResolution.this.type

Attributes

Inherited from:
UsageResolution
Source
UsageResolution.scala

Pre-process the root before actually traversing.

Pre-process the root before actually traversing. This is also a signal that the processing is about to start.

Value parameters

root

A com.ossuminc.riddl.language.AST.Root node which encapsulates the whole model. This is the state of the Root as of the last pass.

Attributes

Returns

Typically returns the same Root objects with changes in subsequent levels, but it entirely possibly to completely reorganize the hierarchy, including its root node.

Inherited from:
Pass
Source
Pass.scala

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product

Concrete fields

Attributes

Source
ResolutionPass.scala

Attributes

Source
ResolutionPass.scala

Attributes

Source
ResolutionPass.scala

Inherited fields

protected var entities: Seq[Entity]

Attributes

Inherited from:
UsageResolution
Source
UsageResolution.scala
protected var functions: Seq[Function]

Attributes

Inherited from:
UsageResolution
Source
UsageResolution.scala
val in: PassInput

Attributes

Inherited from:
Pass
Source
Pass.scala

Attributes

Inherited from:
Pass
Source
Pass.scala
protected var types: Seq[Type]

Attributes

Inherited from:
UsageResolution
Source
UsageResolution.scala
protected val usedBy: UsedByMap

Attributes

Inherited from:
UsageBase
Source
UsageResolution.scala
protected val uses: UseMap

Attributes

Inherited from:
UsageBase
Source
UsageResolution.scala