@@ -1534,7 +1534,7 @@ let discardAndReturnVoid = DiscardThen ReturnVoid
15341534// the bodies of methods in a couple of places
15351535//-------------------------------------------------------------------------
15361536
1537- let CodeGenThen mgbuf ( zapFirstSeqPointToStart , entryPointInfo , methodName , eenv , alreadyUsedArgs , alreadyUsedLocals , codeGenFunction , m ) =
1537+ let CodeGenThen cenv mgbuf( zapFirstSeqPointToStart , entryPointInfo , methodName , eenv , alreadyUsedArgs , alreadyUsedLocals , codeGenFunction , m ) =
15381538let cgbuf = new CodeGenBuffer( m, mgbuf, methodName, alreadyUsedArgs, alreadyUsedLocals, zapFirstSeqPointToStart)
15391539let start = CG.GenerateMark cgbuf" mstart"
15401540let innerVals = entryPointInfo|> List.map( fun ( v , kind ) -> ( v,( kind, start)))
@@ -1554,7 +1554,21 @@ let CodeGenThen mgbuf (zapFirstSeqPointToStart,entryPointInfo,methodName,eenv,al
15541554{ locRange=( start.CodeLabel, finish.CodeLabel);
15551555 locInfos= [{ LocalIndex= i; LocalName= nm}] })
15561556
1557- ( List.map( snd>> mkILLocal) locals,
1557+ let ilLocals =
1558+ locals
1559+ |> List.map( fun ( infos , ty ) ->
1560+ // in interactive environment, attach name and range info to locals to improve debug experience
1561+ if cenv.opts.isInteractive&& cenv.opts.generateDebugSymbolsthen
1562+ match infoswith
1563+ | [( nm, ( start, finish))] -> mkILLocal ty( Some( nm, start.CodeLabel, finish.CodeLabel))
1564+ // REVIEW: what do these cases represent?
1565+ | _ :: _
1566+ | [] -> mkILLocal ty None
1567+ // if not interactive, don't bother adding this info
1568+ else
1569+ mkILLocal ty None)
1570+
1571+ ( ilLocals,
15581572 maxStack,
15591573 computeCodeLabelToPC,
15601574 code,
@@ -1566,7 +1580,7 @@ let CodeGenMethod cenv mgbuf (zapFirstSeqPointToStart,entryPointInfo,methodName,
15661580(* Codegen the method. REVIEW: change this to generate the AbsIL code tree directly...*)
15671581
15681582let locals , maxStack , computeCodeLabelToPC , instrs , exns , localDebugSpecs , hasSequencePoints =
1569- CodeGenThen mgbuf( zapFirstSeqPointToStart, entryPointInfo, methodName, eenv, alreadyUsedArgs, alreadyUsedLocals, codeGenFunction, m)
1583+ CodeGenThencenv mgbuf( zapFirstSeqPointToStart, entryPointInfo, methodName, eenv, alreadyUsedArgs, alreadyUsedLocals, codeGenFunction, m)
15701584
15711585let dump () =
15721586 instrs|> Array.iteri( fun i instr -> dprintf" %s :%d :%A \n " methodName i instr);