]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/LocalVariableConstant.java
(refs #7776) Fixed module export for javaImports
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / constants / LocalVariableConstant.java
1 package org.simantics.scl.compiler.constants;
2
3 import org.cojen.classfile.TypeDesc;
4 import org.simantics.scl.compiler.internal.codegen.utils.LocalVariable;
5 import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;
6 import org.simantics.scl.compiler.internal.codegen.utils.TransientClassBuilder;
7 import org.simantics.scl.compiler.types.Type;
8
9 public class LocalVariableConstant extends Constant {
10
11     public LocalVariable var;
12     
13     public LocalVariableConstant(Type type, LocalVariable var) {
14         super(type);
15         this.var = var;
16     }
17     
18     @Override
19     public void push(MethodBuilder mb) {
20         mb.loadLocal(var);
21         if(var.getType() == TypeDesc.OBJECT)
22             mb.unbox(type);
23     }
24
25     @Override
26     public Object realizeValue(TransientClassBuilder classBuilder) {
27         throw new UnsupportedOperationException();
28     }
29
30 }