From 985e5151eeec16fd307319785b21256f971cde29 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Tue, 28 Feb 2023 00:32:32 +0800 Subject: [PATCH] up --- src/obj.h | 3 +++ src/vm.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/obj.h b/src/obj.h index f3c0f9f2..e8c2d7fe 100644 --- a/src/obj.h +++ b/src/obj.h @@ -174,4 +174,7 @@ T& py_cast(VM* vm, const PyVar& var) { UNREACHABLE(); } template T& _py_cast(VM* vm, const PyVar& var) { UNREACHABLE(); } +#define VAR(x) py_var(vm, x) + + } // namespace pkpy \ No newline at end of file diff --git a/src/vm.h b/src/vm.h index 7f43c4f5..3d8bfc9f 100644 --- a/src/vm.h +++ b/src/vm.h @@ -34,6 +34,7 @@ public: }; class VM { + VM* vm; // self reference for simplify code public: std::stack< std::unique_ptr > callstack; PyVar _py_op_call; @@ -57,6 +58,7 @@ public: int recursionlimit = 1000; VM(bool use_stdio){ + this->vm = this; this->use_stdio = use_stdio; if(use_stdio){ this->_stdout = &std::cout;