DeclarationSequence

This represents a sequence of one or more declaration(s). The purpose of this node is primarily to bridge between a single declaration and a list of declarations in the front-end handlers. It will be converted into a list-structure and all its children will be added to the parent, i.e. the translation unit. It should NOT end up in the final graph.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Additional problem nodes. These nodes represent problems which occurred during processing of a node (i.e. only partially processed).

Link copied to clipboard

Returns a list of all Nodes, starting from the current Node, which are the beginning of an EOG path created by the EvaluationOrderGraphPass. Typical examples include all top-level declarations, such as functions and variables. For a more detailed explanation, see EOGStarterHolder.

Link copied to clipboard

List of annotations associated with that node.

Link copied to clipboard
Link copied to clipboard

Index of the argument if this node is used in a function call or parameter list.

Link copied to clipboard

Returns all Assignment child edges in this graph, starting with this Node.

Link copied to clipboard

Returns all AssignExpression child edges in this graph, starting with this Node.

Link copied to clipboard

Virtual property to return a list of the node's children. Uses the SubgraphWalker to retrieve the appropriate nodes.

Link copied to clipboard

A shortcut to return all AstEdge edges starting from this node.

Link copied to clipboard
Link copied to clipboard

Returns all Block child edges in this graph, starting with this Node.

Link copied to clipboard

Returns all BreakStatement child edges in this graph, starting with this Node.

Link copied to clipboard

Returns all CallExpression children in this graph, starting with this Node.

Link copied to clipboard

Returns all CastExpression children in this graph, starting with this Node.

Link copied to clipboard
Link copied to clipboard
var code: String?

Original code snippet of this node. Most nodes will have a corresponding "code", but in cases where nodes are created artificially, it may be null.

Link copied to clipboard

Optional comment of this node.

Link copied to clipboard

Returns all ContinueStatement child edges in this graph, starting with this Node.

Link copied to clipboard
open override var ctx: TranslationContext?

Because we are updating type information in the properties of the node, we need a reference to managers such as the TypeManager instance which is responsible for this particular node. All managers are bundled in TranslationContext. It is set in Node.applyMetadata when a ContextProvider is provided.

Link copied to clipboard

A shortcut to return all Dataflow edges starting from this node.

Link copied to clipboard
open override val declarations: List<Declaration>
Link copied to clipboard

Returns all DoStatement child edges in this graph, starting with this Node.

Link copied to clipboard

Returns all FieldDeclaration children in this graph, starting with this Node.

Link copied to clipboard
var file: String?

Name of the containing file. It can be null for artificially created nodes or if just analyzing snippets of code without an associated file name.

Link copied to clipboard

Returns all ForEachStatement child edges in this graph, starting with this Node.

Link copied to clipboard

Returns all ForStatement child edges in this graph, starting with this Node.

Link copied to clipboard

Returns all FunctionDeclaration children in this graph, starting with this Node.

Link copied to clipboard
var id: Long?

Required field for object graph mapping. It contains the node id.

Link copied to clipboard

Returns all IfStatement child edges in this graph, starting with this Node.

Link copied to clipboard

Returns all ImportDeclaration children in this graph, starting with this Node.

Link copied to clipboard

Specifies, whether this node is implicit, i.e. is not really existing in source code but only exists implicitly. This mostly relates to implicit casts, return statements or implicit this expressions.

Link copied to clipboard

If a node is marked as being inferred, it means that it was created artificially and does not necessarily have a real counterpart in the scanned source code. However, the nodes represented should have been part of parser output and represents missing code that is inferred by the CPG construction, e.g. missing functions, records, files etc.

Link copied to clipboard
Link copied to clipboard

Returns all LabelStatement child edges in this graph, starting with this Node.

Link copied to clipboard
open override var language: Language<*>?

The language of this node. This property is set in Node.applyMetadata by a LanguageProvider at the time when the node is created.

Link copied to clipboard

Returns all Literal children in this graph, starting with this Node.

Link copied to clipboard
open override var location: PhysicalLocation?

Location of the finding in source code.

Link copied to clipboard

Returns all MemberCallExpression children in this graph, starting with this Node.

Link copied to clipboard

Returns all MemberExpression children in this graph, starting with this Node.

Link copied to clipboard

Returns all MethodDeclaration children in this graph, starting with this Node.

