From d0f636d800c60901957d4a15c3e9a9921b6ac91a Mon Sep 17 00:00:00 2001 From: Jan0660 Date: Thu, 22 Feb 2024 15:01:49 +0100 Subject: [PATCH] fix: class instance scope wasn't getting set up from call inside of class 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 --- RCaron/Motor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RCaron/Motor.cs b/RCaron/Motor.cs index 10a6146..892c566 100644 --- a/RCaron/Motor.cs +++ b/RCaron/Motor.cs @@ -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; } }