mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
Small follow code cleanup for Repl.cpp
This commit is contained in:
parent
3ba0bdf708
commit
f3468be92b
18
CLI/Repl.cpp
18
CLI/Repl.cpp
@ -404,12 +404,7 @@ static bool compileFile(const char* name, CompileFormat format)
|
||||
printf("%s", bcb.dumpEverything().c_str());
|
||||
break;
|
||||
case CompileFormat::Binary:
|
||||
#ifdef _WIN32
|
||||
_setmode(_fileno(stdout), _O_BINARY);
|
||||
#endif
|
||||
|
||||
std::string Bytecode = bcb.getBytecode();
|
||||
fwrite(Bytecode.c_str(), 1, Bytecode.size(), stdout);
|
||||
fwrite(bcb.getBytecode().data(), 1, bcb.getBytecode().size(), stdout);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -474,9 +469,12 @@ int main(int argc, char** argv)
|
||||
CompileFormat format = CompileFormat::Default;
|
||||
|
||||
if (strcmp(argv[1], "--compile=binary") == 0)
|
||||
{
|
||||
format = CompileFormat::Binary;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (format == CompileFormat::Binary)
|
||||
_setmode(_fileno(stdout), _O_BINARY);
|
||||
#endif
|
||||
|
||||
int failed = 0;
|
||||
|
||||
@ -488,7 +486,9 @@ int main(int argc, char** argv)
|
||||
if (isDirectory(argv[i]))
|
||||
{
|
||||
traverseDirectory(argv[i], [&](const std::string& name) {
|
||||
if (name.length() > 4 && name.rfind(".lua") == name.length() - 4)
|
||||
if (name.length() > 5 && name.rfind(".luau") == name.length() - 5)
|
||||
failed += !compileFile(name.c_str(), format);
|
||||
else if (name.length() > 4 && name.rfind(".lua") == name.length() - 4)
|
||||
failed += !compileFile(name.c_str(), format);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user