mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
luau-compile: Fix usage of vector-ctor without vector-lib (#1172)
When --vector-lib is not specified, CompileOptions::vectorLib was set to an empty string. This resulted in the builtin matching not working, since vectorLib must either be a null pointer or a pointer to a valid global identifier. --------- Co-authored-by: vegorov-rbx <75688451+vegorov-rbx@users.noreply.github.com>
This commit is contained in:
parent
3b0e93bec9
commit
c9324853e5
@ -46,10 +46,9 @@ struct GlobalOptions
|
|||||||
int optimizationLevel = 1;
|
int optimizationLevel = 1;
|
||||||
int debugLevel = 1;
|
int debugLevel = 1;
|
||||||
|
|
||||||
std::string vectorLib;
|
const char* vectorLib = nullptr;
|
||||||
std::string vectorCtor;
|
const char* vectorCtor = nullptr;
|
||||||
std::string vectorType;
|
const char* vectorType = nullptr;
|
||||||
|
|
||||||
} globalOptions;
|
} globalOptions;
|
||||||
|
|
||||||
static Luau::CompileOptions copts()
|
static Luau::CompileOptions copts()
|
||||||
@ -58,10 +57,9 @@ static Luau::CompileOptions copts()
|
|||||||
result.optimizationLevel = globalOptions.optimizationLevel;
|
result.optimizationLevel = globalOptions.optimizationLevel;
|
||||||
result.debugLevel = globalOptions.debugLevel;
|
result.debugLevel = globalOptions.debugLevel;
|
||||||
|
|
||||||
// globalOptions outlive the CompileOptions, so it's safe to use string data pointers here
|
result.vectorLib = globalOptions.vectorLib;
|
||||||
result.vectorLib = globalOptions.vectorLib.c_str();
|
result.vectorCtor = globalOptions.vectorCtor;
|
||||||
result.vectorCtor = globalOptions.vectorCtor.c_str();
|
result.vectorType = globalOptions.vectorType;
|
||||||
result.vectorType = globalOptions.vectorType.c_str();
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user