Browse Source

NRefactory: use Location structure instead of System.Drawing.Point for source positions.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1581 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
835c7dedbd
  1. 2
      src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/Boo.InterpreterAddIn.booproj
  2. 55
      src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/ContextEntry.boo
  3. 61
      src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/DefaultBooInterpreterContext.boo
  4. 21
      src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InteractiveInterpreterControl.boo
  5. 25
      src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InterpreterContext.boo
  6. 86
      src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InterpreterPad.boo
  7. 2
      src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/BooPrinterVisitorWithComments.cs
  8. 4
      src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/ConvertVisitor.cs
  9. 2
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/NRefactoryDesignerLoader.cs
  10. 4
      src/Libraries/NRefactory/Project/NRefactory.csproj
  11. 19
      src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs
  12. 1
      src/Libraries/NRefactory/Project/Src/Lexer/LookupTable.cs
  13. 3
      src/Libraries/NRefactory/Project/Src/Lexer/Special/BlankLine.cs
  14. 3
      src/Libraries/NRefactory/Project/Src/Lexer/Special/Comment.cs
  15. 15
      src/Libraries/NRefactory/Project/Src/Lexer/Special/ISpecial.cs
  16. 3
      src/Libraries/NRefactory/Project/Src/Lexer/Special/PreProcessingDirective.cs
  17. 11
      src/Libraries/NRefactory/Project/Src/Lexer/Special/SpecialTracker.cs
  18. 3
      src/Libraries/NRefactory/Project/Src/Lexer/Special/TagComment.cs
  19. 9
      src/Libraries/NRefactory/Project/Src/Lexer/Token.cs
  20. 13
      src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs
  21. 5
      src/Libraries/NRefactory/Project/Src/Output/SpecialNodesInserter.cs
  22. 9
      src/Libraries/NRefactory/Project/Src/Parser/AST/AbstractNode.cs
  23. 51
      src/Libraries/NRefactory/Project/Src/Parser/AST/Generated.cs
  24. 5
      src/Libraries/NRefactory/Project/Src/Parser/AST/INode.cs
  25. 2113
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs
  26. 3
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG
  27. 51
      src/Libraries/NRefactory/Project/Src/Parser/Location.cs
  28. 9
      src/Libraries/NRefactory/Project/Src/Parser/Modifiers.cs
  29. 2141
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  30. 1
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
  31. 15
      src/Libraries/NRefactory/Project/Src/Parser/Visitors/LookupTableVisitor.cs
  32. 13
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs
  33. 9
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs
  34. 11
      src/Main/Base/Project/Src/Dom/Region.cs

2
src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/Boo.InterpreterAddIn.booproj

@ -39,6 +39,8 @@ @@ -39,6 +39,8 @@
<Compile Include="InteractiveInterpreterControl.boo" />
<Compile Include="InterpreterPad.boo" />
<Compile Include="InterpreterContext.boo" />
<Compile Include="ContextEntry.boo" />
<Compile Include="DefaultBooInterpreterContext.boo" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">

55
src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/ContextEntry.boo

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
namespace Boo.InterpreterAddIn
import System
import System.Windows.Forms
import ICSharpCode.Core
import ICSharpCode.SharpDevelop.Gui
class ContextEntry:
[getter(InterpreterControl)]
_ctl as InteractiveInterpreterControl
[getter(Context)]
_context as InterpreterContext
[getter(ToolBarItem)]
_item as ToolStripButton
_parentPad as InterpreterPad
def constructor([required] context as InterpreterContext, [required] parentPad as InterpreterPad):
_context = context
_parentPad = parentPad
_ctl = InteractiveInterpreterControl(context)
_ctl.Dock = DockStyle.Fill
_item = ToolStripButton(StringParser.Parse(context.Title), context.Image)
_item.ToolTipText = context.ToolTipText
_item.Visible = context.Visible
_item.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText
context.ImageChanged += AutoInvoke() do:
_item.Image = _context.Image
context.TitleChanged += AutoInvoke() do:
_item.Text = StringParser.Parse(_context.Title)
context.ToolTipTextChanged += AutoInvoke() do:
_item.ToolTipText = StringParser.Parse(_context.ToolTipText)
context.VisibleChanged += AutoInvoke() do:
_item.Visible = _context.Visible
_parentPad.UpdateToolBarVisible()
if _parentPad.CurrentContext is self and _context.Visible == false:
_parentPad.ActivateFirstVisibleContext()
_item.Click += def:
_parentPad.CurrentContext = self
private static def AutoInvoke(what as callable()) as EventHandler:
return def(sender as object, e as EventArgs):
WorkbenchSingleton.SafeThreadAsyncCall(what)

61
src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/DefaultBooInterpreterContext.boo

@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
namespace Boo.InterpreterAddIn
import System
import System.Reflection
class DefaultBooInterpreterContext(InterpreterContext):
_interpreter as Boo.Lang.Interpreter.InteractiveInterpreter
_isAdditionalTab as bool
def constructor():
self.Image = ICSharpCode.Core.ResourceService.GetBitmap("Boo.ProjectIcon")
def constructor(isAdditionalTab as bool):
self()
if isAdditionalTab:
self.Title = "New " + self.Title
_isAdditionalTab = true
private def AddAssemblies(main as Assembly):
_interpreter.References.Add(main)
for reference in main.GetReferencedAssemblies():
_interpreter.References.Add(Assembly.Load(reference.FullName))
private def InitInterpreter():
_interpreter = Boo.Lang.Interpreter.InteractiveInterpreter(
RememberLastValue: true,
Print: self.PrintLine)
AddAssemblies(typeof(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton).Assembly)
_interpreter.SetValue("cls", RaiseClear)
_interpreter.SetValue("newTab") do():
InterpreterPad.Instance.AddInterpreterContext(c = DefaultBooInterpreterContext(true))
return c
if _isAdditionalTab:
_interpreter.SetValue("thisTab", self)
_interpreter.LoopEval("""
import System
import System.IO
import System.Text
""")
def RunCommand(code as string):
InitInterpreter() if _interpreter is null
try:
_interpreter.LoopEval(code)
except x as System.Reflection.TargetInvocationException:
PrintLine(x.InnerException.ToString())
def GetGlobals():
InitInterpreter() if _interpreter is null
return _interpreter.globals()
def CloseTab():
InterpreterPad.Instance.RemoveInterpreterContext(self)

