NameAnalysis

class NameAnalysis

Associates each use of a Name with its declaration, and every Name declaration with the set of its uses.

For example, Temporary variables are associated with LetNodes, ObjectVariables with DeclarationNodes, and JumpLabels with InfiniteLoopNodes.

Types

Companion
Link copied to clipboard
object Companion : AnalysisProvider<NameAnalysis>

Functions

argumentUses
Link copied to clipboard
fun argumentUses(node: DeclarationNode): Set<FunctionArgumentNode>
fun argumentUses(node: ObjectDeclarationArgumentNode): Set<FunctionArgumentNode>
fun argumentUses(node: ParameterNode): Set<FunctionArgumentNode>

Returns the set of arguments where node is used.

asObjectDeclaration
Link copied to clipboard
calls
Link copied to clipboard
fun calls(function: FunctionDeclarationNode): Set<FunctionCallNode>

Returns the set of calls to the given function declaration.

check
Link copied to clipboard
fun check()

Asserts that every referenced Name has a declaration, and that no Name is declared multiple times in the same scope.

correspondingBreaks
Link copied to clipboard
fun correspondingBreaks(node: InfiniteLoopNode): Set<BreakNode>

Returns the set of BreakNodes that reference node.

correspondingLet
Link copied to clipboard
fun correspondingLet(query: QueryNode): LetNode
correspondingLoop
Link copied to clipboard
fun correspondingLoop(node: BreakNode): InfiniteLoopNode

Returns the loop that node is breaking out of.

declaration
Link copied to clipboard
fun declaration(node: CommunicationNode): HostDeclarationNode

Returns the declaration of the Host in node.

fun declaration(node: FunctionCallNode): FunctionDeclarationNode

Returns the declaration of the function being called in node.

fun declaration(node: ObjectReferenceArgumentNode): ObjectDeclaration
fun declaration(node: OutParameterArgumentNode): ParameterNode

Returns the object referenced by the node function argument.

fun declaration(node: OutParameterInitializationNode): ParameterNode

Returns the declaration of the out parameter in node.

fun declaration(node: QueryNode): ObjectDeclaration
fun declaration(node: UpdateNode): ObjectDeclaration

Returns the statement that declares the ObjectVariable in node.

fun declaration(node: ReadNode): LetNode

Returns the statement that defines the Temporary in node.

enclosingBlock
Link copied to clipboard
fun enclosingBlock(stmt: StatementNode): BlockNode

Get the block that encloses this statement.

enclosingFunctionName
Link copied to clipboard
fun enclosingFunctionName(node: ExpressionNode): FunctionName
fun enclosingFunctionName(node: FunctionArgumentNode): FunctionName
fun enclosingFunctionName(node: StatementNode): FunctionName
enclosingStatement
Link copied to clipboard
fun enclosingStatement(read: ReadNode): StatementNode

Return the statement enclosing the read node.

functionDeclaration
Link copied to clipboard
fun functionDeclaration(parameter: ParameterNode): FunctionDeclarationNode
involvedLoops
Link copied to clipboard
fun involvedLoops(node: Node): List<InfiniteLoopNode>

Returns the list of InfiniteLoopNodes node is contained in.

parameter
Link copied to clipboard
fun parameter(node: FunctionArgumentNode): ParameterNode

Returns the parameter for which node is the argument.

parameterUsers
Link copied to clipboard
fun parameterUsers(parameter: ParameterNode): Set<FunctionArgumentNode>

Returns the set of arguments for ParameterNode.

parameterUses
Link copied to clipboard
fun parameterUses(node: DeclarationNode): Set<ParameterNode>
fun parameterUses(node: ObjectDeclarationArgumentNode): Set<ParameterNode>
fun parameterUses(node: ParameterNode): Set<ParameterNode>

Returns the set of parameters for which node is used as an argument.

queriers
Link copied to clipboard
fun queriers(node: DeclarationNode): Set<QueryNode>
fun queriers(node: ObjectDeclarationArgumentNode): Set<QueryNode>
fun queriers(node: ParameterNode): Set<QueryNode>

Returns the set of QueryNodes that reference the ObjectVariable declared by node.

reachableFunctions
Link copied to clipboard
fun reachableFunctions(node: Node): PersistentSet<FunctionName>

Returns the set of functions transitively reachable from a statement node.

readers
Link copied to clipboard
fun readers(node: LetNode): Set<StatementNode>

Returns the set of StatementNodes that read the Temporary defined by node.

reads
Link copied to clipboard
fun reads(node: Node): Set<ReadNode>
updaters
Link copied to clipboard
fun updaters(node: DeclarationNode): Set<UpdateNode>
fun updaters(node: ObjectDeclarationArgumentNode): Set<UpdateNode>
fun updaters(node: ParameterNode): Set<UpdateNode>

Returns the set of UpdateNodes that reference the ObjectVariable declared by node.

users
Link copied to clipboard
fun users(node: DeclarationNode): Set<Node>
fun users(node: ObjectDeclarationArgumentNode): Set<Node>
fun users(node: ParameterNode): Set<Node>

Returns the set of QueryNodes and UpdateNodes that reference the ObjectVariable declared by node.

variables
Link copied to clipboard
fun variables(node: StatementNode): Set<FunctionVariable>

Returns the variables used of a node.