提交 2063694b 编写于 作者: E Eugene Auduchinok 提交者: Will Smith

Don't try to print startupRange file contents in debug (#7898)

上级 77800470
......@@ -26,7 +26,7 @@ open FSharp.Compiler.Features
open Internal.Utilities
let internal DummyFileNameForRangesWithoutASpecificLocation = "startup"
let internal DummyFileNameForRangesWithoutASpecificLocation = startupFileName
let private envRange = rangeN DummyFileNameForRangesWithoutASpecificLocation 0
/// Represents an intrinsic value from FSharp.Core known to the compiler
......
......@@ -200,6 +200,10 @@ let fileOfFileIndex idx = fileIndexTable.IndexToFile idx
let mkPos l c = pos (l, c)
let unknownFileName = "unknown"
let startupFileName = "startup"
let commandLineArgsFileName = "commandLineArgs"
[<Struct; CustomEquality; NoComparison>]
#if DEBUG
[<System.Diagnostics.DebuggerDisplay("({StartLine},{StartColumn}-{EndLine},{EndColumn}) {FileName} IsSynthetic={IsSynthetic} -> {DebugCode}")>]
......@@ -249,6 +253,9 @@ type range(code1:int64, code2: int64) =
#if DEBUG
member r.DebugCode =
let name = r.FileName
if name = unknownFileName || name = startupFileName || name = commandLineArgsFileName then name else
try
let endCol = r.EndColumn - 1
let startCol = r.StartColumn - 1
......@@ -323,11 +330,11 @@ let rangeN filename line = mkRange filename (mkPos line 0) (mkPos line 0)
let pos0 = mkPos 1 0
let range0 = rangeN "unknown" 1
let range0 = rangeN unknownFileName 1
let rangeStartup = rangeN "startup" 1
let rangeStartup = rangeN startupFileName 1
let rangeCmdArgs = rangeN "commandLineArgs" 0
let rangeCmdArgs = rangeN commandLineArgsFileName 0
let trimRangeToLine (r:range) =
let startL, startC = r.StartLine, r.StartColumn
......
......@@ -44,6 +44,10 @@ val mkPos : line:int -> column:int -> pos
/// Ordering on positions
val posOrder : IComparer<pos>
val unknownFileName: string
val startupFileName: string
val commandLineArgsFileName: string
/// Represents a range within a known file
[<Struct; CustomEquality; NoComparison>]
type range =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册