summaryrefslogtreecommitdiff
path: root/src/lvm.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-05 17:08:04 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-05 17:18:21 +1000
commit0e5585bd7078d6727382c0de51161fe377c1d81d (patch)
tree05b77887eb62922ac40645a6126e3001c0f6b9f8 /src/lvm.js
parentb54eee30383e4eaae74551afc9d1c59126269305 (diff)
downloadfengari-0e5585bd7078d6727382c0de51161fe377c1d81d.tar.gz
fengari-0e5585bd7078d6727382c0de51161fe377c1d81d.tar.bz2
fengari-0e5585bd7078d6727382c0de51161fe377c1d81d.zip
Simplify UpVal structure
No longer follows C api as closely (it is the way it is because C has unions) Instead, have a flat object. Also remove the 'setval' method, as it wasn't used from all call-sites and couldn't be extended to them (setval's body only worked with source TValue on a stack)
Diffstat (limited to 'src/lvm.js')
-rw-r--r--src/lvm.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lvm.js b/src/lvm.js
index bd38575..d45ecec 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -166,7 +166,12 @@ const luaV_execute = function(L) {
break;
}
case OCi.OP_SETUPVAL: {
- cl.upvals[i.B].setval(L, ra);
+ let uv = cl.upvals[i.B];
+ if (uv.v !== null) {
+ uv.L.stack[uv.v] = L.stack[ra];
+ } else {
+ uv.value.setfrom(L.stack[ra]);
+ }
break;
}
case OCi.OP_GETTABUP: {