mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
Keep commentLocations on SourceModule for definition files (#1314)
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 https://github.com/luau-lang/luau/issues/1137#issuecomment-2212413633
This commit is contained in:
parent
a7be4fcc54
commit
f5a2c5d55e
@ -35,6 +35,7 @@ LUAU_FASTINT(LuauTarjanChildLimit)
|
|||||||
LUAU_FASTFLAG(LuauInferInNoCheckMode)
|
LUAU_FASTFLAG(LuauInferInNoCheckMode)
|
||||||
LUAU_FASTFLAGVARIABLE(LuauKnowsTheDataModel3, false)
|
LUAU_FASTFLAGVARIABLE(LuauKnowsTheDataModel3, false)
|
||||||
LUAU_FASTFLAGVARIABLE(LuauCancelFromProgress, false)
|
LUAU_FASTFLAGVARIABLE(LuauCancelFromProgress, false)
|
||||||
|
LUAU_FASTFLAGVARIABLE(LuauStoreCommentsForDefinitionFiles, false)
|
||||||
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution)
|
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution)
|
||||||
LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverToJson, false)
|
LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverToJson, false)
|
||||||
LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverToJsonFile, false)
|
LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverToJsonFile, false)
|
||||||
@ -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);
|
Luau::ParseResult parseResult = Luau::Parser::parse(source.data(), source.size(), *sourceModule.names, *sourceModule.allocator, options);
|
||||||
sourceModule.root = parseResult.root;
|
sourceModule.root = parseResult.root;
|
||||||
sourceModule.mode = Mode::Definition;
|
sourceModule.mode = Mode::Definition;
|
||||||
|
|
||||||
|
if (FFlag::LuauStoreCommentsForDefinitionFiles && options.captureComments)
|
||||||
|
{
|
||||||
|
sourceModule.hotcomments = std::move(parseResult.hotcomments);
|
||||||
|
sourceModule.commentLocations = std::move(parseResult.commentLocations);
|
||||||
|
}
|
||||||
return parseResult;
|
return parseResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user