]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/types/TEffectAst.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / parsing / types / TEffectAst.java
index 094fa14defea99307d608bc468fa34a2317e8e3e..f2a19cb60ea89c2e9058835621a7b2241dec69da 100644 (file)
@@ -1,79 +1,79 @@
-package org.simantics.scl.compiler.internal.parsing.types;\r
-\r
-import java.util.ArrayList;\r
-\r
-import org.simantics.scl.compiler.elaboration.contexts.TypeTranslationContext;\r
-import org.simantics.scl.compiler.internal.types.TypeElaborationContext;\r
-import org.simantics.scl.compiler.types.Type;\r
-import org.simantics.scl.compiler.types.Types;\r
-import org.simantics.scl.compiler.types.kinds.Kind;\r
-import org.simantics.scl.compiler.types.kinds.Kinds;\r
-\r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
-\r
-\r
-public class TEffectAst extends TypeAst {\r
-    public final TypeAst[] effects;\r
-    public final TypeAst type;\r
-    \r
-    public TEffectAst(TypeAst effect, TypeAst type) {\r
-        this.effects = new TypeAst[] {effect};\r
-        this.type = type;\r
-    }\r
-    \r
-    public TEffectAst(TypeAst[] effects, TypeAst type) {\r
-        this.effects = effects;\r
-        this.type = type;\r
-    }\r
-    \r
-    public TEffectAst(ArrayList<TypeAst> effects, TypeAst type) {\r
-        this(effects.toArray(new TypeAst[effects.size()]), type);\r
-    }\r
-\r
-    @Override\r
-    public void toString(StringBuilder b) {\r
-        b.append('<');\r
-        boolean first = true;\r
-        for(TypeAst effect : effects) {\r
-            if(first)\r
-                first = false;\r
-            else\r
-                b.append(",");\r
-            effect.toString(b);\r
-        }\r
-        b.append("> ");\r
-        b.append(type);\r
-    }\r
-\r
-    @Override\r
-    public Type toType(TypeTranslationContext context, Kind expectedKind) {\r
-        context.unify(location, Kinds.STAR, expectedKind);\r
-        return Types.functionE(\r
-                Types.PUNIT,\r
-                TFunctionAst.toEffect(context, effects),\r
-                type.toType(context, Kinds.STAR));\r
-    }\r
-    \r
-    @Override\r
-    public Type toType(TypeElaborationContext context) {\r
-        return Types.functionE(\r
-                Types.PUNIT,\r
-                TFunctionAst.toEffect(context, effects),\r
-                type.toType(context));\r
-    }\r
-\r
-    @Override\r
-    public int getPrecedence() {\r
-        return 0;\r
-    }\r
-\r
-    @Override\r
-    public void collectReferences(TObjectIntHashMap<String> typeNameMap,\r
-            TIntHashSet set) {\r
-        for(TypeAst effect : effects)\r
-            effect.collectReferences(typeNameMap, set);\r
-        type.collectReferences(typeNameMap, set);\r
-    }\r
-}\r
+package org.simantics.scl.compiler.internal.parsing.types;
+
+import java.util.ArrayList;
+
+import org.simantics.scl.compiler.elaboration.contexts.TypeTranslationContext;
+import org.simantics.scl.compiler.internal.types.TypeElaborationContext;
+import org.simantics.scl.compiler.types.Type;
+import org.simantics.scl.compiler.types.Types;
+import org.simantics.scl.compiler.types.kinds.Kind;
+import org.simantics.scl.compiler.types.kinds.Kinds;
+
+import gnu.trove.map.hash.TObjectIntHashMap;
+import gnu.trove.set.hash.TIntHashSet;
+
+
+
+public class TEffectAst extends TypeAst {
+    public final TypeAst[] effects;
+    public final TypeAst type;
+    
+    public TEffectAst(TypeAst effect, TypeAst type) {
+        this.effects = new TypeAst[] {effect};
+        this.type = type;
+    }
+    
+    public TEffectAst(TypeAst[] effects, TypeAst type) {
+        this.effects = effects;
+        this.type = type;
+    }
+    
+    public TEffectAst(ArrayList<TypeAst> effects, TypeAst type) {
+        this(effects.toArray(new TypeAst[effects.size()]), type);
+    }
+
+    @Override
+    public void toString(StringBuilder b) {
+        b.append('<');
+        boolean first = true;
+        for(TypeAst effect : effects) {
+            if(first)
+                first = false;
+            else
+                b.append(",");
+            effect.toString(b);
+        }
+        b.append("> ");
+        b.append(type);
+    }
+
+    @Override
+    public Type toType(TypeTranslationContext context, Kind expectedKind) {
+        context.unify(location, Kinds.STAR, expectedKind);
+        return Types.functionE(
+                Types.PUNIT,
+                TFunctionAst.toEffect(context, effects),
+                type.toType(context, Kinds.STAR));
+    }
+    
+    @Override
+    public Type toType(TypeElaborationContext context) {
+        return Types.functionE(
+                Types.PUNIT,
+                TFunctionAst.toEffect(context, effects),
+                type.toType(context));
+    }
+
+    @Override
+    public int getPrecedence() {
+        return 0;
+    }
+
+    @Override
+    public void collectReferences(TObjectIntHashMap<String> typeNameMap,
+            TIntHashSet set) {
+        for(TypeAst effect : effects)
+            effect.collectReferences(typeNameMap, set);
+        type.collectReferences(typeNameMap, set);
+    }
+}