Package org.basex.query.var
Class VarScope
java.lang.Object
org.basex.query.var.VarScope
The scope of variables, either the query, a user-defined or an inline function.
- Author:
- BaseX Team 2005-21, BSD License, Leo Woerteler
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a variable to this scope.addNew(QNm name, SeqType st, boolean param, QueryContext qc, InputInfo ii) Creates a new local variable in this scope.voidDeletes all unused variables from this scope and assigns stack slots.voidcopy(CompileContext cc, IntObjMap<Var> vm) Returns a copy of this variable scope.intenter(QueryContext qc) Enters this scope.static voidexit(int fp, QueryContext qc) Exits this scope.intStack-frame size needed for this scope.toString()
-
Field Details
-
sc
Static context.
-
-
Constructor Details
-
VarScope
Constructor for a top-level module.- Parameters:
sc- static context
-
-
Method Details
-
add
Adds a variable to this scope.- Parameters:
var- variable to be added- Returns:
- the variable (for convenience)
-
addNew
Creates a new local variable in this scope.- Parameters:
name- variable namest- type of the variable (can benull)param- function parameter flagqc- query contextii- input info- Returns:
- the variable
-
enter
Enters this scope.- Parameters:
qc- query context- Returns:
- old frame pointer
-
exit
Exits this scope.- Parameters:
fp- frame pointerqc- query context
-
cleanUp
Deletes all unused variables from this scope and assigns stack slots.- Parameters:
scope- the scope
-
toString
-
stackSize
public int stackSize()Stack-frame size needed for this scope.- Returns:
- stack-frame size
-
copy
Returns a copy of this variable scope.- Parameters:
cc- compilation contextvm- variable mapping
-