Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ public static ParseTree compile(TokenStream stream, Environment environment,
environment.getEnv(CompilerEnvironment.class).addCompilerWarning(fileOptions, warning);
f = new ParseTree(new CFunction(Compiler.__autoconcat__.NAME, unknown), fileOptions);
} else {
f = new ParseTree(new CFunction(Compiler.p.NAME, unknown), fileOptions);
f = new ParseTree(new CFunction(Compiler.p.NAME, t.getTarget()), fileOptions);
}
constructCount.push(new AtomicInteger(0));
tree.addChild(f);
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/laytonsmith/core/constructs/IVariable.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ public IVariable clone() throws CloneNotSupportedException {
return clone;
}

/**
* Create a clone of this {@link IVariable} using the same variable value reference.
* @return The clone.
*/
public IVariable shallowClone() {
return new IVariable(type, name, varValue, definedTarget);
}

@Override
public boolean isDynamic() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public void set(IVariable v) {
varList.put(v.getVariableName(), v);
}

public IVariable get(String name) {
return varList.get(name);
}

public IVariable get(String name, Target t, boolean bypassAssignedCheck, Environment env) {
IVariable v = varList.get(name);
if(v == null) {
Expand Down Expand Up @@ -133,7 +137,9 @@ public String toString() {
@Override
public IVariableList clone() {
IVariableList clone = new IVariableList(this);
clone.varList = new HashMap<>(varList);
for(IVariable var : varList.values()) {
clone.set(var.shallowClone());
}
return clone;
}

Expand Down
Loading
Loading