Skip to content

Commit 5ad1dae

Browse files
committed
Fix expansion order of function-like aliases
1 parent 2e717e5 commit 5ad1dae

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/llex.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,12 @@ void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source,
342342
if (t.token == TK_NAME) {
343343
if (auto arg = ls->macro_args.find(t.seminfo.ts); arg != ls->macro_args.end()) {
344344
i = ls->tokens.insert(i, arg->second);
345+
++i;
345346
continue;
346347
}
347348
}
348349
i = ls->tokens.insert(i, t);
350+
++i;
349351
}
350352
}
351353
else {

testes/pluto/preprocessor.pluto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,9 @@ assert(load[[
6060

6161
return a + b
6262
]])
63+
64+
assert(load[[
65+
$alias def(name, val) = local name = val
66+
def(FOO, 1)
67+
return FOO
68+
]]() == 1)

0 commit comments

Comments
 (0)