Link copied to clipboard
open override var name: Name

This property holds the full name using our new Name class.

Link copied to clipboard

Returns all RecordDeclaration children in this graph, starting with this Node.

Link copied to clipboard
Link copied to clipboard

The nodes which are control-flow dominated, i.e., the children of the Control Dependence Graph (CDG).

Link copied to clipboard

Virtual property for accessing nextDFGEdges without property edges.

Link copied to clipboard

Outgoing data flow edges

Link copied to clipboard

Virtual property for accessing nextEOGEdges without property edges.

Link copied to clipboard

Outgoing control flow edges.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Outgoing Program Dependence Edges.

Link copied to clipboard

Returns all Node children in this graph, starting with this Node.

Link copied to clipboard

Returns all OperatorCallExpression children in this graph, starting with this Node.

Link copied to clipboard

Returns all OperatorDeclaration children in this graph, starting with this Node.

Link copied to clipboard

Returns all ParameterDeclaration children in this graph, starting with this Node.

Link copied to clipboard
Link copied to clipboard

The nodes which dominate this node via the control-flow, i.e., the parents of the Control Dependence Graph (CDG).

Link copied to clipboard

Virtual property for accessing prevDFGEdges without property edges.

Link copied to clipboard

Incoming data flow edges

Link copied to clipboard

Virtual property for accessing prevEOGEdges without property edges.

Link copied to clipboard

Incoming control flow edges.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Incoming Program Dependence Edges.

Link copied to clipboard

Return all ProblemNode children in this graph (either stored directly or in Node.additionalProblems), starting with this Node.

Link copied to clipboard

Returns all RecordDeclaration children in this graph, starting with this Node.

Link copied to clipboard

Returns all Reference children in this graph, starting with this Node.

Link copied to clipboard

Returns all ReturnStatement child edges in this graph, starting with this Node.

Link copied to clipboard
open override var scope: Scope?

The scope this node "lives" in / in which it is defined. This property is set in Node.applyMetadata by a ScopeProvider at the time when the node is created.

Link copied to clipboard

Returns all Statement child edges in this graph, starting with this Node.

Link copied to clipboard

Returns all SwitchStatement child edges in this graph, starting with this Node.

Link copied to clipboard
Link copied to clipboard

Returns all ThrowExpression child edges in this graph, starting with this Node.

Link copied to clipboard

Returns the TranslationUnitDeclaration where this node is located in.

Link copied to clipboard

Returns all TryStatement child edges in this graph, starting with this Node.

Link copied to clipboard

Returns all VariableDeclaration children in this graph, starting with this Node.

Link copied to clipboard

Returns all WhileStatement child edges in this graph, starting with this Node.

Functions

Link copied to clipboard
open fun accept(strategy: IStrategy<Node>, visitor: IVisitor<Node>)
Link copied to clipboard
open override fun addDeclaration(declaration: Declaration)

Adds the specified declaration to this declaration holder. Ideally, the declaration holder should use the addIfNotContains method to consistently add declarations.

Link copied to clipboard
open fun <T : Node, P : AstEdge<T>> addIfNotContains(collection: AstEdges<T, P>, declaration: T)
open fun <T : Node, P : Edge<T>> addIfNotContains(collection: EdgeList<T, P>, declaration: T)
open fun <T : Declaration> addIfNotContains(collection: MutableCollection<T>, declaration: T)

open fun <T : Node, P : Edge<T>> addIfNotContains(collection: EdgeList<T, out P>, declaration: T, outgoing: Boolean)

Adds a declaration to a collection of property edges, which contain the declarations

Link copied to clipboard
inline fun <T> Node?.allChildren(noinline predicate: (T) -> Boolean? = null): List<T>

Flattens the AST beginning with this node and returns all nodes of type T. For convenience, an optional predicate function predicate can be supplied, which will be applied via Collection.filter

Link copied to clipboard
inline fun <EdgeType : Edge<out Node>> Node.allEdges(noinline predicate: (EdgeType) -> Boolean = { true }): Collection<EdgeType>

This function returns a subgraph containing all Edges starting from this Node that are of the specific EdgeType. Optionally, a predicate can be used to filter the edges even further.

Link copied to clipboard
fun Node.applyMetadata(provider: MetadataProvider?, name: CharSequence? = EMPTY_NAME, rawNode: Any? = null, localNameOnly: Boolean = false, defaultNamespace: Name? = null)

