Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/Lua/LuaFunctionExecutionContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public readonly record struct LuaFunctionExecutionContext
public required LuaState State { get; init; }
public required LuaThread Thread { get; init; }
public required int ArgumentCount { get; init; }
public int FrameBase { get; init; }
public required int FrameBase { get; init; }
public SourcePosition? SourcePosition { get; init; }
public string? RootChunkName { get; init; }
public string? ChunkName { get; init; }
Expand Down
41 changes: 41 additions & 0 deletions src/Lua/Runtime/LuaVirtualMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ await func.InvokeAsync(new()
State = state,
Thread = thread,
ArgumentCount = 2,
FrameBase = stack.Count - 2,
SourcePosition = chunk.SourcePositions[pc],
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer.AsMemory(), cancellationToken);

stack.UnsafeGet(RA) = methodBuffer[0];
Expand Down Expand Up @@ -183,7 +186,10 @@ await func.InvokeAsync(new()
State = state,
Thread = thread,
ArgumentCount = 2,
FrameBase = stack.Count - 2,
SourcePosition = chunk.SourcePositions[pc],
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer.AsMemory(), cancellationToken);

stack.UnsafeGet(RA) = methodBuffer[0];
Expand Down Expand Up @@ -223,7 +229,10 @@ await func.InvokeAsync(new()
State = state,
Thread = thread,
ArgumentCount = 2,
FrameBase = stack.Count - 2,
SourcePosition = chunk.SourcePositions[pc],
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer.AsMemory(), cancellationToken);

stack.UnsafeGet(RA) = methodBuffer[0];
Expand Down Expand Up @@ -263,7 +272,10 @@ await func.InvokeAsync(new()
State = state,
Thread = thread,
ArgumentCount = 2,
FrameBase = stack.Count - 2,
SourcePosition = chunk.SourcePositions[pc],
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer.AsMemory(), cancellationToken);

stack.UnsafeGet(RA) = methodBuffer[0];
Expand Down Expand Up @@ -308,7 +320,10 @@ await func.InvokeAsync(new()
State = state,
Thread = thread,
ArgumentCount = 2,
FrameBase = stack.Count - 2,
SourcePosition = chunk.SourcePositions[pc],
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer.AsMemory(), cancellationToken);

stack.UnsafeGet(RA) = methodBuffer[0];
Expand Down Expand Up @@ -348,7 +363,10 @@ await func.InvokeAsync(new()
State = state,
Thread = thread,
ArgumentCount = 2,
FrameBase = stack.Count - 2,
SourcePosition = chunk.SourcePositions[pc],
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer.AsMemory(), cancellationToken);

stack.UnsafeGet(RA) = methodBuffer[0];
Expand Down Expand Up @@ -386,7 +404,10 @@ await func.InvokeAsync(new()
State = state,
Thread = thread,
ArgumentCount = 1,
FrameBase = stack.Count - 1,
SourcePosition = chunk.SourcePositions[pc],
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer.AsMemory(), cancellationToken);

stack.UnsafeGet(RA) = methodBuffer[0];
Expand Down Expand Up @@ -431,7 +452,10 @@ await func.InvokeAsync(new()
State = state,
Thread = thread,
ArgumentCount = 1,
FrameBase = stack.Count - 1,
SourcePosition = chunk.SourcePositions[pc],
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer.AsMemory(), cancellationToken);

stack.UnsafeGet(RA) = methodBuffer[0];
Expand Down Expand Up @@ -489,7 +513,10 @@ await func.InvokeAsync(new()
State = state,
Thread = thread,
ArgumentCount = 2,
FrameBase = stack.Count - 2,
SourcePosition = chunk.SourcePositions[pc],
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer.AsMemory(), cancellationToken);

stack.UnsafeGet(RA) = methodBuffer[0];
Expand Down Expand Up @@ -534,7 +561,10 @@ await func.InvokeAsync(new()
State = state,
Thread = thread,
ArgumentCount = 2,
FrameBase = stack.Count - 2,
SourcePosition = chunk.SourcePositions[pc],
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer, cancellationToken);

compareResult = methodBuffer[0].ToBoolean();
Expand Down Expand Up @@ -584,7 +614,10 @@ await func.InvokeAsync(new()
State = state,
Thread = thread,
ArgumentCount = 2,
FrameBase = stack.Count - 2,
SourcePosition = chunk.SourcePositions[pc],
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer, cancellationToken);

compareResult = methodBuffer[0].ToBoolean();
Expand Down Expand Up @@ -638,7 +671,10 @@ await func.InvokeAsync(new()
State = state,
Thread = thread,
ArgumentCount = 2,
FrameBase = stack.Count - 2,
SourcePosition = chunk.SourcePositions[pc],
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer, cancellationToken);

compareResult = methodBuffer[0].ToBoolean();
Expand Down Expand Up @@ -949,6 +985,8 @@ await indexTable.InvokeAsync(new()
ArgumentCount = 2,
SourcePosition = chunk.SourcePositions[pc],
FrameBase = stack.Count - 2,
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer, cancellationToken);

return methodBuffer[0];
Expand Down Expand Up @@ -1007,7 +1045,10 @@ await indexTable.InvokeAsync(new()
State = state,
Thread = thread,
ArgumentCount = 3,
FrameBase = stack.Count - 3,
SourcePosition = chunk.SourcePositions[pc],
ChunkName = chunk.Name,
RootChunkName = chunk.GetRoot().Name,
}, methodBuffer, cancellationToken);
}
finally
Expand Down