summaryrefslogtreecommitdiff
path: root/src/lfunc.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-29 15:35:46 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-29 15:35:46 +1000
commit6d1484d41f5b5d561d21d6e497bd1ec437973464 (patch)
tree05db2d4ed395c04f2e658be340296870ed41d944 /src/lfunc.js
parentbc7396f76988347bb5870e8482d17ee33f808ad7 (diff)
downloadfengari-6d1484d41f5b5d561d21d6e497bd1ec437973464.tar.gz
fengari-6d1484d41f5b5d561d21d6e497bd1ec437973464.tar.bz2
fengari-6d1484d41f5b5d561d21d6e497bd1ec437973464.zip
src/lfunc.js: Give UpVals an id field
This way they have an id when printed via %p. e.g. `debug.upvalueid(function() print() end, 1)`
Diffstat (limited to 'src/lfunc.js')
-rw-r--r--src/lfunc.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lfunc.js b/src/lfunc.js
index 97e5f02..b4684e1 100644
--- a/src/lfunc.js
+++ b/src/lfunc.js
@@ -29,7 +29,8 @@ class Proto {
class UpVal {
- constructor() {
+ constructor(L) {
+ this.id = L.l_G.id_counter++;
this.v = void 0; /* if open: reference to TValue on stack. if closed: TValue */
this.vOff = void 0; /* if open: index on stack. if closed: undefined */
this.refcount = 0;
@@ -59,7 +60,7 @@ const luaF_findupval = function(L, level) {
p = p.open_next;
}
/* not found: create a new upvalue */
- let uv = new UpVal();
+ let uv = new UpVal(L);
/* link it to list of open upvalues */
uv.open_next = p;
if (prevp)