]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/types/ast/TTupleAst.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / types / ast / TTupleAst.java
1 package org.simantics.scl.compiler.internal.types.ast;
2
3 import org.simantics.scl.compiler.internal.types.TypeElaborationContext;
4 import org.simantics.scl.compiler.types.Type;
5 import org.simantics.scl.compiler.types.Types;
6 import org.simantics.scl.compiler.types.exceptions.SCLTypeParseException;
7
8
9
10 public class TTupleAst extends TypeAst {
11     public final TypeAst[] components;
12     
13     public TTupleAst(TypeAst ... components) {
14         this.components = components;
15     }
16
17     @Override
18     public void toString(StringBuilder b) {
19         b.append('(');
20         for(int i=0;i<components.length;++i) {
21             if(i > 0)
22                 b.append(", ");
23             components[i].toString(b);
24         }
25         b.append(')');
26     }
27
28     @Override
29     public Type toType(TypeElaborationContext context) throws SCLTypeParseException {
30         return Types.tuple(toTypes(context, components));
31     }
32
33     @Override
34     public int getPrecedence() {
35         return 0;
36     }
37 }