21
src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InteractiveInterpreterControl.boo

@ -14,6 +14,7 @@ import System @@ -14,6 +14,7 @@ import System
import System.Drawing
import System.IO
import System.Windows.Forms
import ICSharpCode.SharpDevelop.Gui
import ICSharpCode.TextEditor
import ICSharpCode.TextEditor.Document
import ICSharpCode.TextEditor.Actions
@ -75,8 +76,16 @@ class InteractiveInterpreterControl(TextEditorControl): @@ -75,8 +76,16 @@ class InteractiveInterpreterControl(TextEditorControl):
def constructor([required] interpreter as InterpreterContext):
self._interpreter = interpreter
self._interpreter.LinePrinted += self.print
self._interpreter.Cleared += self.cls
self._interpreter.LinePrinted += def(line as string):
if WorkbenchSingleton.InvokeRequired:
WorkbenchSingleton.SafeThreadAsyncCall(self.print, (line,))
else:
self.print(line)
self._interpreter.Cleared += def():
if WorkbenchSingleton.InvokeRequired:
WorkbenchSingleton.SafeThreadAsyncCall(self.cls)
else:
self.cls()
self._lineHistory = LineHistory(CurrentLineChanged: _lineHistory_CurrentLineChanged)
self.Document.HighlightingStrategy = GetBooHighlighting()
self.EnableFolding = false
@ -132,8 +141,8 @@ class InteractiveInterpreterControl(TextEditorControl): @@ -132,8 +141,8 @@ class InteractiveInterpreterControl(TextEditorControl):
else:
_block.WriteLine(code)
def print(msg):
AppendText("${msg}\r\n")
def print(msg as string):
AppendText(msg + "\r\n")
def prompt():
AppendText((">>> ", "... ")[_state])
@ -196,10 +205,8 @@ class InteractiveInterpreterControl(TextEditorControl): @@ -196,10 +205,8 @@ class InteractiveInterpreterControl(TextEditorControl):
if key == Keys.Enter:
try:
(SingleLineInputState, BlockInputState)[_state]()
except x as System.Reflection.TargetInvocationException:
print(x.InnerException)
except x:
print(x)
print(x.ToString())
prompt()
return true

25
src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InterpreterContext.boo

@ -49,28 +49,3 @@ abstract class InterpreterContext: @@ -49,28 +49,3 @@ abstract class InterpreterContext:
virtual def SuggestCodeCompletion(code as string) as (string):
"""Gets list of available members for completion on the passed expression. Used for '.' completion"""
return null
class DefaultBooInterpreterContext(InterpreterContext):
_interpreter as Boo.Lang.Interpreter.InteractiveInterpreter
def constructor():
self.Image = ICSharpCode.Core.ResourceService.GetBitmap("Boo.ProjectIcon")
private def InitInterpreter():
_interpreter = Boo.Lang.Interpreter.InteractiveInterpreter(
RememberLastValue: true,
Print: self.PrintLine)
_interpreter.SetValue("cls", RaiseClear)
_interpreter.LoopEval("""
import System
import System.IO
import System.Text
""")
def RunCommand(code as string):
InitInterpreter() if _interpreter is null
_interpreter.LoopEval(code)
def GetGlobals():
InitInterpreter() if _interpreter is null
return _interpreter.globals()

86
src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InterpreterPad.boo

@ -12,81 +12,65 @@ import System.Windows.Forms @@ -12,81 +12,65 @@ import System.Windows.Forms
import ICSharpCode.Core
import ICSharpCode.SharpDevelop.Gui
class ContextEntry:
[getter(InterpreterControl)]
_ctl as InteractiveInterpreterControl
[getter(Context)]
_context as InterpreterContext
[getter(ToolBarItem)]
_item as ToolStripButton
_parentPad as InterpreterPad
def constructor([required] context as InterpreterContext, [required] parentPad as InterpreterPad):
_context = context
_parentPad = parentPad
_ctl = InteractiveInterpreterControl(context)
_ctl.Dock = DockStyle.Fill
_item = ToolStripButton(StringParser.Parse(context.Title), context.Image)
_item.ToolTipText = context.ToolTipText
_item.Visible = context.Visible
_item.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText
context.ImageChanged += AutoInvoke() do:
_item.Image = _context.Image
context.TitleChanged += AutoInvoke() do:
_item.Text = StringParser.Parse(_context.Title)
context.ToolTipTextChanged += AutoInvoke() do:
_item.ToolTipText = StringParser.Parse(_context.ToolTipText)
context.VisibleChanged += AutoInvoke() do:
_item.Visible = _context.Visible
_parentPad.UpdateToolBarVisible()
if _parentPad.CurrentContext is self and _context.Visible == false:
_parentPad.ActivateFirstVisibleContext()
_item.Click += def:
_parentPad.CurrentContext = self
private static def AutoInvoke(what as callable()) as EventHandler:
return def(sender as object, e as EventArgs):
WorkbenchSingleton.SafeThreadAsyncCall(what)
class InterpreterPad(AbstractPadContent, IClipboardHandler):
[getter(Contexts)]
_contexts = []
public static Instance as InterpreterPad:
get:
return WorkbenchSingleton.Workbench.GetPad(InterpreterPad).PadContent
_contexts = []
_currentContext as ContextEntry
_toolStrip = ToolStrip(GripStyle: ToolStripGripStyle.Hidden)
_panel = Panel()
_initDone
def constructor():
_panel.Controls.Add(_toolStrip)
for context as InterpreterContext in AddInTree.GetTreeNode("/AddIns/InterpreterAddIn/InterpreterContexts").BuildChildItemsArrayList(self):
newContext = ContextEntry(context, self)
_toolStrip.Items.Add(newContext.ToolBarItem)
_contexts.Add(newContext)
AddInterpreterContext(context)
ActivateFirstVisibleContext()
UpdateToolBarVisible()
_initDone = true
def AddInterpreterContext([required] context as InterpreterContext):
newContext = ContextEntry(context, self)
_toolStrip.Items.Add(newContext.ToolBarItem)
_contexts.Add(newContext)
UpdateToolBarVisible() if _initDone
return newContext
def RemoveInterpreterContext([required] context as InterpreterContext):
for c as ContextEntry in _contexts:
if c.Context is context:
RemoveInterpreterContext(c)
return
def RemoveInterpreterContext([required] context as ContextEntry):
_contexts.Remove(context)
_toolStrip.Items.Remove(context.ToolBarItem)
ActivateFirstVisibleContext() if self.CurrentContext is context
UpdateToolBarVisible()
def UpdateToolBarVisible():
count = 0
for c as ContextEntry in self.Contexts:
for c as ContextEntry in _contexts:
count += 1 if c.Context.Visible
_toolStrip.Visible = (count > 1)
def ActivateFirstVisibleContext():
for c as ContextEntry in self.Contexts:
for c as ContextEntry in _contexts:
if c.Context.Visible:
self.CurrentContext = c
return
self.CurrentContext = null
Control as Control:
get:
return _panel
public Contexts:
get:
return System.Collections.ArrayList.ReadOnly(_contexts)
CurrentContext:
get:
return _currentContext
@ -96,9 +80,9 @@ class InterpreterPad(AbstractPadContent, IClipboardHandler): @@ -96,9 +80,9 @@ class InterpreterPad(AbstractPadContent, IClipboardHandler):
_panel.Controls.Remove(_currentContext.InterpreterControl)
if value is not null:
_panel.Controls.Add(value.InterpreterControl)
_panel.Controls.SetChildIndex(_toolStrip, 1)
_panel.Controls.SetChildIndex(_toolStrip, 1)
_currentContext = value
for c as ContextEntry in self.Contexts:
for c as ContextEntry in _contexts:
c.ToolBarItem.Checked = c is value
CurrentTextArea:

