Browse Source

refactor: remove unused properties from LuaFunctionExecutionContext and update related method calls

Akeit0 7 months ago
parent
commit
a5115fc506

+ 0 - 2
src/Lua/LuaFunctionExecutionContext.cs

@@ -12,8 +12,6 @@ public readonly record struct LuaFunctionExecutionContext
     public required int ArgumentCount { get; init; }
     public int FrameBase => Thread.Stack.Count - ArgumentCount;
     public required int ReturnFrameBase { get; init; }
-    public int? SourceLine { get; init; }
-    public int? CallerInstructionIndex { get; init; }
     //public object? AdditionalContext { get; init; }
 
     public ReadOnlySpan<LuaValue> Arguments

+ 1 - 1
src/Lua/LuaThread.cs

@@ -105,7 +105,7 @@ public abstract class LuaThread
         {
             await closure.InvokeAsync(new()
             {
-                Thread = this, ArgumentCount = Stack.Count, ReturnFrameBase = 0, SourceLine = null,
+                Thread = this, ArgumentCount = Stack.Count, ReturnFrameBase = 0,
             }, cancellationToken);
 
             return Stack.Count;

+ 3 - 3
src/Lua/Runtime/LuaVirtualMachine.Debug.cs

@@ -107,11 +107,11 @@ public static partial class LuaVirtualMachine
     {
         return ExecuteCallHook(new()
         {
-            Thread = context.Thread, ArgumentCount = arguments, ReturnFrameBase = frame.ReturnBase, CallerInstructionIndex = frame.CallerInstructionIndex,
-        }, context.CancellationToken, isTailCall);
+            Thread = context.Thread, ArgumentCount = arguments, ReturnFrameBase = frame.ReturnBase
+        },context.CancellationToken, isTailCall);
     }
 
-    internal static async ValueTask<int> ExecuteCallHook(LuaFunctionExecutionContext context, CancellationToken cancellationToken, bool isTailCall = false)
+    internal static async ValueTask<int> ExecuteCallHook(LuaFunctionExecutionContext context,  CancellationToken cancellationToken, bool isTailCall = false)
     {
         var argCount = context.ArgumentCount;
         var hook = context.Thread.Hook!;

+ 1 - 1
src/Lua/Runtime/LuaVirtualMachine.cs

@@ -1847,7 +1847,7 @@ public static partial class LuaVirtualMachine
     {
         return function.Func(new()
         {
-            Thread = context.Thread, ArgumentCount = arguments, ReturnFrameBase = frame.ReturnBase, CallerInstructionIndex = frame.CallerInstructionIndex,
+            Thread = context.Thread, ArgumentCount = arguments, ReturnFrameBase = frame.ReturnBase,
         }, context.CancellationToken);
     }
 }