Compare commits
2 Commits
9cda409dd3
...
f273c74693
Author | SHA1 | Date | |
---|---|---|---|
|
f273c74693 | ||
|
783bab8580 |
1
Source/.idea/Source.iml
generated
1
Source/.idea/Source.iml
generated
@ -7,5 +7,6 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="asm-9.7" level="project" />
|
||||
</component>
|
||||
</module>
|
9
Source/.idea/libraries/asm_9_7.xml
generated
Normal file
9
Source/.idea/libraries/asm_9_7.xml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="asm-9.7">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../Lib/asm-9.7.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
@ -9,27 +9,21 @@ import java.util.List;
|
||||
|
||||
public class MethodDecl implements IClass {
|
||||
|
||||
// name
|
||||
public String classThatContainsMethod;
|
||||
public String name;
|
||||
public List<String> parameters;
|
||||
public String returnType;
|
||||
|
||||
private HashMap<String, HashMap<String, HashMap<String, String>>> methodContext;
|
||||
private HashMap<String, HashMap<String, String>> typeContext;
|
||||
|
||||
//TODO: Move this into the typeCheck
|
||||
private HashMap<String, String> localVars; // (type, identifier) // add content here
|
||||
|
||||
public MethodDecl(HashMap<String, HashMap<String, HashMap<String, String>>> methodContext, HashMap<String, HashMap<String, String>> typeContext){
|
||||
this.methodContext = methodContext;
|
||||
this.typeContext = typeContext;
|
||||
}
|
||||
public TypeCheckResult typeCheck(List<MethodDecl> fieldsOrMethods) throws Exception {
|
||||
public TypeCheckResult typeCheck(HashMap<String, HashMap<String, HashMap<String, String>>> methodContext, HashMap<String, HashMap<String, String>> typeContext, List<MethodDecl> fieldsOrMethods) throws Exception {
|
||||
// write localvars
|
||||
|
||||
|
||||
// jede methode als block statement aufrufen
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void codeGen(ClassWriter cw) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class RefType extends AbstractType implements IClass {
|
||||
}
|
||||
|
||||
for (MethodDecl methodDecl : methodDecls) {
|
||||
methodDecl.typeCheck(methodDecls);
|
||||
methodDecl.typeCheck(methodContext, typeContext, methodDecls);
|
||||
}
|
||||
|
||||
result.type = "class";
|
||||
|
@ -2,10 +2,14 @@ package abstractSyntaxTree;
|
||||
|
||||
import TypeCheck.TypeCheckResult;
|
||||
import abstractSyntaxTree.Class.FieldDecl;
|
||||
import abstractSyntaxTree.Class.MethodDecl;
|
||||
import abstractSyntaxTree.Datatype.RefType;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import abstractSyntaxTree.Class.RefType;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
@ -17,13 +21,25 @@ public class Program {
|
||||
public List<RefType> classes;
|
||||
|
||||
public HashMap<String, HashMap<String, String>> typeContext; // (class, (type, identifier))
|
||||
public HashMap<String, HashMap<String, HashMap<String, String>>> methodContext; // (class, (returntype, (identifier, parameter)))
|
||||
public HashMap<String, HashMap<String, HashMap<String, List<String>>>> methodContext; // (class, (returntype, (identifier, parameter)))
|
||||
|
||||
public TypeCheckResult typeCheck() throws Exception{
|
||||
for(RefType oneClass : classes){
|
||||
HashMap<String, String> classVars = new HashMap<>();
|
||||
for (FieldDecl fielsDecl: oneClass.fieldDecls)
|
||||
classVars.put(fielsDecl.type, fielsDecl.identifier);
|
||||
for (FieldDecl fieldDecl: oneClass.fieldDecls){
|
||||
classVars.put(fieldDecl.type, fieldDecl.identifier);
|
||||
}
|
||||
typeContext.put(oneClass.name, classVars);
|
||||
|
||||
HashMap<String, List<String>> methodIdentifierAndParameter = new HashMap<>();
|
||||
HashMap<String, HashMap<String, List<String >>> returnTypeAndMethod = new HashMap<>();
|
||||
for (MethodDecl methodDecl : oneClass.methodDecls){
|
||||
methodIdentifierAndParameter.put(methodDecl.name, methodDecl.parameters);
|
||||
returnTypeAndMethod.put(methodDecl.returnType, methodIdentifierAndParameter);
|
||||
}
|
||||
|
||||
methodContext.put(oneClass.name, returnTypeAndMethod);
|
||||
|
||||
oneClass.typeCheck();
|
||||
}
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user