2
src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/BooPrinterVisitorWithComments.cs

@ -49,7 +49,7 @@ namespace NRefactoryToBooConverter @@ -49,7 +49,7 @@ namespace NRefactoryToBooConverter
void AcceptPoint(int line, int column)
{
while (available) {
Point b = enumerator.Current.StartPosition;
Location b = enumerator.Current.StartPosition;
if (b.Y < line || (b.Y == line && b.X <= column)) {
WriteCurrent();
} else {

4
src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/ConvertVisitor.cs

@ -47,7 +47,7 @@ namespace NRefactoryToBooConverter @@ -47,7 +47,7 @@ namespace NRefactoryToBooConverter
{
if (node == null)
return new B.LexicalInfo(fileName);
Point point = node.StartLocation;
Location point = node.StartLocation;
if (!point.IsEmpty) {
lastLexicalInfo = new B.LexicalInfo(fileName, point.Y, point.X);
}
@ -82,7 +82,7 @@ namespace NRefactoryToBooConverter @@ -82,7 +82,7 @@ namespace NRefactoryToBooConverter
return GetLocation(node.EndLocation);
}
B.SourceLocation GetLocation(Point point)
B.SourceLocation GetLocation(Location point)
{
return new B.SourceLocation(point.Y, point.X);
}

2
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/NRefactoryDesignerLoader.cs

@ -299,7 +299,7 @@ namespace ICSharpCode.FormsDesigner @@ -299,7 +299,7 @@ namespace ICSharpCode.FormsDesigner
}
}
void FixTypeReference(TypeReference type, Point location, ICSharpCode.SharpDevelop.Dom.ICompilationUnit domCu)
void FixTypeReference(TypeReference type, Location location, ICSharpCode.SharpDevelop.Dom.ICompilationUnit domCu)
{
if (type == null)
return;

4
src/Libraries/NRefactory/Project/NRefactory.csproj

@ -49,7 +49,6 @@ @@ -49,7 +49,6 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\ICSharpCode.NRefactory.snk" />
@ -127,6 +126,7 @@ @@ -127,6 +126,7 @@
<Compile Include="..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Src\Parser\Location.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Src\Lexer\CSharp\KeywordList.txt" />
@ -137,4 +137,4 @@ @@ -137,4 +137,4 @@
<Content Include="Src\Parser\Frames\trace.txt" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>
</Project>

19
src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs

@ -8,7 +8,6 @@ @@ -8,7 +8,6 @@
using System;
using System.IO;
using System.Collections;
using System.Drawing;
using System.Diagnostics;
using System.Globalization;
using System.Text;
@ -24,10 +23,10 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -24,10 +23,10 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
void ReadPreProcessingDirective()
{
Point start = new Point(Col - 1, Line);
Location start = new Location(Col - 1, Line);
string directive = ReadIdent('#');
string argument = ReadToEOL();
this.specialTracker.AddPreProcessingDirective(directive, argument.Trim(), start, new Point(start.X + directive.Length + argument.Length, start.Y));
this.specialTracker.AddPreProcessingDirective(directive, argument.Trim(), start, new Location(start.X + directive.Length + argument.Length, start.Y));
}
protected override Token Next()
@ -727,9 +726,9 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -727,9 +726,9 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
string tag = curWord.ToString();
curWord.Length = 0;
if (specialCommentHash.ContainsKey(tag)) {
Point p = new Point(Col, Line);
Location p = new Location(Col, Line);
string comment = ch + ReadToEOL();
tagComments.Add(new TagComment(tag, comment, p, new Point(Col, Line)));
tagComments.Add(new TagComment(tag, comment, p, new Location(Col, Line)));
sb.Append(comment);
break;
}
@ -743,9 +742,9 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -743,9 +742,9 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
if (skipAllComments) {
SkipToEOL();
} else {
specialTracker.StartComment(commentType, new Point(Col, Line));
specialTracker.StartComment(commentType, new Location(Col, Line));
specialTracker.AddString(ReadCommentToEOL());
specialTracker.FinishComment(new Point(Col, Line));
specialTracker.FinishComment(new Location(Col, Line));
}
}
@ -761,7 +760,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -761,7 +760,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
}
}
} else {
specialTracker.StartComment(CommentType.Block, new Point(Col, Line));
specialTracker.StartComment(CommentType.Block, new Location(Col, Line));
while ((nextChar = ReaderRead()) != -1) {
char ch = (char)nextChar;
@ -773,12 +772,12 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -773,12 +772,12 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
// End of multiline comment reached ?
if (ch == '*' && ReaderPeek() == '/') {
ReaderRead();
specialTracker.FinishComment(new Point(Col, Line));
specialTracker.FinishComment(new Location(Col, Line));
return;
}
specialTracker.AddChar(ch);
}
specialTracker.FinishComment(new Point(Col, Line));
specialTracker.FinishComment(new Location(Col, Line));
}
// Reached EOF before end of multiline comment.
errors.Error(Line, Col, String.Format("Reached EOF before the end of a multiline comment"));

