Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some small tweaks #186

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion MiniScript-cs/MiniscriptTAC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ public void SetTemp(int tempNum, Value value) {
}

public Value GetTemp(int tempNum) {
return temps == null ? null : temps[tempNum];
return temps == null || temps.Count <= tempNum ? null : temps[tempNum];
}

public Value GetTemp(int tempNum, Value defaultValue) {
Expand Down Expand Up @@ -992,6 +992,7 @@ public void ManuallyPushCall(ValFunction func, Value resultStorage=null, List<Va
Value self = null; // "self" is always null for a manually pushed call

Context nextContext = context.NextCallContext(func.function, argCount, self != null, null);
nextContext.outerVars = func.outerVars;
if (self != null) nextContext.self = self;
nextContext.resultStorage = resultStorage;
stack.Push(nextContext);
Expand Down
8 changes: 4 additions & 4 deletions MiniScript-cs/MiniscriptTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ public ValFunction(Function function) {
}
public ValFunction(Function function, ValMap outerVars) {
this.function = function;
this.outerVars = outerVars;
this.outerVars = outerVars;
}

public override string ToString(TAC.Machine vm) {
Expand Down Expand Up @@ -1065,9 +1065,9 @@ public override double Equality(Value rhs) {
return function == other.function ? 1 : 0;
}

public ValFunction BindAndCopy(ValMap contextVariables) {
return new ValFunction(function, contextVariables);
}
public virtual ValFunction BindAndCopy(ValMap contextVariables) {
return new ValFunction(function, contextVariables);
}

}

Expand Down