未验证 提交 a766f25c 编写于 作者: F Florian Verdonck 提交者: GitHub

Include end in nested sig module range. (#15117)

上级 f69e2f5f
......@@ -662,11 +662,13 @@ moduleSpfn:
if isRec then raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsInvalidUseOfRec())
let info = SynComponentInfo($1 @ attribs2, None, [], path, xmlDoc, false, vis, rhs parseState 3)
if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2))
let m = (rhs2 parseState 1 4, $5)
let decls, mOptEnd = $5
let m = (rhs2 parseState 1 4, decls)
||> unionRangeWithListBy (fun (d: SynModuleSigDecl) -> d.Range)
|> unionRangeWithXmlDoc xmlDoc
let m = match mOptEnd with | None -> m | Some mEnd -> unionRanges m mEnd
let trivia: SynModuleSigDeclNestedModuleTrivia = { ModuleKeyword = Some mModule; EqualsRange = $4 }
SynModuleSigDecl.NestedModule(info, isRec, $5, m, trivia) }
SynModuleSigDecl.NestedModule(info, isRec, decls, m, trivia) }
| opt_attributes opt_access moduleIntro error
{ let mModule, isRec, path, vis, attribs2 = $3
......@@ -743,15 +745,17 @@ moduleSpecBlock:
/* #light-syntax, with no sig/end or begin/end */
| OBLOCKBEGIN moduleSpfns oblockend
{ $2 }
{ $2, None }
/* #light-syntax, with sig/end or begin/end */
| OBLOCKBEGIN sigOrBegin moduleSpfnsPossiblyEmpty END oblockend
{ $3 }
{ let mEnd = rhs parseState 4
$3, Some mEnd }
/* non-#light-syntax, with sig/end or begin/end */
| sigOrBegin moduleSpfnsPossiblyEmpty END
{ $2 }
{ let mEnd = rhs parseState 3
$2, Some mEnd }
tyconSpfnList:
......
namespace X
module Y =
begin
val a: int
type B = string
end
SigFile
(ParsedSigFileInput
("/root/NestedModule/NestedModuleWithBeginEndAndDecls.fsi",
QualifiedNameOfFile NestedModuleWithBeginEndAndDecls, [], [],
[SynModuleOrNamespaceSig
([X], false, DeclaredNamespace,
[NestedModule
(SynComponentInfo
([], None, [], [Y],
PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), false,
None, (3,0--3,8)), false,
[Val
(SynValSig
([], SynIdent (a, None), SynValTyparDecls (None, true),
LongIdent (SynLongIdent ([int], [], [None])),
SynValInfo ([], SynArgInfo ([], false, None)), false, false,
PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector),
None, None, (5,8--5,18), { LeadingKeyword = Val (5,8--5,11)
InlineKeyword = None
WithKeyword = None
EqualsRange = None }),
(5,8--5,18));
Types
([SynTypeDefnSig
(SynComponentInfo
([], None, [], [B],
PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector),
false, None, (6,13--6,14)),
Simple
(TypeAbbrev
(Ok, LongIdent (SynLongIdent ([string], [], [None])),
(6,17--6,23)), (6,17--6,23)), [], (6,13--6,23),
{ LeadingKeyword = Type (6,8--6,12)
EqualsRange = Some (6,15--6,16)
WithKeyword = None })], (6,8--6,23))], (3,0--7,7),
{ ModuleKeyword = Some (3,0--3,6)
EqualsRange = Some (3,9--3,10) })], PreXmlDocEmpty, [], None,
(1,0--7,7), { LeadingKeyword = Namespace (1,0--1,9) })],
{ ConditionalDirectives = []
CodeComments = [] }, set []))
SigFile
(ParsedSigFileInput
("/root/NestedModule/RangeOfBeginEnd.fsi",
QualifiedNameOfFile RangeOfBeginEnd, [], [],
[SynModuleOrNamespaceSig
([X], false, DeclaredNamespace,
[NestedModule
(SynComponentInfo
([], None, [], [Y],
PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), false,
None, (3,0--3,8)), false, [], (3,0--4,13),
{ ModuleKeyword = Some (3,0--3,6)
EqualsRange = Some (3,9--3,10) })], PreXmlDocEmpty, [], None,
(1,0--4,13), { LeadingKeyword = Namespace (1,0--1,9) })],
{ ConditionalDirectives = []
CodeComments = [] }, set []))
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册