1
0
Fork 0
mirror of https://github.com/luau-lang/luau.git synced 2025-04-16 01:43:51 +01:00

Fix CLI reportError showing wrong file names

This commit is contained in:
Rerumu 2021-11-05 21:19:44 -04:00
parent 6342913533
commit bd78c493c5

View file

@ -34,8 +34,10 @@ static void report(ReportFormat format, const char* name, const Luau::Location&
} }
} }
static void reportError(ReportFormat format, const char* name, const Luau::TypeError& error) static void reportError(ReportFormat format, const Luau::TypeError& error)
{ {
const char* name = error.moduleName.c_str();
if (const Luau::SyntaxError* syntaxError = Luau::get_if<Luau::SyntaxError>(&error.data)) if (const Luau::SyntaxError* syntaxError = Luau::get_if<Luau::SyntaxError>(&error.data))
report(format, name, error.location, "SyntaxError", syntaxError->message.c_str()); report(format, name, error.location, "SyntaxError", syntaxError->message.c_str());
else else
@ -58,7 +60,7 @@ static bool analyzeFile(Luau::Frontend& frontend, const char* name, ReportFormat
} }
for (auto& error : cr.errors) for (auto& error : cr.errors)
reportError(format, name, error); reportError(format, error);
Luau::LintResult lr = frontend.lint(name); Luau::LintResult lr = frontend.lint(name);