Skip to content

Commit

Permalink
fix: class instance scope wasn't getting set up from call inside of c…
Browse files Browse the repository at this point in the history
…lass function

demo:
```
class Funny {
    $h = 1;
    func A() { B() }
    func B() { print $h }
}
#Funny:new().A()
```
Would crash because B is executed without a ClassFunctionScope
  • Loading branch information
Jan0660 committed Feb 22, 2024
1 parent bf74269 commit d0f636d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion RCaron/Motor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,7 @@ public bool TryCallFunction(string name, FileScope fileScope, CallLikePosToken?
var definition = scope.ClassInstance.Definition;
if (definition.Functions?.TryGetValue(name, out var func2) ?? false)
{
result = FunctionCall(func2, callToken, argumentTokens, classInstance, pipeline: pipeline);
result = FunctionCall(func2, callToken, argumentTokens, scope.ClassInstance, pipeline: pipeline);
return true;
}
}
Expand Down

0 comments on commit d0f636d

Please sign in to comment.