forked from kasonyang/kalang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lbqh
committed
Nov 30, 2018
1 parent
34f823b
commit e1f9cc7
Showing
2 changed files
with
82 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package kalang.compiler.compile; | ||
|
||
import kalang.compiler.ast.ClassNode; | ||
import kalang.compiler.ast.LocalVarNode; | ||
import kalang.compiler.ast.MethodNode; | ||
import kalang.compiler.ast.VarObject; | ||
import kalang.compiler.core.Type; | ||
import kalang.compiler.core.VarTable; | ||
|
||
public class MethodContext { | ||
|
||
public final ClassNode classNode; | ||
|
||
public final MethodNode method; | ||
|
||
public boolean returned = false; | ||
|
||
public VarTable<String,LocalVarNode> varTables = new VarTable(); | ||
|
||
public VarTable<VarObject, Type> overrideTypes = new VarTable(); | ||
|
||
public VarTable<VarObject,Integer> nullState = new VarTable(); | ||
|
||
public MethodContext(ClassNode classNode, MethodNode methodNode) { | ||
this.classNode = classNode; | ||
this.method = methodNode; | ||
} | ||
|
||
public void newFrame(){ | ||
this.varTables = varTables.newStack(); | ||
} | ||
|
||
public void popFrame(){ | ||
this.varTables = this.varTables.popStack(); | ||
} | ||
|
||
} |