Package-level declarations

Types

Link copied to clipboard

Expressions can have multiple types of accesses. Determines dataflow (DFG) edges

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

This interfaces denotes that Node can accept arguments. The most famous example would be a CallExpression to populate CallExpression.arguments or the ReturnStatement.returnValue of a return statement.

Link copied to clipboard
class Assignment(val value: Expression, val target: HasType, val holder: AssignmentHolder) : Edge<Node>

An assignment assigns a certain value (usually an Expression) to a certain target.

Link copied to clipboard

An assignment holder is a node that intentionally contains assignment edges.

Link copied to clipboard
interface BranchingNode

A node triggering a conditional execution of other code.

Link copied to clipboard

This interface denotes that the class is able to provide source code and location information for a specific node.

Link copied to clipboard
open class Component : Node

A node which presents some kind of complete piece of software, e.g., an application, a library, microservice, ...

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

This interface needs to be implemented by Nodes in the graph, wo serve as an entry-point to the EOG. This is primarily used in the SymbolResolver for resolution, so that we can follow the EOG path from these nodes and resolve all symbols accordingly. But also other passes might be interested in all EOG start nodes. They can use the EOGStarterPass to apply the pass on all such nodes in the graph.

Link copied to clipboard
class FulfilledAndFailedPaths(val fulfilled: List<List<Node>>, val failed: List<List<Node>>)
Link copied to clipboard
interface HasAliases : HasScope

Some nodes have aliases, i.e., it potentially references another variable. This means that writing to this node, also writes to its aliases and vice-versa.

Link copied to clipboard

Specifies that a certain node has a base on which it executes an operation.

Link copied to clipboard
interface HasDefault<T : Node?> : HasScope

Interface that allows us to mark nodes that contain a default value

Link copied to clipboard

Specifies that a certain node has an initializer. It is a special case of ArgumentHolder, in which the initializer is treated as the first (and only) argument.

Link copied to clipboard
interface HasLanguage

A simple interface that a node has language.

Link copied to clipboard

A simple interface that a node has name and location.

Link copied to clipboard

A simple interface to denote that the implementing class has some kind of operatorCode.

Link copied to clipboard

