Skip to content

Commit

Permalink
Fix CLI analysis reporting wrong file names (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rerumu committed Nov 6, 2021
1 parent 1e1d1f5 commit 96b1707
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions CLI/Analyze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
report(format, name, error.location, "SyntaxError", syntaxError->message.c_str());
else
Expand All @@ -49,7 +51,10 @@ static void reportWarning(ReportFormat format, const char* name, const Luau::Lin

static bool analyzeFile(Luau::Frontend& frontend, const char* name, ReportFormat format, bool annotate)
{
Luau::CheckResult cr = frontend.check(name);
Luau::CheckResult cr;

if (frontend.isDirty(name))
cr = frontend.check(name);

if (!frontend.getSourceModule(name))
{
Expand All @@ -58,7 +63,7 @@ static bool analyzeFile(Luau::Frontend& frontend, const char* name, ReportFormat
}

for (auto& error : cr.errors)
reportError(format, name, error);
reportError(format, error);

Luau::LintResult lr = frontend.lint(name);

Expand Down

0 comments on commit 96b1707

Please sign in to comment.