From 626fa17826d854fb93c576dde3f48bc344fd41a2 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 2 Feb 2017 16:16:02 +0100 Subject: readProtos --- src/lundump.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3-70-g09d2