package net.folab.fo.ast;

import net.folab.fo.bytecode.JavaType;
import net.folab.fo.bytecode.StatementContext;

import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

public class LocalVariable implements Expression {

    private final String name;

    public LocalVariable(String name) {
        this.name = name;
    }

    public void generate(MethodVisitor mv, StatementContext ctx) {
        int index = ctx.indexOfLocal(name);
        ctx.incStack();
        mv.visitVarInsn(Opcodes.ALOAD, index);
    }

    public JavaType getType() {
        throw new RuntimeException();
    }

}

@@ -150,42 +150,8 @@
 tor;
-%0Aimport org.objectweb.asm.Opcodes;
 %0A%0Apu
@@ -416,16 +416,63 @@
 (name);%0A
+        JavaType type = ctx.typeOfLocal(name);%0A
         
@@ -515,21 +515,23 @@
 nsn(
-Opcodes.ALOAD
+type.loadOpcode
 , in

Use JavaType load