public abstract class ScopeExp extends Expression
SourceLocator.Simple
Modifier and Type | Field and Description |
---|---|
protected int |
frameSize
Size of evalFrame to allocate in interpreter.
|
int |
id
Unique id number, to ease print-outs and debugging.
|
protected Scope |
scope |
applyMethodExpression, flags, NEXT_AVAIL_FLAG, noExpressions, type, VALIDATED
applyMethodType, applyToConsumerDefault, applyToConsumerMethod, applyToObjectDefault, applyToObjectMethod, compilerKey, compilerXKey, inlineIfConstantSymbol, validateApplyKey, validateXApplyKey
nameKey
Constructor and Description |
---|
ScopeExp() |
Modifier and Type | Method and Description |
---|---|
void |
add(Declaration decl) |
void |
add(Declaration prev,
Declaration decl)
Add a Declaration at a specified position.
|
void |
addDeclaration(Declaration decl)
Add a Declaration to the current Scope.
|
Declaration |
addDeclaration(java.lang.Object name)
Create a new declaration in the current Scope.
|
Declaration |
addDeclaration(java.lang.Object name,
Type type)
Create a new declaration in the current Scope.
|
void |
clearCallList() |
int |
countDecls() |
LambdaExp |
currentLambda() |
ModuleExp |
currentModule() |
static void |
duplicateDeclarationError(Declaration oldDecl,
Declaration newDecl,
Compilation comp) |
Declaration |
firstDecl() |
Declaration |
getDefine(java.lang.Object name,
Compilation parser)
Add a new Declaration, with a message if there is an existing one.
|
Declaration |
getNoDefine(java.lang.Object name)
Lookup a declaration, create a non-defining declaration if needed.
|
ScopeExp |
getOuter()
Return the statically enclosing binding contour.
|
Scope |
getVarScope() |
boolean |
isClassGenerated()
True if a class is generated for this scope.
|
Declaration |
lastDecl() |
Declaration |
lookup(java.lang.Object sym)
Find a Declaration by name.
|
Declaration |
lookup(java.lang.Object sym,
Language language,
int namespace) |
boolean |
nestedIn(ScopeExp outer)
True if given scope is nesed in this scope, perhaps indirectly.
|
static int |
nesting(ScopeExp sc) |
void |
popScope(CodeAttr code)
Clear bytecode resources for the ScopeExp.
|
void |
remove(Declaration decl) |
void |
remove(Declaration prev,
Declaration decl) |
void |
replaceFollowing(Declaration prev,
Declaration newDecl)
Replace the
prev.next by newDecl . |
protected void |
setIndexes()
Calculate offset and frameSize needed by interpreter.
|
void |
setOuter(ScopeExp outer) |
ScopeExp |
topLevel()
Return the outermost non-module scope, if there is one.
|
java.lang.String |
toString() |
protected <R,D> R |
visit(ExpVisitor<R,D> visitor,
D d) |
apply, applyMethodExpression, calculateType, checkLiteralKeyword, compile, compile, compile, compileWithPosition, compileWithPosition, deepCopy, deepCopy, deepCopy, deepCopy, eval, eval, getColumnNumber, getEndColumn, getEndLine, getFileName, getFlag, getFlags, getLineNumber, getPublicId, getStartColumn, getStartLine, getSystemId, getType, getTypeRaw, isSingleValue, isStableSourceLocation, makeWhile, maybeSetLine, mustCompile, neverReturns, numArgs, print, print, printLineColumn, setFile, setFlag, setFlag, setLine, setLine, setLine, setLine, setLine, setLocation, setType, side_effects, validateApply, valueIfConstant, visitChildren
apply0, apply1, apply2, apply3, apply4, applyL, applyN, applyToConsumerDefault, applyToObjectDefault, checkArgCount, checkBadCode, getApplyMethod, getApplyToConsumerMethod, getApplyToObjectMethod, getReturnType, getSetter, getSourceLocation, isSideEffectFree, lookupApplyHandle, maxArgs, maxArgs, minArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation
getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol
protected Scope scope
protected int frameSize
public int id
public Declaration firstDecl()
public Declaration lastDecl()
public Scope getVarScope()
public void popScope(CodeAttr code)
public void add(Declaration decl)
public void add(Declaration prev, Declaration decl)
public void replaceFollowing(Declaration prev, Declaration newDecl)
prev.next
by newDecl
.
If prev==null
, replace the first decl.public void remove(Declaration decl)
public void remove(Declaration prev, Declaration decl)
public ScopeExp getOuter()
public void setOuter(ScopeExp outer)
public LambdaExp currentLambda()
public ScopeExp topLevel()
public ModuleExp currentModule()
public Declaration lookup(java.lang.Object sym)
sym
- the (interned) name of the Declaration soughtpublic Declaration lookup(java.lang.Object sym, Language language, int namespace)
public Declaration getNoDefine(java.lang.Object name)
public Declaration getDefine(java.lang.Object name, Compilation parser)
public static void duplicateDeclarationError(Declaration oldDecl, Declaration newDecl, Compilation comp)
public final Declaration addDeclaration(java.lang.Object name)
name
- name (interned) to give to the new Declaration.public final Declaration addDeclaration(java.lang.Object name, Type type)
name
- name (interned) to give to the new Declaration.type
- type of the new Declaration.public final void addDeclaration(Declaration decl)
public int countDecls()
public void clearCallList()
public static int nesting(ScopeExp sc)
public boolean nestedIn(ScopeExp outer)
protected void setIndexes()
protected <R,D> R visit(ExpVisitor<R,D> visitor, D d)
visit
in class Expression
public final boolean isClassGenerated()
public java.lang.String toString()
toString
in class Expression