summaryrefslogtreecommitdiff
path: root/src/lobject.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-02 11:06:38 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-02 11:06:38 +0200
commitf2bb5dee9b90197185dd0367cee98b61b066ae70 (patch)
treeb3222d28e409053e6c6e1036de25c8e5701c9d7d /src/lobject.js
parentd35f4e1dcec1494483a9257b7a2cacb172047c1f (diff)
parent59d5ff59e3b9eacc2b2aa8e92e71f31914d09545 (diff)
downloadfengari-f2bb5dee9b90197185dd0367cee98b61b066ae70.tar.gz
fengari-f2bb5dee9b90197185dd0367cee98b61b066ae70.tar.bz2
fengari-f2bb5dee9b90197185dd0367cee98b61b066ae70.zip
Merge remote-tracking branch 'daurnimator/fix-errors'
Diffstat (limited to 'src/lobject.js')
-rw-r--r--src/lobject.js19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/lobject.js b/src/lobject.js
index 5a202d4..784720b 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -7,9 +7,7 @@ const defs = require('./defs.js');
const ljstype = require('./ljstype.js');
const luaconf = require('./luaconf.js');
const llimit = require('./llimit.js');
-const ltable = require('./ltable.js');
const CT = defs.constant_types;
-const UpVal = require('./lfunc.js').UpVal;
const char = defs.char;
let tvalueCount = 0;
@@ -147,6 +145,11 @@ class TValue {
this.value = x;
}
+ sethvalue(x) {
+ this.type = CT.LUA_TTABLE;
+ this.value = x;
+ }
+
setfrom(tv) { /* in lua C source setobj2t is often used for this */
this.type = tv.type;
this.value = tv.value;
@@ -201,17 +204,7 @@ class LClosure {
constructor(L, n) {
this.p = null;
this.nupvalues = n;
-
- let _ENV = new UpVal(L);
- _ENV.refcount = 0;
- _ENV.v = null;
- _ENV.u.open.next = null;
- _ENV.u.open.touched = true;
- _ENV.u.value = new TValue(CT.LUA_TTABLE, ltable.luaH_new(L));
-
- this.upvals = [
- _ENV
- ];
+ this.upvals = Array(n);
}
}