Applies various metadata on this Node, based on the kind of provider in provider. This can include:

Link copied to clipboard
Link copied to clipboard
@JvmName(name = "astNodes")
fun Node.ast(): List<Node>
Link copied to clipboard

Creates a single AstEdge starting from this node (wrapped in a EdgeSingletonList container).

Link copied to clipboard
fun <NodeType : Node> Node.astEdgesOf(onAdd: (AstEdge<NodeType>) -> Unit? = null, onRemove: (AstEdge<NodeType>) -> Unit? = null): AstEdges<NodeType, AstEdge<NodeType>>

Creates an AstEdges container starting from this node.

Link copied to clipboard

Creates a single optional AstEdge starting from this node (wrapped in a EdgeSingletonList container).

Link copied to clipboard
Link copied to clipboard
fun Node.collectAllNextCDGPaths(interproceduralAnalysis: Boolean): List<List<Node>>

Iterates the next CDG edges until there are no more edges available (or until a loop is detected). Returns a list of possible paths (each path is represented by a list of nodes).

Link copied to clipboard

Iterates the next EOG edges until there are no more edges available (or until a loop is detected). Returns a list of possible paths (each path is represented by a list of nodes).

Link copied to clipboard

Iterates the next full DFG edges until there are no more edges available (or until a loop is detected). Returns a list of possible paths (each path is represented by a list of nodes).

Link copied to clipboard

Iterates the next PDG edges until there are no more edges available (or until a loop is detected). Returns a list of possible paths (each path is represented by a list of nodes).

Link copied to clipboard
fun Node.collectAllPrevCDGPaths(interproceduralAnalysis: Boolean): List<List<Node>>

Iterates the prev CDG edges until there are no more edges available (or until a loop is detected). Returns a list of possible paths (each path is represented by a list of nodes).

Link copied to clipboard
fun Node.collectAllPrevEOGPaths(interproceduralAnalysis: Boolean): List<List<Node>>

Iterates the prev PDG edges until there are no more edges available (or until a loop is detected). Returns a list of possible paths (each path is represented by a list of nodes).

Link copied to clipboard

Iterates the prev full DFG edges until there are no more edges available (or until a loop is detected). Returns a list of possible paths (each path is represented by a list of nodes).

Link copied to clipboard
fun Node.collectAllPrevPDGPaths(interproceduralAnalysis: Boolean): List<List<Node>>

Iterates the prev PDG edges until there are no more edges available (or until a loop is detected). Returns a list of possible paths (each path is represented by a list of nodes).

Link copied to clipboard

All nodes which depend on this if statement

Link copied to clipboard
inline fun <T : Node> Node.dfgFrom(): List<T>
Link copied to clipboard

