Skip to content

Commit

Permalink
Keep commentLocations on SourceModule for definition files (#1314)
Browse files Browse the repository at this point in the history
Right now, the commentLocations are not transferred over to the
SourceModule for definition files, like they are for normal source
modules. This means we lose out on finding documentation comments. We
add that in here

#1137 (comment)
  • Loading branch information
JohnnyMorganz authored Jul 9, 2024
1 parent a7be4fc commit f5a2c5d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Analysis/src/Frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ LUAU_FASTINT(LuauTarjanChildLimit)
LUAU_FASTFLAG(LuauInferInNoCheckMode)
LUAU_FASTFLAGVARIABLE(LuauKnowsTheDataModel3, false)
LUAU_FASTFLAGVARIABLE(LuauCancelFromProgress, false)
LUAU_FASTFLAGVARIABLE(LuauStoreCommentsForDefinitionFiles, false)
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution)
LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverToJson, false)
LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverToJsonFile, false)
Expand Down Expand Up @@ -127,6 +128,12 @@ static ParseResult parseSourceForModule(std::string_view source, Luau::SourceMod
Luau::ParseResult parseResult = Luau::Parser::parse(source.data(), source.size(), *sourceModule.names, *sourceModule.allocator, options);
sourceModule.root = parseResult.root;
sourceModule.mode = Mode::Definition;

if (FFlag::LuauStoreCommentsForDefinitionFiles && options.captureComments)
{
sourceModule.hotcomments = std::move(parseResult.hotcomments);
sourceModule.commentLocations = std::move(parseResult.commentLocations);
}
return parseResult;
}

Expand Down

0 comments on commit f5a2c5d

Please sign in to comment.