aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-22 00:23:13 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-22 00:50:42 +1000
commitf58f0c12c68c55ab020aab2c5f702c846b9f2adc (patch)
tree11cbb4e3f9616685df0338666326281d294b6049 /src
parent62d8a8392cd41f2553462f455ad9a1f1ef151026 (diff)
downloadfengari-f58f0c12c68c55ab020aab2c5f702c846b9f2adc.tar.gz
fengari-f58f0c12c68c55ab020aab2c5f702c846b9f2adc.tar.bz2
fengari-f58f0c12c68c55ab020aab2c5f702c846b9f2adc.zip
src/lparser.js: create error message using luaO_pushfstring
Fixes issue where 'what' is a lua string (not a JS string)
Diffstat (limited to 'src')
-rw-r--r--src/lparser.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lparser.js b/src/lparser.js
index 7d99f7d..100342a 100644
--- a/src/lparser.js
+++ b/src/lparser.js
@@ -171,9 +171,12 @@ const error_expected = function(ls, token) {
const errorlimit = function(fs, limit, what) {
let L = fs.ls.L;
let line = fs.f.linedefined;
- let where = (line === 0) ? "main function" : `function at line ${line}`;
- let msg = `too many ${what} (limit is ${limit}) in ${where}`;
- llex.luaX_syntaxerror(fs.ls, defs.to_luastring(msg));
+ let where = (line === 0)
+ ? defs.to_luastring("main function", true)
+ : lobject.luaO_pushfstring(L, defs.to_luastring("function at line %d", true), line);
+ let msg = lobject.luaO_pushfstring(L, defs.to_luastring("too many %s (limit is %d) in %s", true),
+ what, limit, where);
+ llex.luaX_syntaxerror(fs.ls, msg);
};
const checklimit = function(fs, v, l, what) {