mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
rename mutableGlobalNames back to mutableGlobals
This commit is contained in:
parent
81b28ff6c5
commit
975f5a3bd0
3 changed files with 4 additions and 4 deletions
|
@ -39,7 +39,7 @@ struct CompileOptions
|
||||||
|
|
||||||
// array of globals that are mutable; disables the import optimization for fields accessed through them
|
// array of globals that are mutable; disables the import optimization for fields accessed through them
|
||||||
// use NULL to end the array
|
// use NULL to end the array
|
||||||
const char** mutableGlobalNames = nullptr;
|
const char** mutableGlobals = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CompileError : public std::exception
|
class CompileError : public std::exception
|
||||||
|
|
|
@ -3710,8 +3710,8 @@ void compileOrThrow(BytecodeBuilder& bytecode, AstStatBlock* root, const AstName
|
||||||
if (AstName name = names.get("_G"); name.value)
|
if (AstName name = names.get("_G"); name.value)
|
||||||
compiler.globals[name].writable = true;
|
compiler.globals[name].writable = true;
|
||||||
|
|
||||||
if (options.mutableGlobalNames)
|
if (options.mutableGlobals)
|
||||||
for (const char** ptr = options.mutableGlobalNames; *ptr != NULL; ++ptr)
|
for (const char** ptr = options.mutableGlobals; *ptr != NULL; ++ptr)
|
||||||
{
|
{
|
||||||
if (AstName name = names.get(*ptr); name.value)
|
if (AstName name = names.get(*ptr); name.value)
|
||||||
compiler.globals[name].writable = true;
|
compiler.globals[name].writable = true;
|
||||||
|
|
|
@ -3749,7 +3749,7 @@ RETURN R0 0
|
||||||
bcb.setDumpFlags(Luau::BytecodeBuilder::Dump_Code);
|
bcb.setDumpFlags(Luau::BytecodeBuilder::Dump_Code);
|
||||||
Luau::CompileOptions options;
|
Luau::CompileOptions options;
|
||||||
const char* mutableGlobals[] = {"Game", "Workspace", "game", "plugin", "script", "shared", "workspace", NULL};
|
const char* mutableGlobals[] = {"Game", "Workspace", "game", "plugin", "script", "shared", "workspace", NULL};
|
||||||
options.mutableGlobalNames = &mutableGlobals[0];
|
options.mutableGlobals = &mutableGlobals[0];
|
||||||
Luau::compileOrThrow(bcb, source, options);
|
Luau::compileOrThrow(bcb, source, options);
|
||||||
|
|
||||||
CHECK_EQ("\n" + bcb.dumpFunction(0), R"(
|
CHECK_EQ("\n" + bcb.dumpFunction(0), R"(
|
||||||
|
|
Loading…
Add table
Reference in a new issue