@@ -1139,6 +1139,7 @@ type internal FsiDynamicCompiler
11391139 let newState = { istate with tcState = tcState.NextStateAfterIncrementalFragment( tcEnvAtEndOfLastInput) }
11401140
11411141 // Find all new declarations the EvaluationListener
1142+ let mutable lastValue = None
11421143 try
11431144 let contents = FSharpAssemblyContents( tcGlobals, tcState.Ccu, Some tcState.CcuSig, tcImports, declaredImpls)
11441145 let contentFile = contents.ImplementationFiles.[ 0 ]
@@ -1163,20 +1164,21 @@ type internal FsiDynamicCompiler
11631164 let symbol = FSharpSymbol.Create( cenv, v.Item)
11641165 let symbolUse = FSharpSymbolUse( tcGlobals, newState.tcState.TcEnvFromImpls.DisplayEnv, symbol, ItemOccurence.Binding, v.DeclarationLocation)
11651166 fsi.TriggerEvaluation ( fsiValueOpt, symbolUse, decl)
1167+ lastValue <- fsiValueOpt
11661168 | FSharpImplementationFileDeclaration.Entity ( e,_) ->
11671169 // Report a top-level module or namespace definition
11681170 let symbol = FSharpSymbol.Create( cenv, e.Item)
11691171 let symbolUse = FSharpSymbolUse( tcGlobals, newState.tcState.TcEnvFromImpls.DisplayEnv, symbol, ItemOccurence.Binding, e.DeclarationLocation)
11701172 fsi.TriggerEvaluation ( None, symbolUse, decl)
1173+ lastValue <- None
11711174 | FSharpImplementationFileDeclaration.InitAction _ ->
11721175 // Top level 'do' bindings are not reported as incremental declarations
1173- ()
1176+ lastValue <- None
11741177 | _ -> ()
11751178 with _ -> ()
11761179
1177- newState
1178-
1179-
1180+ newState, Completed lastValue
1181+
11801182 /// Evaluate the given expression and produce a new interactive state.
11811183 member fsiDynamicCompiler.EvalParsedExpression ( ctok , errorLogger : ErrorLogger , istate , expr : SynExpr ) =
11821184 let tcConfig = TcConfig.Create ( tcConfigB, validate= false )
@@ -1186,7 +1188,7 @@ type internal FsiDynamicCompiler
11861188 let defs = fsiDynamicCompiler.BuildItBinding expr
11871189
11881190 // Evaluate the overall definitions.
1189- let istate = fsiDynamicCompiler.EvalParsedDefinitions ( ctok, errorLogger, istate, false , true , defs)
1191+ let istate = fsiDynamicCompiler.EvalParsedDefinitions ( ctok, errorLogger, istate, false , true , defs) |> fst
11901192 // Snarf the type for 'it' via the binding
11911193 match istate.tcState.TcEnvFromImpls.NameEnv.FindUnqualifiedItem itName with
11921194 | NameResolution.Item.Value vref ->
@@ -1787,7 +1789,7 @@ type internal FsiInteractionProcessor
17871789 | IDefns ([ SynModuleDecl.DoExpr(_, expr,_)],_) ->
17881790 fsiDynamicCompiler.EvalParsedExpression( ctok, errorLogger, istate, expr)
17891791 | IDefns ( defs,_) ->
1790- fsiDynamicCompiler.EvalParsedDefinitions ( ctok, errorLogger, istate, true , false , defs), Completed None
1792+ fsiDynamicCompiler.EvalParsedDefinitions ( ctok, errorLogger, istate, true , false , defs)
17911793
17921794 | IHash ( ParsedHashDirective( " load" , sourceFiles, m),_) ->
17931795 fsiDynamicCompiler.EvalSourceFiles ( ctok, istate, m, sourceFiles, lexResourceManager, errorLogger), Completed None
@@ -2085,7 +2087,7 @@ type internal FsiInteractionProcessor
20852087 /// Send a dummy interaction through F# Interactive, to ensure all the most common code generation paths are
20862088 /// JIT'ed and ready for use.
20872089 member __.LoadDummyInteraction ( ctok , errorLogger ) =
2088- setCurrState ( currState |> InteractiveCatch errorLogger ( fun istate -> fsiDynamicCompiler.EvalParsedDefinitions ( ctok, errorLogger, istate, true , false , []), Completed None) |> fst)
2090+ setCurrState ( currState |> InteractiveCatch errorLogger ( fun istate -> fsiDynamicCompiler.EvalParsedDefinitions ( ctok, errorLogger, istate, true , false , []) |> fst , Completed None) |> fst)
20892091
20902092 member __.EvalInteraction ( ctok , sourceText , scriptFileName , errorLogger ) =
20912093 use _unwind1 = ErrorLogger.PushThreadBuildPhaseUntilUnwind( ErrorLogger.BuildPhase.Interactive)
0 commit comments