@@ -80,8 +80,8 @@ let PrependPathToSpec x (SynModuleOrNamespaceSig(p, b, c, d, e, f, g, h)) =
8080
8181let PrependPathToInput x inp =
8282 match inp with
83- | ParsedInput.ImplFile ( ParsedImplFileInput ( b, c, q, d, hd, impls, e)) ->
84- ParsedInput.ImplFile ( ParsedImplFileInput ( b, c, PrependPathToQualFileName x q, d, hd, List.map ( PrependPathToImpl x) impls, e))
83+ | ParsedInput.ImplFile ( ParsedImplFileInput ( b, c, q, d, hd, impls, e, trivia )) ->
84+ ParsedInput.ImplFile ( ParsedImplFileInput ( b, c, PrependPathToQualFileName x q, d, hd, List.map ( PrependPathToImpl x) impls, e, trivia ))
8585
8686 | ParsedInput.SigFile ( ParsedSigFileInput ( b, q, d, hd, specs)) ->
8787 ParsedInput.SigFile ( ParsedSigFileInput ( b, PrependPathToQualFileName x q, d, hd, List.map ( PrependPathToSpec x) specs))
@@ -178,7 +178,7 @@ let GetScopedPragmasForHashDirective hd =
178178 | Some n -> yield ScopedPragma.WarningOff( m, n)
179179 | _ -> () ]
180180
181- let PostParseModuleImpls ( defaultNamespace , filename , isLastCompiland , ParsedImplFile ( hashDirectives , impls )) =
181+ let PostParseModuleImpls ( defaultNamespace , filename , isLastCompiland , ParsedImplFile ( hashDirectives , impls ), lexbuf : UnicodeLexing.Lexbuf ) =
182182 match impls |> List.rev |> List.tryPick ( function ParsedImplFileFragment.NamedModule( SynModuleOrNamespace( lid, _, _, _, _, _, _, _)) -> Some lid | _ -> None) with
183183 | Some lid when impls.Length > 1 ->
184184 errorR( Error( FSComp.SR.buildMultipleToplevelModules(), rangeOfLid lid))
@@ -197,7 +197,9 @@ let PostParseModuleImpls (defaultNamespace, filename, isLastCompiland, ParsedImp
197197 for hd in hashDirectives do
198198 yield ! GetScopedPragmasForHashDirective hd ]
199199
200- ParsedInput.ImplFile ( ParsedImplFileInput ( filename, isScript, qualName, scopedPragmas, hashDirectives, impls, isLastCompiland))
200+ let conditionalDirectives = LexbufIfdefStore.GetTrivia( lexbuf)
201+
202+ ParsedInput.ImplFile ( ParsedImplFileInput ( filename, isScript, qualName, scopedPragmas, hashDirectives, impls, isLastCompiland, { ConditionalDirectives = conditionalDirectives }))
201203
202204let PostParseModuleSpecs ( defaultNamespace , filename , isLastCompiland , ParsedSigFile ( hashDirectives , specs )) =
203205 match specs |> List.rev |> List.tryPick ( function ParsedSigFileFragment.NamedModule( SynModuleOrNamespaceSig( lid, _, _, _, _, _, _, _)) -> Some lid | _ -> None) with
@@ -242,9 +244,9 @@ let DeduplicateModuleName (moduleNamesDict: ModuleNamesDict) fileName (qualNameO
242244/// Checks if a ParsedInput is using a module name that was already given and deduplicates the name if needed.
243245let DeduplicateParsedInputModuleName ( moduleNamesDict : ModuleNamesDict ) input =
244246 match input with
245- | ParsedInput.ImplFile ( ParsedImplFileInput.ParsedImplFileInput ( fileName, isScript, qualNameOfFile, scopedPragmas, hashDirectives, modules, ( isLastCompiland, isExe))) ->
247+ | ParsedInput.ImplFile ( ParsedImplFileInput.ParsedImplFileInput ( fileName, isScript, qualNameOfFile, scopedPragmas, hashDirectives, modules, ( isLastCompiland, isExe), trivia )) ->
246248 let qualNameOfFileT , moduleNamesDictT = DeduplicateModuleName moduleNamesDict fileName qualNameOfFile
247- let inputT = ParsedInput.ImplFile ( ParsedImplFileInput.ParsedImplFileInput ( fileName, isScript, qualNameOfFileT, scopedPragmas, hashDirectives, modules, ( isLastCompiland, isExe)))
249+ let inputT = ParsedInput.ImplFile ( ParsedImplFileInput.ParsedImplFileInput ( fileName, isScript, qualNameOfFileT, scopedPragmas, hashDirectives, modules, ( isLastCompiland, isExe), trivia ))
248250 inputT, moduleNamesDictT
249251 | ParsedInput.SigFile ( ParsedSigFileInput.ParsedSigFileInput ( fileName, qualNameOfFile, scopedPragmas, hashDirectives, modules)) ->
250252 let qualNameOfFileT , moduleNamesDictT = DeduplicateModuleName moduleNamesDict fileName qualNameOfFile
@@ -279,7 +281,7 @@ let ParseInput (lexer, diagnosticOptions:FSharpDiagnosticOptions, errorLogger: E
279281 if FSharpImplFileSuffixes |> List.exists ( FileSystemUtils.checkSuffix lower) then
280282 let impl = Parser.implementationFile lexer lexbuf
281283 LexbufLocalXmlDocStore.ReportInvalidXmlDocPositions( lexbuf)
282- PostParseModuleImpls ( defaultNamespace, filename, isLastCompiland, impl)
284+ PostParseModuleImpls ( defaultNamespace, filename, isLastCompiland, impl, lexbuf )
283285 elif FSharpSigFileSuffixes |> List.exists ( FileSystemUtils.checkSuffix lower) then
284286 let intfs = Parser.signatureFile lexer lexbuf
285287 LexbufLocalXmlDocStore.ReportInvalidXmlDocPositions( lexbuf)
@@ -355,7 +357,8 @@ let EmptyParsedInput(filename, isLastCompiland) =
355357 [],
356358 [],
357359 [],
358- isLastCompiland
360+ isLastCompiland,
361+ { ConditionalDirectives = [] }
359362 )
360363 )
361364
@@ -649,7 +652,7 @@ let ProcessMetaCommandsFromInput
649652 let state = List.fold ProcessMetaCommand state0 hashDirectives
650653 let state = List.fold ProcessMetaCommandsFromModuleSpec state specs
651654 state
652- | ParsedInput.ImplFile ( ParsedImplFileInput (_, _, _, _, hashDirectives , impls, _ )) ->
655+ | ParsedInput.ImplFile ( ParsedImplFileInput ( hashDirectives = hashDirectives ; modules = impls)) ->
653656 let state = List.fold ProcessMetaCommand state0 hashDirectives
654657 let state = List.fold ProcessMetaCommandsFromModuleImpl state impls
655658 state
@@ -871,7 +874,7 @@ let TypeCheckOneInput(checkForErrors,
871874
872875 return ( tcEnv, EmptyTopAttrs, None, ccuSigForFile), tcState
873876
874- | ParsedInput.ImplFile ( ParsedImplFileInput (_, _, qualNameOfFile, _, _, _, _ ) as file) ->
877+ | ParsedInput.ImplFile ( ParsedImplFileInput ( qualifiedNameOfFile = qualNameOfFile) as file) ->
875878
876879 // Check if we've got an interface for this fragment
877880 let rootSigOpt = tcState.tcsRootSigs.TryFind qualNameOfFile
0 commit comments