From a233adf37fb92e883aeb134731220b7c20266f47 Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Thu, 24 Jul 2025 03:05:42 -0500 Subject: [PATCH] Implement chunk reflection, apparently forgot --- README.md | 2 +- src/vm/vm.cpp | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 468eab8..71804b2 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ make sudo make install ``` -## Build with shared libs only (no dependencies other than cmake and build-essentials) +## Build with shared libs only (self contained dependencies) ```bash cmake -S ../.. -B . -DTESSESFRAMEWORK_ENABLE_STATIC=OFF -DTESSESFRAMEWORK_ENABLE_SHARED=ON -DTESSESFRAMEWORK_FETCHCONTENT=ON make -j`nproc` diff --git a/src/vm/vm.cpp b/src/vm/vm.cpp index 7bd3a8d..5bd8da3 100644 --- a/src/vm/vm.cpp +++ b/src/vm/vm.cpp @@ -5459,7 +5459,35 @@ namespace Tesses::CrossLang { cse.back()->Push(gc, Undefined()); return false; } - + if(chunk != nullptr) + { + if(key == "Arguments") + { + auto myargs = TList::Create(ls); + gc->BarrierBegin(); + for(auto item : chunk->args) + { + myargs->Add(item); + } + gc->BarrierEnd(); + cse.back()->Push(gc, myargs); + return false; + } + if(key == "Code") + { + auto ba = TByteArray::Create(ls); + ba->data = chunk->code; + cse.back()->Push(gc, ba); + return false; + } + if(key == "File") + { + cse.back()->Push(gc, chunk->file); + return false; + } + cse.back()->Push(gc, Undefined()); + return false; + } if(callstackEntry != nullptr) { if(key == "IP")