Fixed the Program call
This commit is contained in:
parent
5de106876a
commit
965b758fba
@ -12,7 +12,7 @@ public class Compiler {
|
|||||||
|
|
||||||
// get file
|
// get file
|
||||||
|
|
||||||
Program abstractSyntaxTree = new Program();
|
Program abstractSyntaxTree = new Program(new ArrayList<>());
|
||||||
List<FieldDecl> emptyFieldDecl = new ArrayList<>();
|
List<FieldDecl> emptyFieldDecl = new ArrayList<>();
|
||||||
List<MethodDecl> emptyMethodDecl = new ArrayList<>();
|
List<MethodDecl> emptyMethodDecl = new ArrayList<>();
|
||||||
abstractSyntaxTree.classes.add(new RefType(emptyFieldDecl, emptyMethodDecl, null, null));
|
abstractSyntaxTree.classes.add(new RefType(emptyFieldDecl, emptyMethodDecl, null, null));
|
||||||
|
@ -18,10 +18,16 @@ import java.util.jar.JarOutputStream;
|
|||||||
|
|
||||||
public class Program {
|
public class Program {
|
||||||
public List<RefType> classes;
|
public List<RefType> classes;
|
||||||
|
|
||||||
public HashMap<String, HashMap<String, String>> typeContext; // (class, (type, identifier))
|
public HashMap<String, HashMap<String, String>> typeContext; // (class, (type, identifier))
|
||||||
public HashMap<String, HashMap<String, HashMap<String, List<String>>>> methodContext; // (class, (returntype, (identifier, parameter)))
|
public HashMap<String, HashMap<String, HashMap<String, List<String>>>> methodContext; // (class, (returntype, (identifier, parameter)))
|
||||||
|
|
||||||
|
public Program(List<RefType> classes){
|
||||||
|
this.classes = classes;
|
||||||
|
this.typeContext = new HashMap<>();
|
||||||
|
this.methodContext = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public TypeCheckResult typeCheck() throws Exception{
|
public TypeCheckResult typeCheck() throws Exception{
|
||||||
for(RefType oneClass : classes){
|
for(RefType oneClass : classes){
|
||||||
HashMap<String, String> classVars = new HashMap<>();
|
HashMap<String, String> classVars = new HashMap<>();
|
||||||
|
Loading…
Reference in New Issue
Block a user