sanitize location constructor
This commit is contained in:
Родитель
8d6f53d125
Коммит
aa23d8ac1e
|
@ -38,7 +38,7 @@ namespace Debugger
|
|||
|
||||
var breakPoint = GetBreakpointAt (file, line);
|
||||
if (breakPoint == null)
|
||||
AddBreakpoint (new Breakpoint (new Location (line, file)));
|
||||
AddBreakpoint (new Breakpoint (new Location (file, line)));
|
||||
else
|
||||
RemoveBreakpoint (breakPoint);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ namespace Debugger
|
|||
file = typeProvider.MapFile (file);
|
||||
if (file == null)
|
||||
return null;
|
||||
var bp = new Breakpoint (new Location (line, file));
|
||||
var bp = new Breakpoint (new Location (file, line));
|
||||
if (AddBreakpoint (bp))
|
||||
return bp;
|
||||
return null;
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace Debugger
|
|||
|
||||
currentThread = suspendingEvent.Thread;
|
||||
var frames = currentThread.GetFrames();
|
||||
currentLocation = frames.Count == 0 ? new Location (0, "") : frames[0].Location;
|
||||
currentLocation = frames.Count == 0 ? new Location ("", 0) : frames[0].Location;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,12 +10,13 @@ namespace Debugger
|
|||
private readonly int _line;
|
||||
private readonly string _file;
|
||||
|
||||
static Location()
|
||||
static Location ()
|
||||
{
|
||||
_default = new Location(0, "");
|
||||
_default = new Location ("", 0);
|
||||
}
|
||||
|
||||
public Location(int line,string file) : base(null)
|
||||
public Location (string file, int line)
|
||||
: base (null)
|
||||
{
|
||||
_line = line;
|
||||
_file = file;
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace Debugger.Unity.Engine
|
|||
foreach (var file in sourcesProvider.Sources)
|
||||
{
|
||||
if (GUILayout.Button (Path.GetFileName (file)))
|
||||
sourceNavigator.ShowSourceLocation (new Location (1, file));
|
||||
sourceNavigator.ShowSourceLocation (new Location (file, 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,11 @@ namespace Debugger.DummyProviders
|
|||
|
||||
class Breakpoint : EventRequest, IBreakpoint
|
||||
{
|
||||
public Breakpoint (ILocation location)
|
||||
{
|
||||
Location = location;
|
||||
}
|
||||
|
||||
public override void Enable ()
|
||||
{
|
||||
Enabled = true;
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace Debugger.DummyProviders
|
|||
|
||||
var breakPoint = GetBreakpointAt (file, line);
|
||||
if (breakPoint == null)
|
||||
AddBreakpoint (new Mock<IBreakpoint>(new Mock<ILocation>(file, line).Object).Object);
|
||||
AddBreakpoint (new Breakpoint (new Location (file, line)));
|
||||
else
|
||||
RemoveBreakpoint (breakPoint);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ namespace Debugger.DummyProviders
|
|||
file = typeProvider.MapFile (file);
|
||||
if (file == null)
|
||||
return null;
|
||||
var bp = new Breakpoint (new Location (line, file));
|
||||
var bp = new Breakpoint (new Location (file, line));
|
||||
if (AddBreakpoint (bp))
|
||||
return bp;
|
||||
return null;
|
||||
|
|
Загрузка…
Ссылка в новой задаче