If a node should be removed from the graph, just removing it from the AST is not enough (see issue #60). It will most probably be referenced somewhere via DFG or EOG edges. Thus, if it needs to be disconnected completely, we will have to take care of correctly disconnecting these implicit edges.

Link copied to clipboard
inline fun <EdgeType : Edge<out Node>> Node.edges(noinline predicate: (EdgeType) -> Boolean = { true }): Collection<EdgeType>

Returns all Edges of EdgeType directly attached to this Node. Optionally, a predicate can be used to filter the edges even further.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
Link copied to clipboard
fun Node.firstParentOrNull(predicate: (Node) -> Boolean): Node?

This function tries to find the first parent node that satisfies the condition specified in predicate. It starts searching in the searchNode, moving up-wards using the Node.astParent attribute.

Link copied to clipboard
fun Node.followNextCDGUntilHit(collectFailedPaths: Boolean = true, findAllPossiblePaths: Boolean = true, interproceduralAnalysis: Boolean = false, predicate: (Node) -> Boolean): FulfilledAndFailedPaths

Returns an instance of FulfilledAndFailedPaths where FulfilledAndFailedPaths.fulfilled contains all possible shortest data flow paths (with ControlDependence) between the starting node this and the end node fulfilling predicate. The paths are represented as lists of nodes. Paths which do not end at such a node are included in FulfilledAndFailedPaths.failed.

Link copied to clipboard
fun Node.followNextEOG(predicate: (Edge<*>) -> Boolean): List<Edge<*>>?

Returns a list of edges which are from the evaluation order between the starting node this and an edge fulfilling predicate. If the return value is not null, a path from this to such an edge is possible but not mandatory.

Link copied to clipboard
fun Node.followNextEOGEdgesUntilHit(collectFailedPaths: Boolean = true, findAllPossiblePaths: Boolean = true, predicate: (Node) -> Boolean): FulfilledAndFailedPaths

Returns an instance of FulfilledAndFailedPaths where FulfilledAndFailedPaths.fulfilled contains all possible shortest evaluation paths between the starting node this and the end node fulfilling predicate. The paths are represented as lists of nodes. Paths which do not end at such a node are included in FulfilledAndFailedPaths.failed.

Link copied to clipboard
fun Node.followNextFullDFGEdgesUntilHit(collectFailedPaths: Boolean = true, findAllPossiblePaths: Boolean = true, predicate: (Node) -> Boolean): FulfilledAndFailedPaths

Returns an instance of FulfilledAndFailedPaths where FulfilledAndFailedPaths.fulfilled contains all possible shortest data flow paths (with FullDataflowGranularity) between the starting node this and the end node fulfilling predicate. The paths are represented as lists of nodes. Paths which do not end at such a node are included in FulfilledAndFailedPaths.failed.

Link copied to clipboard
fun Node.followNextPDGUntilHit(collectFailedPaths: Boolean = true, findAllPossiblePaths: Boolean = true, interproceduralAnalysis: Boolean = false, predicate: (Node) -> Boolean): FulfilledAndFailedPaths

Returns an instance of FulfilledAndFailedPaths where FulfilledAndFailedPaths.fulfilled contains all possible shortest data flow paths (with ProgramDependences) between the starting node this and the end node fulfilling predicate. The paths are represented as lists of nodes. Paths which do not end at such a node are included in FulfilledAndFailedPaths.failed.

Link copied to clipboard
fun Node.followPrevCDGUntilHit(collectFailedPaths: Boolean = true, findAllPossiblePaths: Boolean = true, interproceduralAnalysis: Boolean = false, predicate: (Node) -> Boolean): FulfilledAndFailedPaths

Returns an instance of FulfilledAndFailedPaths where FulfilledAndFailedPaths.fulfilled contains all possible shortest data flow paths (with ControlDependence) between the starting node this and the end node fulfilling predicate (backwards analysis). The paths are represented as lists of nodes. Paths which do not end at such a node are included in FulfilledAndFailedPaths.failed.

Link copied to clipboard
fun Node.followPrevEOG(predicate: (Edge<*>) -> Boolean): List<Edge<*>>?

Returns a list of edges which are from the evaluation order between the starting node this and an edge fulfilling predicate. If the return value is not null, a path from this to such an edge is possible but not mandatory.

Link copied to clipboard
fun Node.followPrevEOGEdgesUntilHit(collectFailedPaths: Boolean = true, findAllPossiblePaths: Boolean = true, predicate: (Node) -> Boolean): FulfilledAndFailedPaths

Returns an instance of FulfilledAndFailedPaths where FulfilledAndFailedPaths.fulfilled contains all possible shortest evaluation paths between the end node this and the start node fulfilling predicate. The paths are represented as lists of nodes. Paths which do not end at such a node are included in FulfilledAndFailedPaths.failed.

Link copied to clipboard

Returns a list of nodes which are a data flow path (with FullDataflowGranularity) between the starting node this and the end node fulfilling predicate. If the return value is not null, a data flow from this to such a node is possible but not mandatory.

Link copied to clipboard
fun Node.followPrevFullDFGEdgesUntilHit(collectFailedPaths: Boolean = true, findAllPossiblePaths: Boolean = true, predicate: (Node) -> Boolean): FulfilledAndFailedPaths

Returns an instance of FulfilledAndFailedPaths where FulfilledAndFailedPaths.fulfilled contains all possible shortest data flow paths (with FullDataflowGranularity) between the end node this and the starting node fulfilling predicate. The paths are represented as lists of nodes. Paths which do not end at such a node are included in FulfilledAndFailedPaths.failed.

Link copied to clipboard
fun Node.followPrevPDGUntilHit(collectFailedPaths: Boolean = true, findAllPossiblePaths: Boolean = true, interproceduralAnalysis: Boolean = false, predicate: (Node) -> Boolean): FulfilledAndFailedPaths

Returns an instance of FulfilledAndFailedPaths where FulfilledAndFailedPaths.fulfilled contains all possible shortest data flow paths (with ProgramDependences) between the starting node this and the end node fulfilling predicate (backwards analysis). The paths are represented as lists of nodes. Paths which do not end at such a node are included in FulfilledAndFailedPaths.failed.

Link copied to clipboard
fun Node.followXUntilHit(x: (Node) -> List<Node>, collectFailedPaths: Boolean = true, findAllPossiblePaths: Boolean = true, predicate: (Node) -> Boolean): FulfilledAndFailedPaths

Returns an instance of FulfilledAndFailedPaths where FulfilledAndFailedPaths.fulfilled contains all possible shortest data flow paths (with x specifying how to fetch more nodes) between the starting node this and the end node fulfilling predicate (backwards analysis). The paths are represented as lists of nodes. Paths which do not end at such a node are included in FulfilledAndFailedPaths.failed.

Link copied to clipboard
open override fun hashCode(): Int

Implementation of hash code. We are including the name and the location in this hash code as a compromise between including too few attributes and performance. Please note that this means, that two nodes that might be semantically equal, such as two record declarations with the same name but different location (e.g. because of header files) will be sorted into different hash keys.

Link copied to clipboard
Link copied to clipboard

Checks, whether the given Type is a primitive in the language specified in the LanguageProvider.

Link copied to clipboard

Creates a new Annotation. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new AnnotationMember. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new AssertStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newAssignExpression(operatorCode: String = "=", lhs: List<Expression> = listOf(), rhs: List<Expression> = listOf(), rawNode: Any? = null): AssignExpression

Creates a new AssignExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new BinaryOperator or a ShortCircuitOperator if the language implements HasShortCircuitOperators and if the operatorCode is contained in HasShortCircuitOperators.operatorCodes. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new Block. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new BreakStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newCallExpression(callee: Expression? = null, fqn: CharSequence? = null, template: Boolean = false, rawNode: Any? = null): CallExpression

Creates a new CallExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new CaseStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new CastExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new CatchClause. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newConditionalExpression(condition: Expression, thenExpression: Expression? = null, elseExpression: Expression? = null, type: Type = unknownType(), rawNode: Any? = null): ConditionalExpression

Creates a new ConditionalExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ConstructExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ConstructorDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ContinueStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new DeclarationStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new DefaultStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new DeleteExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new DistinctLanguageBlock. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new DoStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new EmptyStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new EnumConstantDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new EnumDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ExpressionList. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newFieldDeclaration(name: CharSequence?, type: Type = unknownType(), modifiers: List<String>? = listOf(), initializer: Expression? = null, implicitInitializerAllowed: Boolean = false, rawNode: Any? = null): FieldDeclaration

Creates a new FieldDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ForEachStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ForStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newFunctionDeclaration(name: CharSequence?, localNameOnly: Boolean = false, rawNode: Any? = null): FunctionDeclaration

Creates a new FunctionDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new FunctionTemplateDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new GotoStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new IfStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newImportDeclaration(import: Name, wildcardImport: Boolean = false, alias: Name? = null, rawNode: Any? = null): ImportDeclaration

Creates a new ImportDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new IncludeDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new InitializerListExpression. This is the top-most Node that a LanguageFrontend or Handler should create. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new KeyValueExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new LabelStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new LambdaExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new LookupScopeStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new MemberCallExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newMemberExpression(name: CharSequence?, base: Expression, memberType: Type = unknownType(), operatorCode: String? = ".", rawNode: Any? = null): MemberExpression

Creates a new MemberExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newMethodDeclaration(name: CharSequence?, isStatic: Boolean = false, recordDeclaration: RecordDeclaration? = null, rawNode: Any? = null): MethodDeclaration

Creates a new MethodDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun LanguageProvider.newName(name: CharSequence, localNameOnly: Boolean = false, namespace: Name? = null): Name

Generates a Name object from the given name. If localNameOnly is set, only the localName is used, otherwise the namespace is added to generate a fqn if the name is not a fqn anyway.

Link copied to clipboard

Creates a new NamespaceDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new NewArrayExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newNewExpression(type: Type = unknownType(), rawNode: Any? = null): NewExpression

Creates a new NewExpression. This is the top-most Node that a LanguageFrontend or Handler should create. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new MemberCallExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newOperatorDeclaration(name: CharSequence, operatorCode: String, recordDeclaration: RecordDeclaration? = null, rawNode: Any? = null): OperatorDeclaration

Creates a new OperatorDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newParameterDeclaration(name: CharSequence?, type: Type = unknownType(), variadic: Boolean = false, rawNode: Any? = null): ParameterDeclaration

Creates a new ParameterDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newProblemDeclaration(problem: String = "", problemType: ProblemNode.ProblemType = ProblemNode.ProblemType.PARSING, rawNode: Any? = null): ProblemDeclaration

Creates a new ProblemDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newProblemExpression(problem: String = "", type: ProblemNode.ProblemType = ProblemNode.ProblemType.PARSING, rawNode: Any? = null): ProblemExpression

Creates a new ProblemExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
Link copied to clipboard
fun MetadataProvider.newRangeExpression(floor: Expression? = null, ceiling: Expression? = null, rawNode: Any? = null): RangeExpression

Creates a new RangeExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new RecordDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new RecordTemplateDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newReference(name: CharSequence?, type: Type = unknownType(), rawNode: Any? = null): Reference

Creates a new Reference. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ReturnStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new SubscriptExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new SwitchStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new SynchronizedStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ThrowExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new TranslationUnitDeclaration. This is the top-most Node that a LanguageFrontend or Handler should create. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new TryStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new TupleDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new TypedefDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newTypeExpression(name: CharSequence?, type: Type = unknownType(), rawNode: Any? = null): TypeExpression

Creates a new TypeExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newTypeIdExpression(operatorCode: String, type: Type = unknownType(), referencedType: Type = unknownType(), rawNode: Any? = null): TypeIdExpression

Creates a new TypeIdExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new TypeParameterDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newUnaryOperator(operatorCode: String, postfix: Boolean, prefix: Boolean, rawNode: Any? = null): UnaryOperator

Creates a new UnaryOperator. This is the top-most Node that a LanguageFrontend or Handler should create. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newVariableDeclaration(name: CharSequence?, type: Type = unknownType(), implicitInitializerAllowed: Boolean = false, rawNode: Any? = null): VariableDeclaration

Creates a new VariableDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new WhileStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

The "object identifier" of a node can be used to differentiate different "objects" that a node (most likely a Reference) refers to.

Link copied to clipboard
fun LanguageProvider.objectType(name: CharSequence, generics: List<Type> = listOf(), rawNode: Any? = null): Type

This function returns an ObjectType with the given name. If a respective Type does not yet exist (in the current scope), it will be created. In order to avoid unnecessary allocation of simple types, we do a pre-check within this function, whether a built-in type exist with the particular name.

Link copied to clipboard

A small utility extension function that uses the language information in a LanguageProvider (such as a Node, a Language, a LanguageFrontend or a Handler) to parse a fully qualified name.

Link copied to clipboard
operator fun plusAssign(declaration: Declaration)
Link copied to clipboard

This function constructs a new primitive Type. Primitive or built-in types are defined in Language.builtInTypes. This function will look up the type by its name, if it fails to find an appropriate build-in type, a TranslationException is thrown. Therefore, this function should primarily be called by language frontends if they are sure that this type is a built-in type, e.g., when constructing literals. It can be useful, if frontends want to check, whether all literal types are correctly registered as built-in types.

Link copied to clipboard
fun Node.printDFG(maxConnections: Int = 25): String

Utility function to print the DFG using printGraph.

Link copied to clipboard
fun <T : Edge<Node>> Node.printGraph(nextEdgeGetter: KProperty1<Node, MutableCollection<T>>, prevEdgeGetter: KProperty1<Node, MutableCollection<T>>, maxConnections: Int = 25): String

This function prints a partial graph, limited to a particular set of edges, starting with the current Node as Markdown, with an embedded Mermaid graph. The output can either be pasted into a Markdown document (and then rendered) or directly pasted into GitHub issues, discussions or pull requests (see https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/).

Link copied to clipboard

Returns a new Inference object starting from this node. This will check, whether inference is enabled at all (using InferenceConfiguration.enabled). Otherwise null, will be returned.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Creates a new UnknownType and sets the appropriate language, if this MetadataProvider includes a LanguageProvider.