From dbe47f41c1698465c86baa75e5d7749307820d2c Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Wed, 22 Nov 2017 13:12:21 +0100 Subject: [PATCH] =?UTF-8?q?FunNClass=20anf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../typeinference/assumptions/FunNClass.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/de/dhbwstuttgart/typeinference/assumptions/FunNClass.java diff --git a/src/de/dhbwstuttgart/typeinference/assumptions/FunNClass.java b/src/de/dhbwstuttgart/typeinference/assumptions/FunNClass.java new file mode 100644 index 00000000..0eba225d --- /dev/null +++ b/src/de/dhbwstuttgart/typeinference/assumptions/FunNClass.java @@ -0,0 +1,43 @@ +package de.dhbwstuttgart.typeinference.assumptions; + +import com.sun.org.apache.regexp.internal.RE; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.SyntaxTreeGenerator.GenericContext; +import de.dhbwstuttgart.parser.scope.GenericTypeName; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.GenericDeclarationList; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; +import de.dhbwstuttgart.syntaxtree.factory.NameGenerator; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +import java.util.ArrayList; +import java.util.List; + +public class FunNClass extends ClassOrInterface { + public FunNClass(List funNParams) { + super(0, new JavaClassName("Fun"+(funNParams.size()-1)), new ArrayList<>(), + createMethods(funNParams), new ArrayList<>(), createGenerics(funNParams), + ASTFactory.createObjectType(), true, new ArrayList<>(), new NullToken()); + + + } + + private static GenericDeclarationList createGenerics(List funNParams) { + List generics = new ArrayList<>(); + for(RefTypeOrTPHOrWildcardOrGeneric param : funNParams){ + generics.add(new GenericTypeVar(new GenericTypeName(new GenericContext( + new JavaClassName("Fun"+(funNParams.size()-1)), null), NameGenerator.makeNewName()), + new ArrayList<>(), new NullToken(), new NullToken())); + } + return new GenericDeclarationList(generics, new NullToken()); + } + + private static List createMethods(List funNParams) { + return null; + } +}