1
src/Libraries/NRefactory/Project/Src/Lexer/LookupTable.cs

@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
using System;
using System.Collections;
using System.Drawing;
using System.Globalization;
namespace ICSharpCode.NRefactory.Parser

3
src/Libraries/NRefactory/Project/Src/Lexer/Special/BlankLine.cs

@ -6,13 +6,12 @@ @@ -6,13 +6,12 @@
// </file>
using System;
using System.Drawing;
namespace ICSharpCode.NRefactory.Parser
{
public class BlankLine : AbstractSpecial
{
public BlankLine(Point point) : base(point)
public BlankLine(Location point) : base(point)
{
}

3
src/Libraries/NRefactory/Project/Src/Lexer/Special/Comment.cs

@ -9,7 +9,6 @@ using System; @@ -9,7 +9,6 @@ using System;
using System.Text;
using System.CodeDom;
using System.Collections;
using System.Drawing;
namespace ICSharpCode.NRefactory.Parser
{
@ -36,7 +35,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -36,7 +35,7 @@ namespace ICSharpCode.NRefactory.Parser
}
}
public Comment(CommentType commentType, string comment, Point startPosition, Point endPosition)
public Comment(CommentType commentType, string comment, Location startPosition, Location endPosition)
: base(startPosition, endPosition)
{
this.commentType = commentType;

15
src/Libraries/NRefactory/Project/Src/Lexer/Special/ISpecial.cs

@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
// </file>
using System;
using System.Drawing;
namespace ICSharpCode.NRefactory.Parser
{
@ -15,8 +14,8 @@ namespace ICSharpCode.NRefactory.Parser @@ -15,8 +14,8 @@ namespace ICSharpCode.NRefactory.Parser
/// </summary>
public interface ISpecial
{
Point StartPosition { get; }
Point EndPosition { get; }
Location StartPosition { get; }
Location EndPosition { get; }
object AcceptVisitor(ISpecialVisitor visitor, object data);
}
@ -33,21 +32,21 @@ namespace ICSharpCode.NRefactory.Parser @@ -33,21 +32,21 @@ namespace ICSharpCode.NRefactory.Parser
{
public abstract object AcceptVisitor(ISpecialVisitor visitor, object data);
Point startPosition, endPosition;
Location startPosition, endPosition;
public AbstractSpecial(Point position)
public AbstractSpecial(Location position)
{
this.startPosition = position;
this.endPosition = position;
}
public AbstractSpecial(Point startPosition, Point endPosition)
public AbstractSpecial(Location startPosition, Location endPosition)
{
this.startPosition = startPosition;
this.endPosition = endPosition;
}
public Point StartPosition {
public Location StartPosition {
get {
return startPosition;
}
@ -56,7 +55,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -56,7 +55,7 @@ namespace ICSharpCode.NRefactory.Parser
}
}
public Point EndPosition {
public Location EndPosition {
get {
return endPosition;
}

3
src/Libraries/NRefactory/Project/Src/Lexer/Special/PreProcessingDirective.cs

@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
// </file>
using System;
using System.Drawing;
using System.Collections.Generic;
using System.Globalization;
@ -108,7 +107,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -108,7 +107,7 @@ namespace ICSharpCode.NRefactory.Parser
Arg);
}
public PreProcessingDirective(string cmd, string arg, Point start, Point end)
public PreProcessingDirective(string cmd, string arg, Location start, Location end)
: base(start, end)
{
this.cmd = cmd;

11
src/Libraries/NRefactory/Project/Src/Lexer/Special/SpecialTracker.cs

@ -9,7 +9,6 @@ using System; @@ -9,7 +9,6 @@ using System;
using System.Text;
using System.CodeDom;
using System.Collections.Generic;
using System.Drawing;
namespace ICSharpCode.NRefactory.Parser
{
@ -19,7 +18,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -19,7 +18,7 @@ namespace ICSharpCode.NRefactory.Parser
CommentType currentCommentType;
StringBuilder sb = new StringBuilder();
Point startPosition;
Location startPosition;
public List<ISpecial> CurrentSpecials {
get {
@ -42,18 +41,18 @@ namespace ICSharpCode.NRefactory.Parser @@ -42,18 +41,18 @@ namespace ICSharpCode.NRefactory.Parser
return tmp;
}
public void AddEndOfLine(Point point)
public void AddEndOfLine(Location point)
{
currentSpecials.Add(new BlankLine(point));
}
public void AddPreProcessingDirective(string cmd, string arg, Point start, Point end)
public void AddPreProcessingDirective(string cmd, string arg, Location start, Location end)
{
currentSpecials.Add(new PreProcessingDirective(cmd, arg, start, end));
}
// used for comment tracking
public void StartComment(CommentType commentType, Point startPosition)
public void StartComment(CommentType commentType, Location startPosition)
{
this.currentCommentType = commentType;
this.startPosition = startPosition;
@ -70,7 +69,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -70,7 +69,7 @@ namespace ICSharpCode.NRefactory.Parser
sb.Append(s);
}
public void FinishComment(Point endPosition)
public void FinishComment(Location endPosition)
{
currentSpecials.Add(new Comment(currentCommentType, sb.ToString(), startPosition, endPosition));
}

3
src/Libraries/NRefactory/Project/Src/Lexer/Special/TagComment.cs

@ -9,7 +9,6 @@ using System; @@ -9,7 +9,6 @@ using System;
using System.Text;
using System.CodeDom;
using System.Collections;
using System.Drawing;
namespace ICSharpCode.NRefactory.Parser
{
@ -29,7 +28,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -29,7 +28,7 @@ namespace ICSharpCode.NRefactory.Parser
}
}
public TagComment(string tag, string comment, Point startPosition, Point endPosition) : base(CommentType.SingleLine, comment, startPosition, endPosition)
public TagComment(string tag, string comment, Location startPosition, Location endPosition) : base(CommentType.SingleLine, comment, startPosition, endPosition)
{
this.tag = tag;
}

9
src/Libraries/NRefactory/Project/Src/Lexer/Token.cs

@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
// </file>
using System;
using System.Drawing;
namespace ICSharpCode.NRefactory.Parser
{
@ -21,14 +20,14 @@ namespace ICSharpCode.NRefactory.Parser @@ -21,14 +20,14 @@ namespace ICSharpCode.NRefactory.Parser
public string val;
public Token next;
public Point EndLocation {
public Location EndLocation {
get {
return new Point(val == null ? col + 1 : col + val.Length, line);
return new Location(val == null ? col + 1 : col + val.Length, line);
}
}
public Point Location {
public Location Location {
get {
return new Point(col, line);
return new Location(col, line);
}
}

13
src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs

@ -8,7 +8,6 @@ @@ -8,7 +8,6 @@
using System;
using System.IO;
using System.Collections;
using System.Drawing;
using System.Diagnostics;
using System.Globalization;
using System.Text;
@ -469,10 +468,10 @@ namespace ICSharpCode.NRefactory.Parser.VB @@ -469,10 +468,10 @@ namespace ICSharpCode.NRefactory.Parser.VB
void ReadPreprocessorDirective()
{
Point start = new Point(Col - 1, Line);
Location start = new Location(Col - 1, Line);
string directive = ReadIdent('#');
string argument = ReadToEOL();
this.specialTracker.AddPreProcessingDirective(directive, argument.Trim(), start, new Point(start.X + directive.Length + argument.Length, start.Y));
this.specialTracker.AddPreProcessingDirective(directive, argument.Trim(), start, new Location(start.X + directive.Length + argument.Length, start.Y));
}
string ReadDate()
@ -524,7 +523,7 @@ namespace ICSharpCode.NRefactory.Parser.VB @@ -524,7 +523,7 @@ namespace ICSharpCode.NRefactory.Parser.VB
void ReadComment()
{
Point startPos = new Point(Col, Line);
Location startPos = new Location(Col, Line);
sb.Length = 0;
StringBuilder curWord = specialCommentHash != null ? new StringBuilder() : null;
int missingApostrophes = 2; // no. of ' missing until it is a documentation comment
@ -559,9 +558,9 @@ namespace ICSharpCode.NRefactory.Parser.VB @@ -559,9 +558,9 @@ namespace ICSharpCode.NRefactory.Parser.VB
string tag = curWord.ToString();
curWord.Length = 0;
if (specialCommentHash.ContainsKey(tag)) {
Point p = new Point(Col, Line);
Location p = new Location(Col, Line);
string comment = ch + ReadToEOL();
tagComments.Add(new TagComment(tag, comment, p, new Point(Col, Line)));
tagComments.Add(new TagComment(tag, comment, p, new Location(Col, Line)));
sb.Append(comment);
break;
}
@ -572,7 +571,7 @@ namespace ICSharpCode.NRefactory.Parser.VB @@ -572,7 +571,7 @@ namespace ICSharpCode.NRefactory.Parser.VB
specialTracker.StartComment(CommentType.SingleLine, startPos);
}
specialTracker.AddString(sb.ToString());
specialTracker.FinishComment(new Point(Col, Line));
specialTracker.FinishComment(new Location(Col, Line));
}
Token ReadOperator(char ch)

5
src/Libraries/NRefactory/Project/Src/Output/SpecialNodesInserter.cs

@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
// </file>
using System;
using System.Drawing;
using System.Collections.Generic;
using ICSharpCode.NRefactory.Parser;
using ICSharpCode.NRefactory.Parser.AST;
@ -94,10 +93,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -94,10 +93,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
/// <summary>
/// Writes all specials up to the specified location.
/// </summary>
public void AcceptPoint(Point a)
public void AcceptPoint(Location a)
{
while (available) {
Point b = enumerator.Current.StartPosition;
Location b = enumerator.Current.StartPosition;
if (b.Y < a.Y || (b.Y == a.Y && b.X <= a.X)) {
WriteCurrent();
} else {

9
src/Libraries/NRefactory/Project/Src/Parser/AST/AbstractNode.cs

@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
using System;
using System.Text;
using System.Drawing;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
@ -19,8 +18,8 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -19,8 +18,8 @@ namespace ICSharpCode.NRefactory.Parser.AST
INode parent;
List<INode> children = new List<INode>();
Point startLocation;
Point endLocation;
Location startLocation;
Location endLocation;
public INode Parent {
get {
@ -31,7 +30,7 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -31,7 +30,7 @@ namespace ICSharpCode.NRefactory.Parser.AST
}
}
public Point StartLocation {
public Location StartLocation {
get {
return startLocation;
}
@ -40,7 +39,7 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -40,7 +39,7 @@ namespace ICSharpCode.NRefactory.Parser.AST
}
}
public Point EndLocation {
public Location EndLocation {
get {
return endLocation;
}

51
src/Libraries/NRefactory/Project/Src/Parser/AST/Generated.cs

@ -12,7 +12,6 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -12,7 +12,6 @@ namespace ICSharpCode.NRefactory.Parser.AST {
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
public class AddHandlerStatement : Statement {
@ -1459,9 +1458,9 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -1459,9 +1458,9 @@ namespace ICSharpCode.NRefactory.Parser.AST {
EventRaiseRegion raiseRegion;
Point bodyStart;
Location bodyStart;
Point bodyEnd;
Location bodyEnd;
public TypeReference TypeReference {
get {
@ -1508,7 +1507,7 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -1508,7 +1507,7 @@ namespace ICSharpCode.NRefactory.Parser.AST {
}
}
public Point BodyStart {
public Location BodyStart {
get {
return bodyStart;
}
@ -1517,7 +1516,7 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -1517,7 +1516,7 @@ namespace ICSharpCode.NRefactory.Parser.AST {
}
}
public Point BodyEnd {
public Location BodyEnd {
get {
return bodyEnd;
}
@ -1533,8 +1532,8 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -1533,8 +1532,8 @@ namespace ICSharpCode.NRefactory.Parser.AST {
addRegion = EventAddRegion.Null;
removeRegion = EventRemoveRegion.Null;
raiseRegion = EventRaiseRegion.Null;
bodyStart = new Point(-1, -1);
bodyEnd = new Point(-1, -1);
bodyStart = new Location(-1, -1);
bodyEnd = new Location(-1, -1);
}
public EventDeclaration(TypeReference typeReference, Modifier modifier, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes, string name, List<InterfaceImplementation> interfaceImplementations) :
@ -1544,8 +1543,8 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -1544,8 +1543,8 @@ namespace ICSharpCode.NRefactory.Parser.AST {
addRegion = EventAddRegion.Null;
removeRegion = EventRemoveRegion.Null;
raiseRegion = EventRaiseRegion.Null;
bodyStart = new Point(-1, -1);
bodyEnd = new Point(-1, -1);
bodyStart = new Location(-1, -1);
bodyEnd = new Location(-1, -1);
}
public bool HasAddRegion {
@ -2243,9 +2242,9 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -2243,9 +2242,9 @@ namespace ICSharpCode.NRefactory.Parser.AST {
TypeReference typeReference;
Point bodyStart;
Location bodyStart;
Point bodyEnd;
Location bodyEnd;
PropertyGetRegion getRegion;
@ -2278,7 +2277,7 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -2278,7 +2277,7 @@ namespace ICSharpCode.NRefactory.Parser.AST {
}
}
public Point BodyStart {
public Location BodyStart {
get {
return bodyStart;
}
@ -2287,7 +2286,7 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -2287,7 +2286,7 @@ namespace ICSharpCode.NRefactory.Parser.AST {
}
}
public Point BodyEnd {
public Location BodyEnd {
get {
return bodyEnd;
}
@ -2320,8 +2319,8 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -2320,8 +2319,8 @@ namespace ICSharpCode.NRefactory.Parser.AST {
Parameters = parameters;
interfaceImplementations = new List<InterfaceImplementation>();
typeReference = TypeReference.Null;
bodyStart = new Point(-1, -1);
bodyEnd = new Point(-1, -1);
bodyStart = new Location(-1, -1);
bodyEnd = new Location(-1, -1);
getRegion = PropertyGetRegion.Null;
setRegion = PropertySetRegion.Null;
}
@ -2332,8 +2331,8 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -2332,8 +2331,8 @@ namespace ICSharpCode.NRefactory.Parser.AST {
Parameters = parameters;
Modifier = modifier;
interfaceImplementations = new List<InterfaceImplementation>();
bodyStart = new Point(-1, -1);
bodyEnd = new Point(-1, -1);
bodyStart = new Location(-1, -1);
bodyEnd = new Location(-1, -1);
getRegion = PropertyGetRegion.Null;
setRegion = PropertySetRegion.Null;
}
@ -3058,9 +3057,9 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -3058,9 +3057,9 @@ namespace ICSharpCode.NRefactory.Parser.AST {
TypeReference typeReference;
Point bodyStart;
Location bodyStart;
Point bodyEnd;
Location bodyEnd;
PropertyGetRegion getRegion;
@ -3084,7 +3083,7 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -3084,7 +3083,7 @@ namespace ICSharpCode.NRefactory.Parser.AST {
}
}
public Point BodyStart {
public Location BodyStart {
get {
return bodyStart;
}
@ -3093,7 +3092,7 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -3093,7 +3092,7 @@ namespace ICSharpCode.NRefactory.Parser.AST {
}
}
public Point BodyEnd {
public Location BodyEnd {
get {
return bodyEnd;
}
@ -3124,8 +3123,8 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -3124,8 +3123,8 @@ namespace ICSharpCode.NRefactory.Parser.AST {
base(modifier, attributes, name, parameters) {
interfaceImplementations = new List<InterfaceImplementation>();
typeReference = TypeReference.Null;
bodyStart = new Point(-1, -1);
bodyEnd = new Point(-1, -1);
bodyStart = new Location(-1, -1);
bodyEnd = new Location(-1, -1);
getRegion = PropertyGetRegion.Null;
setRegion = PropertySetRegion.Null;
}
@ -3806,7 +3805,7 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -3806,7 +3805,7 @@ namespace ICSharpCode.NRefactory.Parser.AST {
List<TemplateDefinition> templates;
Point bodyStartLocation;
Location bodyStartLocation;
public string Name {
get {
@ -3844,7 +3843,7 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -3844,7 +3843,7 @@ namespace ICSharpCode.NRefactory.Parser.AST {
}
}
public Point BodyStartLocation {
public Location BodyStartLocation {
get {
return bodyStartLocation;
}
@ -3859,7 +3858,7 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -3859,7 +3858,7 @@ namespace ICSharpCode.NRefactory.Parser.AST {
name = "";
baseTypes = new List<TypeReference>();
templates = new List<TemplateDefinition>();
bodyStartLocation = new Point(-1, -1);
bodyStartLocation = new Location(-1, -1);
}
public override object AcceptVisitor(IAstVisitor visitor, object data) {

5
src/Libraries/NRefactory/Project/Src/Parser/AST/INode.cs

@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
// </file>
using System;
using System.Drawing;
using System.Collections.Generic;
namespace ICSharpCode.NRefactory.Parser.AST
@ -22,12 +21,12 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -22,12 +21,12 @@ namespace ICSharpCode.NRefactory.Parser.AST
get;
}
Point StartLocation {
Location StartLocation {
get;
set;
}
Point EndLocation {
Location EndLocation {
get;
set;
}

2113
src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs

File diff suppressed because it is too large Load Diff

3
src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG

@ -1,4 +1,3 @@ @@ -1,4 +1,3 @@
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
@ -1093,7 +1092,7 @@ FixedParameter<out ParameterDeclarationExpression p> @@ -1093,7 +1092,7 @@ FixedParameter<out ParameterDeclarationExpression p>
(.
TypeReference type;
ParamModifier mod = ParamModifier.In;
System.Drawing.Point start = t.Location;
Location start = t.Location;
.)
=
[

51
src/Libraries/NRefactory/Project/Src/Parser/Location.cs

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 15.07.2006
* Time: 19:49
*/
using System;
namespace ICSharpCode.NRefactory.Parser
{
/// <summary>
/// Description of Position.
/// </summary>
public struct Location
{
public static readonly Location Empty = new Location(0, 0);
public Location(int column, int line)
{
x = column;
y = line;
}
int x, y;
public int X {
get {
return x;
}
set {
x = value;
}
}
public int Y {
get {
return y;
}
set {
y = value;
}
}
public bool IsEmpty {
get {
return x <= 0 && y <= 0;
}
}
}
}

9
src/Libraries/NRefactory/Project/Src/Parser/Modifiers.cs

@ -6,14 +6,13 @@ @@ -6,14 +6,13 @@
// </file>
using ICSharpCode.NRefactory.Parser.AST;
using System.Drawing;
namespace ICSharpCode.NRefactory.Parser
{
internal class Modifiers
{
Modifier cur;
Point location = new Point(-1, -1);
Location location = new Location(-1, -1);
public Modifier Modifier {
get {
@ -21,7 +20,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -21,7 +20,7 @@ namespace ICSharpCode.NRefactory.Parser
}
}
public Point GetDeclarationLocation(Point keywordLocation)
public Location GetDeclarationLocation(Location keywordLocation)
{
if(location.X == -1 && location.Y == -1) {
return keywordLocation;
@ -29,7 +28,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -29,7 +28,7 @@ namespace ICSharpCode.NRefactory.Parser
return location;
}
public Point Location {
public Location Location {
get {
return location;
}
@ -45,7 +44,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -45,7 +44,7 @@ namespace ICSharpCode.NRefactory.Parser
return ((cur & m) != 0);
}
public void Add(Modifier m, Point tokenLocation)
public void Add(Modifier m, Location tokenLocation)
{
if(location.X == -1 && location.Y == -1) {
location = tokenLocation;

2141
src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs

File diff suppressed because it is too large Load Diff

1
src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG

@ -1,4 +1,3 @@ @@ -1,4 +1,3 @@
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;

15
src/Libraries/NRefactory/Project/Src/Parser/Visitors/LookupTableVisitor.cs

@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
// </file>
using System;
using System.Drawing;
using System.Collections.Generic;
using ICSharpCode.NRefactory.Parser.AST;
@ -16,8 +15,8 @@ namespace ICSharpCode.NRefactory.Parser @@ -16,8 +15,8 @@ namespace ICSharpCode.NRefactory.Parser
public class LocalLookupVariable
{
TypeReference typeRef;
Point startPos;
Point endPos;
Location startPos;
Location endPos;
bool isConst;
public TypeReference TypeRef {
@ -25,12 +24,12 @@ namespace ICSharpCode.NRefactory.Parser @@ -25,12 +24,12 @@ namespace ICSharpCode.NRefactory.Parser
return typeRef;
}
}
public Point StartPos {
public Location StartPos {
get {
return startPos;
}
}
public Point EndPos {
public Location EndPos {
get {
return endPos;
}
@ -42,7 +41,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -42,7 +41,7 @@ namespace ICSharpCode.NRefactory.Parser
}
}
public LocalLookupVariable(TypeReference typeRef, Point startPos, Point endPos, bool isConst)
public LocalLookupVariable(TypeReference typeRef, Location startPos, Location endPos, bool isConst)
{
this.typeRef = typeRef;
this.startPos = startPos;
@ -74,7 +73,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -74,7 +73,7 @@ namespace ICSharpCode.NRefactory.Parser
variables = new Dictionary<string, List<LocalLookupVariable>>(nameComparer);
}
public void AddVariable(TypeReference typeRef, string name, Point startPos, Point endPos, bool isConst)
public void AddVariable(TypeReference typeRef, string name, Location startPos, Location endPos, bool isConst)
{
if (name == null || name.Length == 0) {
return;
@ -112,7 +111,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -112,7 +111,7 @@ namespace ICSharpCode.NRefactory.Parser
AddVariable(localVariableDeclaration.GetTypeForVariable(i),
varDecl.Name,
localVariableDeclaration.StartLocation,
(blockStack.Count == 0) ? new Point(-1, -1) : blockStack.Peek().EndLocation,
(blockStack.Count == 0) ? new Location(-1, -1) : blockStack.Peek().EndLocation,
(localVariableDeclaration.Modifier & Modifier.Const) == Modifier.Const);
}
return base.Visit(localVariableDeclaration, data);

13
src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs

@ -8,7 +8,6 @@ @@ -8,7 +8,6 @@
// created on 04.08.2003 at 17:49
using System;
using System.Text;
using System.Drawing;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
@ -271,7 +270,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -271,7 +270,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
}
}
DomRegion GetRegion(Point start, Point end)
static DomRegion GetRegion(RefParser.Location start, RefParser.Location end)
{
return new DomRegion(start, end);
}
@ -420,7 +419,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -420,7 +419,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
internal static IParameter CreateParameter(AST.ParameterDeclarationExpression par, IMethod method, IClass currentClass, ICompilationUnit cu)
{
IReturnType parType = CreateReturnType(par.TypeReference, method, currentClass, cu);
DefaultParameter p = new DefaultParameter(par.ParameterName, parType, new DomRegion(par.StartLocation, par.EndLocation));
DefaultParameter p = new DefaultParameter(par.ParameterName, parType, GetRegion(par.StartLocation, par.EndLocation));
p.Modifiers = (ParameterModifiers)par.ParamModifier;
return p;
}
@ -428,7 +427,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -428,7 +427,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public override object Visit(AST.MethodDeclaration methodDeclaration, object data)
{
DomRegion region = GetRegion(methodDeclaration.StartLocation, methodDeclaration.EndLocation);
DomRegion bodyRegion = GetRegion(methodDeclaration.EndLocation, methodDeclaration.Body != null ? methodDeclaration.Body.EndLocation : new Point(-1, -1));
DomRegion bodyRegion = GetRegion(methodDeclaration.EndLocation, methodDeclaration.Body != null ? methodDeclaration.Body.EndLocation : RefParser.Location.Empty);
DefaultClass c = GetCurrentClass();
DefaultMethod method = new DefaultMethod(methodDeclaration.Name, null, ConvertModifier(methodDeclaration.Modifier), region, bodyRegion, GetCurrentClass());
@ -451,7 +450,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -451,7 +450,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{
DefaultClass c = GetCurrentClass();
DomRegion region = GetRegion(operatorDeclaration.StartLocation, operatorDeclaration.EndLocation);
DomRegion bodyRegion = GetRegion(operatorDeclaration.EndLocation, operatorDeclaration.Body != null ? operatorDeclaration.Body.EndLocation : new Point(-1, -1));
DomRegion bodyRegion = GetRegion(operatorDeclaration.EndLocation, operatorDeclaration.Body != null ? operatorDeclaration.Body.EndLocation : RefParser.Location.Empty);
DefaultMethod method = new DefaultMethod(operatorDeclaration.Name, CreateReturnType(operatorDeclaration.TypeReference), ConvertModifier(operatorDeclaration.Modifier), region, bodyRegion, c);
ConvertAttributes(operatorDeclaration, method);
@ -468,7 +467,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -468,7 +467,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public override object Visit(AST.ConstructorDeclaration constructorDeclaration, object data)
{
DomRegion region = GetRegion(constructorDeclaration.StartLocation, constructorDeclaration.EndLocation);
DomRegion bodyRegion = GetRegion(constructorDeclaration.EndLocation, constructorDeclaration.Body != null ? constructorDeclaration.Body.EndLocation : new Point(-1, -1));
DomRegion bodyRegion = GetRegion(constructorDeclaration.EndLocation, constructorDeclaration.Body != null ? constructorDeclaration.Body.EndLocation : RefParser.Location.Empty);
DefaultClass c = GetCurrentClass();
Constructor constructor = new Constructor(ConvertModifier(constructorDeclaration.Modifier), region, bodyRegion, GetCurrentClass());
@ -486,7 +485,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -486,7 +485,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public override object Visit(AST.DestructorDeclaration destructorDeclaration, object data)
{
DomRegion region = GetRegion(destructorDeclaration.StartLocation, destructorDeclaration.EndLocation);
DomRegion bodyRegion = GetRegion(destructorDeclaration.EndLocation, destructorDeclaration.Body != null ? destructorDeclaration.Body.EndLocation : new Point(-1, -1));
DomRegion bodyRegion = GetRegion(destructorDeclaration.EndLocation, destructorDeclaration.Body != null ? destructorDeclaration.Body.EndLocation : RefParser.Location.Empty);
DefaultClass c = GetCurrentClass();

9
src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs

@ -8,7 +8,6 @@ @@ -8,7 +8,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.Parser;
@ -213,7 +212,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -213,7 +212,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
WithStatement innermost = null;
if (lookupTableVisitor.WithStatements != null) {
foreach (WithStatement with in lookupTableVisitor.WithStatements) {
if (IsInside(new Point(caretColumn, caretLine), with.StartLocation, with.EndLocation)) {
if (IsInside(new Location(caretColumn, caretLine), with.StartLocation, with.EndLocation)) {
innermost = with;
}
}
@ -721,7 +720,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -721,7 +720,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
return languageProperties.NameComparer.Equals(name1, name2);
}
bool IsInside(Point between, Point start, Point end)
bool IsInside(Location between, Location start, Location end)
{
if (between.Y < start.Y || between.Y > end.Y) {
return false;
@ -940,7 +939,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -940,7 +939,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
}
foreach (LocalLookupVariable v in variables) {
if (IsInside(new Point(caretColumn, caretLine), v.StartPos, v.EndPos)) {
if (IsInside(new Location(caretColumn, caretLine), v.StartPos, v.EndPos)) {
return v;
}
}
@ -1012,7 +1011,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -1012,7 +1011,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
foreach (KeyValuePair<string, List<LocalLookupVariable>> pair in lookupTableVisitor.Variables) {
if (pair.Value != null && pair.Value.Count > 0) {
foreach (LocalLookupVariable v in pair.Value) {
if (IsInside(new Point(caretColumn, caretLine), v.StartPos, v.EndPos)) {
if (IsInside(new Location(caretColumn, caretLine), v.StartPos, v.EndPos)) {
// convert to a field for display
result.Add(CreateLocalVariableField(v, pair.Key));
break;

11
src/Main/Base/Project/Src/Dom/Region.cs

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
// </file>
using System;
using System.Drawing;
using Location = ICSharpCode.NRefactory.Parser.Location;
namespace ICSharpCode.SharpDevelop.Dom
{
@ -50,7 +50,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -50,7 +50,7 @@ namespace ICSharpCode.SharpDevelop.Dom
/// <value>
/// if the end column is == -1 the end line is -1 too
/// this stands for an unknwon end
/// this stands for an unknown end
/// </value>
public int EndColumn {
get {
@ -58,16 +58,11 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -58,16 +58,11 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
public DomRegion(Point start, Point end)
public DomRegion(Location start, Location end)
: this(start.Y, start.X, end.Y, end.X)
{
}
public DomRegion(Point start)
: this(start.Y, start.X)
{
}
public DomRegion(int beginLine, int beginColumn, int endLine, int endColumn)
{
this.beginLine = beginLine;

Loading…
Cancel
Save