package abstractSyntaxTree.Class; import TypeCheck.TypeCheckResult; import java.util.ArrayList; import java.util.List; public class FieldDecl implements IClass { private String type; private String identifier; 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); } result.type = this.type; return result; } }