aboutsummaryrefslogtreecommitdiff
path: root/compiler/elymasGlobalSys.ey
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/elymasGlobalSys.ey')
-rw-r--r--compiler/elymasGlobalSys.ey16
1 files changed, 15 insertions, 1 deletions
diff --git a/compiler/elymasGlobalSys.ey b/compiler/elymasGlobalSys.ey
index 01ca564..2f2b763 100644
--- a/compiler/elymasGlobalSys.ey
+++ b/compiler/elymasGlobalSys.ey
@@ -3,14 +3,28 @@
<
# handle an identifier in the current scope according to current quote level
- # 0 -> identifier to handle
+ # 0 -> scope to execute identifier in
+ # 1 -> identifier to handle
+ # 0 <- scope after execution
[[
8 /r15 :subqImm8Reg
/r15 :popqMem
+
+ ::currentScope /rax :movqImmReg
+ 8 /r15 :subqImm8Reg
+ /rax /rcx :movqMemReg
+ /rcx /r15 :movqRegMem
+ /rax :popqMem # load scope from argument
internalExecuteIdentifier /rax :movqImmReg
/rax :callqReg
+ ::currentScope /rax :movqImmReg
+ /rax :pushqMem
+ /r15 /rcx :movqMemReg
+ /rcx /rax :movqRegMem # restore old scope
+ 8 /r15 :addqImm8Reg
+
/r15 :pushqMem
8 /r15 :addqImm8Reg
:retn