package abstractSyntaxTree.Class; import TypeCheck.AbstractType; import TypeCheck.TypeCheckHelper; import TypeCheck.TypeCheckResult; import abstractSyntaxTree.Program; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class FieldDecl extends AbstractType implements IClass{ private HashMap> typeContext; // form class from program public String type; // from parser public String identifier; // from parser public FieldDecl(HashMap> typeContext){ this.typeContext = typeContext; } public TypeCheckResult typeCheck(List classFieldsIdentifier) throws Exception { TypeCheckResult result = new TypeCheckResult(); if (classFieldsIdentifier.contains(this.identifier)){ throw new Exception("field already defined"); } else { classFieldsIdentifier.add(this); } //TypeCheckHelper.typeExists(type, ) // need all types of classes setTypeCheckResult(result); return result; //write field table } }