diff options
author | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-17 09:27:51 +0100 |
---|---|---|
committer | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-17 09:27:51 +0100 |
commit | 50aa5b5029165be03d0cfb34e7d664795dd80898 (patch) | |
tree | dc42e1a73ac367fef1a88c3dd0502a0879eebea3 /src/ldo.js | |
parent | 4eea48935f2e0ea1267d314f2900af2a1a4b8b02 (diff) | |
download | fengari-50aa5b5029165be03d0cfb34e7d664795dd80898.tar.gz fengari-50aa5b5029165be03d0cfb34e7d664795dd80898.tar.bz2 fengari-50aa5b5029165be03d0cfb34e7d664795dd80898.zip |
More accurate state and closure init
Diffstat (limited to 'src/ldo.js')
-rw-r--r-- | src/ldo.js | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -261,6 +261,28 @@ const luaD_callnoyield = function(L, off, nResults) { L.nny--; }; +// TODO: since we only handle binary, no need for a reader or mode +const f_parser = function(L, data) { + assert(data instanceof DataView, "data must be a DataView"); + + let p = new lundump.BytecodeParser(data); + let cl = p.luaU_undump(); + + assert(cl.nupvalues == cl.p.sizeupvalues); + + lfunc.luaF_initupvals(L, cl); +}; + +const luaD_protectedparser = function(L, data, name) { + L.nny++; + + let status = luaD_pcall(L, f_parser, data, L.top, L.errfunc); + + L.nny--; + + return status; +}; + module.exports.nil = nil; module.exports.luaD_precall = luaD_precall; module.exports.luaD_poscall = luaD_poscall; |