1 package org.simantics.scl.compiler.internal.deriving;
3 import org.simantics.scl.compiler.internal.parsing.types.TApplyAst;
4 import org.simantics.scl.compiler.internal.parsing.types.TTupleAst;
5 import org.simantics.scl.compiler.internal.parsing.types.TVarAst;
6 import org.simantics.scl.compiler.internal.parsing.types.TypeAst;
10 static TVarAst getHeadType(TypeAst typeAst) {
12 if(typeAst instanceof TApplyAst)
13 typeAst = ((TApplyAst)typeAst).function;
14 else if(typeAst instanceof TVarAst)
15 return (TVarAst)typeAst;
16 else if(typeAst instanceof TTupleAst) {
17 TTupleAst tuple = (TTupleAst)typeAst;
18 if(tuple.components.length == 1)
19 typeAst = tuple.components[0];