Specifies that this node (e.g. a BinaryOperator contains an operation that can be overloaded by an OperatorDeclaration.

Link copied to clipboard

A simple interface that a node has scope.

Link copied to clipboard

This interface denotes that a Node "holds" a list of other nodes. See also ArgumentHolder and StatementHolder, in which Holder is used as a common interface.

Link copied to clipboard

A simple interface that everything, that supplies a language, should implement. Examples include each Node, but also transformation steps, such as Handler.

Link copied to clipboard

This interfaces serves as base for different entities that provide some kind of meta-data for a Node, such as its language, code or location.

Link copied to clipboard
class Name(val localName: String, val parent: Name? = null, val delimiter: String = ".") : Cloneable, Comparable<Name> , CharSequence

This class represents anything that can have a "Name". In the simplest case it only represents a local name in a flat hierarchy, such as myVariable. However, it can also be used to represent fully qualified name with a complex name hierarchy, such as my::namespace::function.

Link copied to clipboard

This interface denotes that the class is able to provide the current namespace. The applyMetadata will use this information to set the parent of a Name.

Link copied to clipboard

The base class for all graph objects that are going to be persisted in the database.

Link copied to clipboard
Link copied to clipboard
interface Persistable
Link copied to clipboard
interface ProblemNode

Interface for a node representing some kind of failure during the translation or while parsing.

Link copied to clipboard

This MetadataProvider makes sure that we can type our node builder functions correctly. For language frontend and handlers, T should be set to the type of the raw node. For passes, T should be set to Nothing, since we do not have raw nodes there.

Link copied to clipboard

This interfaces serves as a base for entities that provide the current scope / name prefix. This is reserved for future use.

Link copied to clipboard
Link copied to clipboard

This interface denotes an AST node that can contain code. This code is stored as statements. This includes Translation units namespaces and classes as some languages, mainly scripting languages allow code placement outside explicit functions.

Link copied to clipboard

Properties

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

Returns the expression specifying the dimension (i.e., size) of the array during its initialization.

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

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

Set of all functions which are called from this function

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

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

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

Returns the Assignment.value of the first (by EOG order beginning from) Assignment that this variable has as its Assignment.target in the scope of the variable.

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

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

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

Link copied to clipboard

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

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

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

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

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

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

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
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
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
fun Type.array(): Type

Returns a PointerType that describes an array reference to the current type.

Link copied to clipboard
@JvmName(name = "astNodes")
fun Node.ast(): List<Node>
inline fun <T : Node> Node.ast(): List<T>
Link copied to clipboard
Link copied to clipboard
inline fun <T : Statement> FunctionDeclaration.body(n: Int = 0): T

This inline function returns the n-th body statement (in AST order) as specified in T. It throws a StatementNotFound exception if it does not exist or match the type.

Link copied to clipboard
inline fun <T : Statement> FunctionDeclaration.bodyOrNull(n: Int = 0): T?

This inline function returns the n-th body statement (in AST order) cast as T or null if it does not exist or the type does not match.

Link copied to clipboard
fun <T : Node> Collection<T>?.byNameOrNull(lookup: String, modifier: SearchModifier): T?

This function returns the first node that matches the name on the supplied list of nodes.

Link copied to clipboard

Set of all functions calling function

Link copied to clipboard

Returns all CallExpressions in this graph which call a method with the given name.

Link copied to clipboard
fun <T : Node> T.codeAndLocationFrom(other: Node): T
Link copied to clipboard
fun <T : Node, AstNode> T.codeAndLocationFromChildren(parentNode: AstNode, lineBreakSequence: CharSequence = ""): T

This function allows the setting of a node's code and location region as the code and location of its children. Sometimes, when we translate a parent node in the language-specific AST with its children into the CPG AST, we have to set a specific intermediate Node between, that has no language-specific AST that can give it a proper code and location.

Link copied to clipboard

Sometimes we need to explicitly (re)set the code and location of a node to another raw node than originally used in the node builder. A common use-case for that is languages that contain expression statements, which we simplify to simple expressions. But in these languages, the expression often does not contain a semicolon at the end, where-as the statement does. In this case we want to preserve the original code containing the semicolon and need to set the node's code/location to the statement rather than the expression, after it comes back from the expression handler.

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

All nodes which depend on this if statement

Link copied to clipboard
inline fun <T : Node> Node.dfgFrom(): List<T>
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
fun NamespaceProvider.fqn(localName: String): Name

Returns a new Name based on the localName and the current namespace as parent.

fun Name?.fqn(localName: String, delimiter: String = this?.delimiter ?: "."): Name

Returns a new Name based on the localName and the current name as parent.

Link copied to clipboard

Retrieves the n-th statement of the body of this function declaration.

operator fun <T : Node> Collection<T>?.get(predicate: (T) -> Boolean, modifier: SearchModifier = SearchModifier.NONE): T?

A shortcut to call firstOrNull using the [] syntax.

operator fun <T : Node> Collection<T>?.get(lookup: String, modifier: SearchModifier = SearchModifier.NONE): T?

A shortcut to call byNameOrNull using the [] syntax.

Link copied to clipboard
fun <T : Node> T.implicit(code: String? = null, location: PhysicalLocation? = null): T

A small helper function that can be used in building a Node with Node.isImplicit set to true. In this case, no "rawNode" exists that can be used for the node builder. But, in order to optionally supply Node.code and/or Node.location this function can be used.

Link copied to clipboard
Link copied to clipboard
operator fun <N : Expression> Expression?.invoke(): N?

operator fun <T : Node> Collection<T>.invoke(predicate: (T) -> Boolean): List<T>

A shortcut invoke filter on a list of nodes.

operator fun <T : Node> Collection<T>.invoke(lookup: String): List<T>

A shortcut to filter a list of nodes by their name.

inline operator fun <T> List<Node>.invoke(i: Int = 0): T?

Returns the i-th item in this list (or null) and casts it to T.

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
fun <T, V> RawNodeTypeProvider<T>.newLiteral(value: V, type: Type = unknownType(), rawNode: Any? = null): Literal<V>

Creates a new Literal. 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 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
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

Returns a PointerType that describes a pointer reference to the current type.

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
fun Type.ref(): Type
Link copied to clipboard

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

Link copied to clipboard

This is a small utility function to "unwrap" a Reference that it is wrapped in (multiple) Expression nodes. This will only work on expression that only have one "argument" (such as a unary operator), in order to avoid ambiguous results. This can be useful for data-flow analysis, if you want to quickly retrieve the reference that is affected by an operation. For example in C++ it is common to take an address of a variable and cast it into an appropriate type: