1 package org.simantics.scl.compiler.internal.types.ast;
3 import org.simantics.scl.compiler.internal.types.TypeElaborationContext;
4 import org.simantics.scl.compiler.types.TVar;
5 import org.simantics.scl.compiler.types.Type;
6 import org.simantics.scl.compiler.types.Types;
7 import org.simantics.scl.compiler.types.exceptions.SCLTypeParseException;
11 public class TForAllAst extends TypeAst {
12 public final String[] vars;
13 public final TypeAst type;
15 public TForAllAst(String[] vars, TypeAst type) {
21 public void toString(StringBuilder b) {
23 for(String var : vars) {
32 public Type toType(TypeElaborationContext context) throws SCLTypeParseException {
33 TVar[] oldVars = new TVar[vars.length];
34 for(int i=0;i<vars.length;++i)
35 oldVars[i] = context.push(vars[i]);
36 Type result = type.toType(context);
37 for(int i=vars.length-1;i>=0;--i)
38 result = Types.forAll(context.pop(vars[i], oldVars[i]), result);
43 public int getPrecedence() {