Abstract class for expressions that add local variable bindings.
addDeclaration
public final Declaration addDeclaration(Object name)
Create a new declaration in the current Scope.
name
- name (interned) to give to the new Declaration.
addDeclaration
public final Declaration addDeclaration(Object name,
Type type)
Create a new declaration in the current Scope.
name
- name (interned) to give to the new Declaration.type
- type of the new Declaration.
addDeclaration
public final void addDeclaration(Declaration decl)
Add a Declaration to the current Scope.
countDecls
public int countDecls()
currentLambda
public LambdaExp currentLambda()
currentModule
public ModuleExp currentModule()
getDefine
public Declaration getDefine(Object name,
char severity,
Compilation parser)
Add a new Declaration, with a message if there is an existing one.
getNoDefine
public Declaration getNoDefine(Object name)
Lookup a declaration, create a non-defining declaration if needed.
getVarScope
public Scope getVarScope()
lookup
public Declaration lookup(Object sym)
Find a Declaration by name.
sym
- the (interned) name of the Declaration sought
- the matching Declaration, if found; otherwise null
nesting
public static int nesting(ScopeExp sc)
popScope
public void popScope(CodeAttr code)
Clear bytecode resources for the ScopeExp.
This potentially allows Kawa to generate code for the same (inlined,
shared) ScopeExp multiple times - though we're not making use of that yet.
replaceFollowing
public void replaceFollowing(Declaration prev,
Declaration newDecl)
Replace the prev.next
by newDecl
.
If prev==null
, replace the first decl.