fix: stupid mistake with variable capturing
This commit is contained in:
parent
8a21873631
commit
6d56660136
@ -64,7 +64,7 @@ public class VariableNode extends Node implements Pattern, ChangeTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static IntFunction<Instruction> toGet(CompileResult target, Location loc, String name, boolean keep, boolean forceGet) {
|
public static IntFunction<Instruction> toGet(CompileResult target, Location loc, String name, boolean keep, boolean forceGet) {
|
||||||
var oldI = target.scope.get(name, true);
|
var oldI = target.scope.get(name, false);
|
||||||
|
|
||||||
if (oldI != null) {
|
if (oldI != null) {
|
||||||
if (keep) return _i -> oldI.index().toGet();
|
if (keep) return _i -> oldI.index().toGet();
|
||||||
@ -83,7 +83,7 @@ public class VariableNode extends Node implements Pattern, ChangeTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static IntFunction<Instruction> toInit(CompileResult target, Location loc, String name) {
|
public static IntFunction<Instruction> toInit(CompileResult target, Location loc, String name) {
|
||||||
var oldI = target.scope.get(name, true);
|
var oldI = target.scope.get(name, false);
|
||||||
|
|
||||||
if (oldI != null) return _i -> oldI.index().toInit();
|
if (oldI != null) return _i -> oldI.index().toInit();
|
||||||
else return _i -> {
|
else return _i -> {
|
||||||
@ -94,7 +94,7 @@ public class VariableNode extends Node implements Pattern, ChangeTarget {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static IntFunction<Instruction> toSet(CompileResult target, Location loc, String name, boolean keep) {
|
public static IntFunction<Instruction> toSet(CompileResult target, Location loc, String name, boolean keep) {
|
||||||
var oldI = target.scope.get(name, true);
|
var oldI = target.scope.get(name, false);
|
||||||
|
|
||||||
if (oldI != null) return _i -> oldI.index().toSet(keep);
|
if (oldI != null) return _i -> oldI.index().toSet(keep);
|
||||||
else return _i -> {
|
else return _i -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user