diff options
author | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-02 16:16:02 +0100 |
---|---|---|
committer | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-02 16:16:02 +0100 |
commit | 626fa17826d854fb93c576dde3f48bc344fd41a2 (patch) | |
tree | 33645392d580707bd26ae7c5863e6e1dfb9621cf /src | |
parent | 8ca3810b6efa8f76284016e1fa3b319449caba37 (diff) | |
download | fengari-626fa17826d854fb93c576dde3f48bc344fd41a2.tar.gz fengari-626fa17826d854fb93c576dde3f48bc344fd41a2.tar.bz2 fengari-626fa17826d854fb93c576dde3f48bc344fd41a2.zip |
readProtos
Diffstat (limited to 'src')
-rw-r--r-- | src/lundump.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lundump.js b/src/lundump.js index 608b868..bab34fe 100644 --- a/src/lundump.js +++ b/src/lundump.js @@ -181,9 +181,18 @@ class BytecodeParser { } } + readProtos(f) { + let n = this.readInt(); + + for (let i = 0; i < n; i++) { + f.p[i] = new Proto(this.L); + this.readFunction(f.p[i], f.source); + } + } + readFunction(f, psource) { f.source = this.readString(); - if (f.source == null) /* no source in dump? */ + if (f.source === null || f.source === undefined || f.source.length === 0) /* no source in dump? */ f.source = psource; /* reuse parent's source */ f.linedefined = this.readInt(); f.lastlinedefined = this.readInt(); @@ -203,7 +212,7 @@ class BytecodeParser { this.readCode(f); this.readConstants(f); this.readUpvalues(f); - // this.readProtos(f); + this.readProtos(f); // this.readDebug(f); } |