mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-04-19 13:33:26 +00:00
fix parser bug
This commit is contained in:
parent
32d892111d
commit
a3ce7c53cb
@ -37,7 +37,7 @@ option(LUAJIT_DISABLE_JIT "Disable JIT." OFF)
|
||||
option(LUAJIT_CPU_SSE2 "Use SSE2 instead of x87 instructions." ON)
|
||||
option(LUAJIT_CPU_NOCMOV "Disable NOCMOV." OFF)
|
||||
option(LUAJIT_DISABLE_GC64 "Disable GC64" OFF)
|
||||
option(LUAJIT_ENABLE_FSANITIZE "Enable fsanitize" ON)
|
||||
option(LUAJIT_ENABLE_FSANITIZE "Enable fsanitize" OFF)
|
||||
option(LUAJIT_NUMMODE "num mode" 2)
|
||||
MARK_AS_ADVANCED(LUAJIT_DISABLE_FFI LUAJIT_ENABLE_LUA52COMPAT
|
||||
LUAJIT_DISABLE_GC64
|
||||
|
@ -231,19 +231,21 @@ LUALIB_API int luaL_loadbuffer(lua_State *L, const char *buf, size_t size,
|
||||
{
|
||||
#if LJ_DS_LOADBUFFER_PATCH
|
||||
if (buf != name){
|
||||
if (lj_path_map){
|
||||
const char* real_path = lj_path_map(name);
|
||||
if (real_path){
|
||||
if (name[0] != '@'){
|
||||
if (lj_path_map){
|
||||
const char* real_path = lj_path_map(name);
|
||||
if (real_path){
|
||||
char path[260];
|
||||
snprintf(path, 260, "@%s", real_path);
|
||||
return luaL_loadbufferx(L, buf, size, path, NULL);
|
||||
}
|
||||
}
|
||||
if (strncmp(name, "scripts/", sizeof("scripts/") -1) == 0) {
|
||||
char path[260];
|
||||
snprintf(path, 260, "@%s", real_path);
|
||||
snprintf(path, 260, "@%s", name);
|
||||
return luaL_loadbufferx(L, buf, size, path, NULL);
|
||||
}
|
||||
}
|
||||
if (strncmp(name, "scripts/", sizeof("scripts/") -1) == 0) {
|
||||
char path[260];
|
||||
snprintf(path, 260, "@%s", name);
|
||||
return luaL_loadbufferx(L, buf, size, path, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return luaL_loadbufferx(L, buf, size, name, NULL);
|
||||
|
@ -1133,7 +1133,7 @@ static MSize var_lookup_(FuncState *fs, GCstr *name, ExpDesc *e, int first)
|
||||
if ((int32_t)reg >= 0) { /* Local in this function? */
|
||||
expr_init(e, VLOCAL, reg);
|
||||
#if LUA_COMPAT_VARARG
|
||||
if (!fs->need_vararg && fs->flags & PROTO_VARARG && reg == 0){
|
||||
if (!fs->need_vararg && fs->flags & PROTO_VARARG){
|
||||
if (name->len == (sizeof("arg") - 1) && strncmp(strdata(name), "arg", name->len) == 0){
|
||||
fs->need_vararg = 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user