1 package org.simantics.scl.compiler.elaboration.java;
3 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;
4 import org.simantics.scl.compiler.constants.FunctionValue;
5 import org.simantics.scl.compiler.internal.codegen.references.Val;
6 import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;
7 import org.simantics.scl.compiler.types.TVar;
8 import org.simantics.scl.compiler.types.Type;
9 import org.simantics.scl.compiler.types.Types;
10 import org.simantics.scl.compiler.types.exceptions.MatchException;
11 import org.simantics.scl.compiler.types.kinds.Kinds;
13 public class FreezeMVector extends FunctionValue {
14 private static final TVar A = Types.var(Kinds.STAR);
16 public FreezeMVector() {
17 super(new TVar[] {A}, Types.PROC, Types.vector(A), Types.mvector(A));
21 public Type applyExact(MethodBuilder mb, Val[] parameters) {
22 Val vectorVar = parameters[0];
27 Type elementType = Types.canonical(
28 Types.matchApply(Types.MVECTOR, vectorVar.getType()));
29 return Types.vector(elementType);
30 } catch (MatchException e) {
31 throw new InternalCompilerError(e);