]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/types/TFunctionAst.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / parsing / types / TFunctionAst.java
index d11fc8854b863a8b2202ce9c88435253ccce5563..5a4356ab45b61891353074187a3a0a5696895a11 100644 (file)
@@ -1,91 +1,91 @@
-package org.simantics.scl.compiler.internal.parsing.types;\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 TFunctionAst extends TypeAst {\r
-    public final TypeAst domain;\r
-    public final TypeAst range;\r
-    \r
-    public TFunctionAst(TypeAst domain, TypeAst range) {\r
-        this.domain = domain;\r
-        this.range = range;\r
-    }\r
-    \r
-    @Override\r
-    public void toString(StringBuilder b) {\r
-        domain.toString(b, 2);\r
-        b.append(" -> ");\r
-        range.toString(b, 3);\r
-    }\r
-\r
-    @Override\r
-    public Type toType(TypeTranslationContext context, Kind expectedKind) {\r
-        context.unify(location, Kinds.STAR, expectedKind);\r
-        if(range instanceof TEffectAst) {\r
-            TEffectAst effectAst = (TEffectAst)range;\r
-            return Types.functionE(\r
-                    domain.toType(context, Kinds.STAR),\r
-                    toEffect(context, effectAst.effects),\r
-                    effectAst.type.toType(context, Kinds.STAR));\r
-        }\r
-        else\r
-            return Types.function(domain.toType(context, Kinds.STAR), range.toType(context, Kinds.STAR));\r
-    }\r
-    \r
-    @Override\r
-    public Type toType(TypeElaborationContext context) {\r
-        if(range instanceof TEffectAst) {\r
-            TEffectAst effectAst = (TEffectAst)range;\r
-            return Types.functionE(\r
-                    domain.toType(context),\r
-                    toEffect(context, effectAst.effects),\r
-                    effectAst.type.toType(context));\r
-        }\r
-        else\r
-            return Types.function(domain.toType(context), range.toType(context));\r
-    }\r
-    \r
-    static Type toEffect(TypeTranslationContext context, TypeAst[] effects) {\r
-        if(effects.length == 0)\r
-            return Types.NO_EFFECTS;\r
-        if(effects.length == 1)\r
-            return effects[0].toEffect(context);\r
-        Type[] types = new Type[effects.length];\r
-        for(int i=0;i<effects.length;++i)\r
-            types[i] = effects[i].toEffect(context);\r
-        return Types.union(types);\r
-    }\r
-    \r
-    static Type toEffect(TypeElaborationContext context, TypeAst[] effects) {\r
-        if(effects.length == 0)\r
-            return Types.NO_EFFECTS;\r
-        if(effects.length == 1)\r
-            return effects[0].toEffect(context);\r
-        Type[] types = new Type[effects.length];\r
-        for(int i=0;i<effects.length;++i)\r
-            types[i] = effects[i].toEffect(context);\r
-        return Types.union(types);\r
-    }\r
-    \r
-    @Override\r
-    public int getPrecedence() {\r
-        return 2;\r
-    }\r
-\r
-    @Override\r
-    public void collectReferences(TObjectIntHashMap<String> typeNameMap,\r
-            TIntHashSet set) {\r
-        domain.collectReferences(typeNameMap, set);\r
-        range.collectReferences(typeNameMap, set);\r
-    }\r
-}\r
+package org.simantics.scl.compiler.internal.parsing.types;
+
+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 TFunctionAst extends TypeAst {
+    public final TypeAst domain;
+    public final TypeAst range;
+    
+    public TFunctionAst(TypeAst domain, TypeAst range) {
+        this.domain = domain;
+        this.range = range;
+    }
+    
+    @Override
+    public void toString(StringBuilder b) {
+        domain.toString(b, 2);
+        b.append(" -> ");
+        range.toString(b, 3);
+    }
+
+    @Override
+    public Type toType(TypeTranslationContext context, Kind expectedKind) {
+        context.unify(location, Kinds.STAR, expectedKind);
+        if(range instanceof TEffectAst) {
+            TEffectAst effectAst = (TEffectAst)range;
+            return Types.functionE(
+                    domain.toType(context, Kinds.STAR),
+                    toEffect(context, effectAst.effects),
+                    effectAst.type.toType(context, Kinds.STAR));
+        }
+        else
+            return Types.function(domain.toType(context, Kinds.STAR), range.toType(context, Kinds.STAR));
+    }
+    
+    @Override
+    public Type toType(TypeElaborationContext context) {
+        if(range instanceof TEffectAst) {
+            TEffectAst effectAst = (TEffectAst)range;
+            return Types.functionE(
+                    domain.toType(context),
+                    toEffect(context, effectAst.effects),
+                    effectAst.type.toType(context));
+        }
+        else
+            return Types.function(domain.toType(context), range.toType(context));
+    }
+    
+    static Type toEffect(TypeTranslationContext context, TypeAst[] effects) {
+        if(effects.length == 0)
+            return Types.NO_EFFECTS;
+        if(effects.length == 1)
+            return effects[0].toEffect(context);
+        Type[] types = new Type[effects.length];
+        for(int i=0;i<effects.length;++i)
+            types[i] = effects[i].toEffect(context);
+        return Types.union(types);
+    }
+    
+    static Type toEffect(TypeElaborationContext context, TypeAst[] effects) {
+        if(effects.length == 0)
+            return Types.NO_EFFECTS;
+        if(effects.length == 1)
+            return effects[0].toEffect(context);
+        Type[] types = new Type[effects.length];
+        for(int i=0;i<effects.length;++i)
+            types[i] = effects[i].toEffect(context);
+        return Types.union(types);
+    }
+    
+    @Override
+    public int getPrecedence() {
+        return 2;
+    }
+
+    @Override
+    public void collectReferences(TObjectIntHashMap<String> typeNameMap,
+            TIntHashSet set) {
+        domain.collectReferences(typeNameMap, set);
+        range.collectReferences(typeNameMap, set);
+    }
+}