From 3947c2cb2fa6193645ac30898064e3d335a63545 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Mon, 15 May 2017 14:50:53 +1000 Subject: src/lauxlib.js: Move binary signature check before line correction --- src/lauxlib.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lauxlib.js') diff --git a/src/lauxlib.js b/src/lauxlib.js index 23cd041..3019bf3 100644 --- a/src/lauxlib.js +++ b/src/lauxlib.js @@ -791,12 +791,12 @@ if (!WEB) { } try { - let com; - if ((com = skipcomment(lf)).skipped) /* read initial portion */ - lf.buff[lf.n++] = '\n'.charCodeAt(0); /* add line to correct line numbers */ - + let com = skipcomment(lf); + /* check for signature first, as we don't want to add line number corrections in binary case */ if (com.c === lua.LUA_SIGNATURE.charCodeAt(0) && filename) { /* binary file? */ lf.binary = true; + } else if (com.skipped) { /* read initial portion */ + lf.buff[lf.n++] = '\n'.charCodeAt(0); /* add line to correct line numbers */ } if (com.c !== null) lf.buff[lf.n++] = com.c; /* 'c' is the first character of the stream */ -- cgit v1.2.3-54-g00ecf