Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRansom committed Jan 9, 2023
1 parent 6255d54 commit eed639b
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions src/Compiler/Interactive/fsi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1329,37 +1329,34 @@ let internal mkBoundValueTypedImpl tcGlobals m moduleName name ty =
entity, v, CheckedImplFile.CheckedImplFile(qname, [], mty, contents, false, false, StampMap.Empty, Map.empty)


let scriptingDirectory =
let createDirectory directory =
let scriptingSymbolsPath =
let createDirectory path =
lazy
try
if not (Directory.Exists(directory)) then
Directory.CreateDirectory(directory) |> ignore
if not (Directory.Exists(path)) then
Directory.CreateDirectory(path) |> ignore

directory
path
with _ ->
directory
path

createDirectory (Path.Combine(Path.GetTempPath(), $"{DateTime.Now:s}-{Guid.NewGuid():n}".Replace(':', '-')))

let deleteScripts () =
let deleteScriptingSymbols () =
try
#if !DEBUG
if scriptingDirectory.IsValueCreated then
if Directory.Exists(scriptingDirectory.Value) then
Directory.Delete(scriptingDirectory.Value, true)
if scriptingSymbolsPath.IsValueCreated then
if Directory.Exists(scriptingSymbolsPath.Value) then
Directory.Delete(scriptingSymbolsPath.Value, true)
#else
()
#endif
with _ ->
()

do AppDomain.CurrentDomain.ProcessExit |> Event.add (fun _ -> deleteScripts ())


AppDomain.CurrentDomain.ProcessExit |> Event.add (fun _ -> deleteScriptingSymbols ())

let dynamicCcuName = "FSI-ASSEMBLY"
let dynamicCCuInternalsVisibleArgument = $"{dynamicCcuName}"

/// Encapsulates the coordination of the typechecking, optimization and code generation
/// components of the F# compiler for interactively executed fragments of code.
Expand Down Expand Up @@ -1436,7 +1433,7 @@ type internal FsiDynamicCompiler(
let manifest =
let manifest = ilxMainModule.Manifest.Value
let attrs = [
tcGlobals.MakeInternalsVisibleToAttribute(dynamicCCuInternalsVisibleArgument)
tcGlobals.MakeInternalsVisibleToAttribute(dynamicCcuName)
yield! manifest.CustomAttrs.AsList()
]
{ manifest with
Expand All @@ -1458,7 +1455,7 @@ type internal FsiDynamicCompiler(
let opts = {
ilg = tcGlobals.ilg
outfile = multiAssemblyName + ".dll"
pdbfile = Some (Path.Combine(scriptingDirectory.Value, $"{multiAssemblyName}-{dynamicAssemblyId}.pdb"))
pdbfile = Some (Path.Combine(scriptingSymbolsPath.Value, $"{multiAssemblyName}-{dynamicAssemblyId}.pdb"))
emitTailcalls = tcConfig.emitTailcalls
deterministic = tcConfig.deterministic
portablePDB = true
Expand Down

0 comments on commit eed639b

Please sign in to comment.