Browse Source

Adjust ILSpy to NRefactory changes.

pull/205/merge
Daniel Grunwald 14 years ago
parent
commit
81bb822fdb
  1. 4
      Debugger/Debugger.Core/Debugger.Core.csproj
  2. 2
      Debugger/Debugger.Core/NRefactory/Ast/ExpressionExtensionMethods.cs
  3. 11
      Debugger/Debugger.Core/NRefactory/Visitors/ExpressionEvaluator.cs
  4. 8
      Debugger/ILSpy.Debugger/ILSpy.Debugger.csproj
  5. 2
      Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs
  6. 4
      Debugger/ILSpy.Debugger/ToolTips/DebuggerPopup.cs
  7. 12
      Debugger/ILSpy.Debugger/ToolTips/DebuggerTooltipControl.xaml.cs
  8. 4
      Debugger/ILSpy.Debugger/ToolTips/TextEditorListener.cs
  9. 3
      ICSharpCode.Decompiler/Ast/AstBuilder.cs
  10. 2
      ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs
  11. 16
      ICSharpCode.Decompiler/Ast/CecilTypeResolveContext.cs
  12. 5
      ICSharpCode.Decompiler/Ast/Transforms/PatternStatementTransform.cs
  13. 4
      ICSharpCode.Decompiler/Disassembler/DisassemblerHelpers.cs
  14. 12
      ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs
  15. 4
      ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
  16. 4
      ICSharpCode.Decompiler/Tests/ICSharpCode.Decompiler.Tests.csproj
  17. 4
      ILSpy.SharpDevelop.LGPL/AvalonEdit/IconBarMargin.cs
  18. 8
      ILSpy.SharpDevelop.LGPL/Bookmarks/BookmarkBase.cs
  19. 5
      ILSpy.SharpDevelop.LGPL/Bookmarks/BookmarkManager.cs
  20. 3
      ILSpy.SharpDevelop.LGPL/Bookmarks/BreakpointBookmark.cs
  21. 5
      ILSpy.SharpDevelop.LGPL/Bookmarks/CurrentLineBookmark.cs
  22. 3
      ILSpy.SharpDevelop.LGPL/Bookmarks/MarkerBookmark.cs
  23. 4
      ILSpy.SharpDevelop.LGPL/ILSpy.SharpDevelop.LGPL.csproj
  24. 3
      ILSpy.SharpDevelop.LGPL/Models/ToolTipRequestEventArgs.cs
  25. 1
      ILSpy.SharpDevelop.LGPL/Services/DebuggerService.cs
  26. 3
      ILSpy.SharpDevelop.LGPL/Services/IDebugger.cs
  27. 16
      ILSpy.sln
  28. 2
      ILSpy/Bookmarks/MemberBookmark.cs
  29. 4
      ILSpy/ILSpy.csproj
  30. 2
      ILSpy/Languages/CSharpLanguage.cs
  31. 19
      ILSpy/VB/ILSpyEnvironmentProvider.cs
  32. 4
      NRefactory/ICSharpCode.NRefactory.VB/Visitors/CSharpToVBConverterVisitor.cs
  33. 4
      TestPlugin/TestPlugin.csproj

4
Debugger/Debugger.Core/Debugger.Core.csproj

@ -210,6 +210,10 @@
<Folder Include="Tests" /> <Folder Include="Tests" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\NRefactory\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory.CSharp.csproj">
<Project>{53DCA265-3C3C-42F9-B647-F72BA678122B}</Project>
<Name>ICSharpCode.NRefactory.CSharp</Name>
</ProjectReference>
<ProjectReference Include="..\..\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj"> <ProjectReference Include="..\..\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project> <Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
<Name>ICSharpCode.NRefactory</Name> <Name>ICSharpCode.NRefactory</Name>

2
Debugger/Debugger.Core/NRefactory/Ast/ExpressionExtensionMethods.cs

@ -159,7 +159,7 @@ namespace ICSharpCode.NRefactory.Ast
using (var sw = new StringWriter()) using (var sw = new StringWriter())
{ {
OutputVisitor csOutVisitor = new OutputVisitor(sw, new CSharpFormattingOptions()); CSharpOutputVisitor csOutVisitor = new CSharpOutputVisitor(sw, new CSharpFormattingOptions());
code.AcceptVisitor(csOutVisitor, null); code.AcceptVisitor(csOutVisitor, null);
return sw.ToString(); return sw.ToString();
} }

11
Debugger/Debugger.Core/NRefactory/Visitors/ExpressionEvaluator.cs

@ -22,6 +22,10 @@ namespace ICSharpCode.NRefactory.Visitors
public EvaluateException(AstNode code, string msgFmt, params string[] msgArgs):base(code, string.Format(msgFmt, msgArgs)) {} public EvaluateException(AstNode code, string msgFmt, params string[] msgArgs):base(code, string.Format(msgFmt, msgArgs)) {}
} }
public enum SupportedLanguage {
CSharp
}
class TypedValue class TypedValue
{ {
Value value; Value value;
@ -46,7 +50,7 @@ namespace ICSharpCode.NRefactory.Visitors
} }
} }
public class ExpressionEvaluator : NotImplementedAstVisitor<object, object> public class ExpressionEvaluator : DepthFirstAstVisitor<object, object>
{ {
StackFrame context; StackFrame context;
@ -59,6 +63,11 @@ namespace ICSharpCode.NRefactory.Visitors
this.context = context; this.context = context;
} }
protected override object VisitChildren(AstNode node, object data)
{
throw new NotImplementedException();
}
public static AstNode Parse(string code, SupportedLanguage language) public static AstNode Parse(string code, SupportedLanguage language)
{ {
switch (language) { switch (language) {

8
Debugger/ILSpy.Debugger/ILSpy.Debugger.csproj

@ -105,11 +105,11 @@
<DependentUpon>AttachToProcessWindow.xaml</DependentUpon> <DependentUpon>AttachToProcessWindow.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="UI\BreakpointPanel.xaml.cs" > <Compile Include="UI\BreakpointPanel.xaml.cs">
<DependentUpon>BreakpointPanel.xaml</DependentUpon> <DependentUpon>BreakpointPanel.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="UI\CallStackPanel.xaml.cs" > <Compile Include="UI\CallStackPanel.xaml.cs">
<DependentUpon>CallStackPanel.xaml</DependentUpon> <DependentUpon>CallStackPanel.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
@ -159,6 +159,10 @@
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project> <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
<Name>Mono.Cecil</Name> <Name>Mono.Cecil</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\NRefactory\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory.CSharp.csproj">
<Project>{53DCA265-3C3C-42F9-B647-F72BA678122B}</Project>
<Name>ICSharpCode.NRefactory.CSharp</Name>
</ProjectReference>
<ProjectReference Include="..\..\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj"> <ProjectReference Include="..\..\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project> <Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
<Name>ICSharpCode.NRefactory</Name> <Name>ICSharpCode.NRefactory</Name>

2
Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs

@ -444,7 +444,7 @@ namespace ICSharpCode.ILSpy.Debugger.Services
/// Gets the tooltip control that shows the value of given variable. /// Gets the tooltip control that shows the value of given variable.
/// Return null if no tooltip is available. /// Return null if no tooltip is available.
/// </summary> /// </summary>
public object GetTooltipControl(AstLocation logicalPosition, string variableName) public object GetTooltipControl(TextLocation logicalPosition, string variableName)
{ {
try { try {
var tooltipExpression = GetExpression(variableName); var tooltipExpression = GetExpression(variableName);

4
Debugger/ILSpy.Debugger/ToolTips/DebuggerPopup.cs

@ -4,7 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.ILSpy.Debugger.Models.TreeModel; using ICSharpCode.ILSpy.Debugger.Models.TreeModel;
@ -17,7 +17,7 @@ namespace ICSharpCode.ILSpy.Debugger.Tooltips
{ {
internal DebuggerTooltipControl contentControl; internal DebuggerTooltipControl contentControl;
public DebuggerPopup(DebuggerTooltipControl parentControl, AstLocation logicalPosition, bool showPins = true) public DebuggerPopup(DebuggerTooltipControl parentControl, TextLocation logicalPosition, bool showPins = true)
{ {
this.contentControl = new DebuggerTooltipControl(parentControl, logicalPosition, showPins); this.contentControl = new DebuggerTooltipControl(parentControl, logicalPosition, showPins);
this.contentControl.containingPopup = this; this.contentControl.containingPopup = this;

12
Debugger/ILSpy.Debugger/ToolTips/DebuggerTooltipControl.xaml.cs

@ -12,7 +12,7 @@ using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using System.Windows.Shapes; using System.Windows.Shapes;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.ILSpy.AvalonEdit; using ICSharpCode.ILSpy.AvalonEdit;
using ICSharpCode.ILSpy.Debugger.Models.TreeModel; using ICSharpCode.ILSpy.Debugger.Models.TreeModel;
@ -33,9 +33,9 @@ namespace ICSharpCode.ILSpy.Debugger.Tooltips
private bool showPins; private bool showPins;
private LazyItemsControl<ITreeNode> lazyGrid; private LazyItemsControl<ITreeNode> lazyGrid;
private IEnumerable<ITreeNode> itemsSource; private IEnumerable<ITreeNode> itemsSource;
readonly AstLocation logicalPosition; readonly TextLocation logicalPosition;
public DebuggerTooltipControl(AstLocation logicalPosition) public DebuggerTooltipControl(TextLocation logicalPosition)
{ {
this.logicalPosition = logicalPosition; this.logicalPosition = logicalPosition;
InitializeComponent(); InitializeComponent();
@ -43,19 +43,19 @@ namespace ICSharpCode.ILSpy.Debugger.Tooltips
Loaded += new RoutedEventHandler(OnLoaded); Loaded += new RoutedEventHandler(OnLoaded);
} }
public DebuggerTooltipControl(AstLocation logicalPosition, ITreeNode node) public DebuggerTooltipControl(TextLocation logicalPosition, ITreeNode node)
: this(logicalPosition, new ITreeNode[] { node }) : this(logicalPosition, new ITreeNode[] { node })
{ {
} }
public DebuggerTooltipControl(AstLocation logicalPosition, IEnumerable<ITreeNode> nodes) public DebuggerTooltipControl(TextLocation logicalPosition, IEnumerable<ITreeNode> nodes)
: this(logicalPosition) : this(logicalPosition)
{ {
this.itemsSource = nodes; this.itemsSource = nodes;
} }
public DebuggerTooltipControl(DebuggerTooltipControl parentControl, AstLocation logicalPosition, bool showPins = false) public DebuggerTooltipControl(DebuggerTooltipControl parentControl, TextLocation logicalPosition, bool showPins = false)
: this(logicalPosition) : this(logicalPosition)
{ {
this.parentControl = parentControl; this.parentControl = parentControl;

4
Debugger/ILSpy.Debugger/ToolTips/TextEditorListener.cs

@ -8,9 +8,9 @@ using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
using System.Windows.Input; using System.Windows.Input;
using ICSharpCode.AvalonEdit; using ICSharpCode.AvalonEdit;
using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.ILSpy.AvalonEdit; using ICSharpCode.ILSpy.AvalonEdit;
using ICSharpCode.ILSpy.Debugger.Services; using ICSharpCode.ILSpy.Debugger.Services;
@ -62,7 +62,7 @@ namespace ICSharpCode.ILSpy.Debugger.Tooltips
args.InDocument = pos.HasValue; args.InDocument = pos.HasValue;
if (pos.HasValue) { if (pos.HasValue) {
args.LogicalPosition = new AstLocation(pos.Value.Line, pos.Value.Column); args.LogicalPosition = new TextLocation(pos.Value.Line, pos.Value.Column);
} else { } else {
return; return;
} }

3
ICSharpCode.Decompiler/Ast/AstBuilder.cs

@ -38,7 +38,6 @@ using Mono.Cecil.Cil;
namespace ICSharpCode.Decompiler.Ast namespace ICSharpCode.Decompiler.Ast
{ {
using Ast = ICSharpCode.NRefactory.CSharp; using Ast = ICSharpCode.NRefactory.CSharp;
using ClassType = ICSharpCode.NRefactory.TypeSystem.ClassType;
using VarianceModifier = ICSharpCode.NRefactory.TypeSystem.VarianceModifier; using VarianceModifier = ICSharpCode.NRefactory.TypeSystem.VarianceModifier;
[Flags] [Flags]
@ -141,7 +140,7 @@ namespace ICSharpCode.Decompiler.Ast
formattingPolicy.SpaceBeforeMethodDeclarationParentheses = false; formattingPolicy.SpaceBeforeMethodDeclarationParentheses = false;
formattingPolicy.SpaceBeforeConstructorDeclarationParentheses = false; formattingPolicy.SpaceBeforeConstructorDeclarationParentheses = false;
formattingPolicy.SpaceBeforeDelegateDeclarationParentheses = false; formattingPolicy.SpaceBeforeDelegateDeclarationParentheses = false;
astCompileUnit.AcceptVisitor(new OutputVisitor(outputFormatter, formattingPolicy), null); astCompileUnit.AcceptVisitor(new CSharpOutputVisitor(outputFormatter, formattingPolicy), null);
} }
public void AddAssembly(AssemblyDefinition assemblyDefinition, bool onlyAssemblyLevel = false) public void AddAssembly(AssemblyDefinition assemblyDefinition, bool onlyAssemblyLevel = false)

2
ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

@ -754,7 +754,7 @@ namespace ICSharpCode.Decompiler.Ast
case ILCode.YieldBreak: case ILCode.YieldBreak:
return new Ast.YieldBreakStatement(); return new Ast.YieldBreakStatement();
case ILCode.YieldReturn: case ILCode.YieldReturn:
return new Ast.YieldStatement { Expression = arg1 }; return new Ast.YieldReturnStatement { Expression = arg1 };
case ILCode.InitObject: case ILCode.InitObject:
case ILCode.InitCollection: case ILCode.InitCollection:
{ {

16
ICSharpCode.Decompiler/Ast/CecilTypeResolveContext.cs

@ -90,6 +90,12 @@ namespace ICSharpCode.Decompiler.Ast
countUntilNextCleanup = dict.Count + 4; countUntilNextCleanup = dict.Count + 4;
} }
public string AssemblyName {
get { return module.Assembly.Name.Name; }
}
public IList<IAttribute> ModuleAttributes { get; private set; }
public IList<IAttribute> AssemblyAttributes { get; private set; } public IList<IAttribute> AssemblyAttributes { get; private set; }
public ITypeDefinition GetTypeDefinition(string nameSpace, string name, int typeParameterCount, StringComparer nameComparer) public ITypeDefinition GetTypeDefinition(string nameSpace, string name, int typeParameterCount, StringComparer nameComparer)
@ -114,6 +120,11 @@ namespace ICSharpCode.Decompiler.Ast
return null; return null;
} }
public ITypeDefinition GetKnownTypeDefinition(TypeCode typeCode)
{
return GetTypeDefinition("System", ReflectionHelper.GetShortNameByTypeCode(typeCode), 0, StringComparer.Ordinal);
}
public IEnumerable<ITypeDefinition> GetTypes() public IEnumerable<ITypeDefinition> GetTypes()
{ {
foreach (TypeDefinition cecilType in module.Types) { foreach (TypeDefinition cecilType in module.Types) {
@ -165,6 +176,11 @@ namespace ICSharpCode.Decompiler.Ast
get { return new IParsedFile[0]; } get { return new IParsedFile[0]; }
} }
void IProjectContent.UpdateProjectContent(IParsedFile oldFile, IParsedFile newFile)
{
throw new NotSupportedException();
}
IParsedFile IProjectContent.GetFile(string fileName) IParsedFile IProjectContent.GetFile(string fileName)
{ {
return null; return null;

5
ICSharpCode.Decompiler/Ast/Transforms/PatternStatementTransform.cs

@ -1006,11 +1006,6 @@ namespace ICSharpCode.Decompiler.Ast.Transforms
TypeReference tr = o.Annotation<TypeReference>(); TypeReference tr = o.Annotation<TypeReference>();
return tr != null && tr.Namespace == ns && tr.Name == name; return tr != null && tr.Namespace == ns && tr.Name == name;
} }
public override S AcceptVisitor<T, S>(IPatternAstVisitor<T, S> visitor, T data)
{
throw new NotImplementedException();
}
} }
#endregion #endregion
} }

4
ICSharpCode.Decompiler/Disassembler/DisassemblerHelpers.cs

@ -222,7 +222,7 @@ namespace ICSharpCode.Decompiler.Disassembler
} else { } else {
// The ECMA specification says that ' inside SQString should be ecaped using an octal escape sequence, // The ECMA specification says that ' inside SQString should be ecaped using an octal escape sequence,
// but we follow Microsoft's ILDasm and use \'. // but we follow Microsoft's ILDasm and use \'.
return "'" + NRefactory.CSharp.OutputVisitor.ConvertString(identifier).Replace("'", "\\'") + "'"; return "'" + NRefactory.CSharp.CSharpOutputVisitor.ConvertString(identifier).Replace("'", "\\'") + "'";
} }
} }
@ -353,7 +353,7 @@ namespace ICSharpCode.Decompiler.Disassembler
string s = operand as string; string s = operand as string;
if (s != null) { if (s != null) {
writer.Write("\"" + NRefactory.CSharp.OutputVisitor.ConvertString(s) + "\""); writer.Write("\"" + NRefactory.CSharp.CSharpOutputVisitor.ConvertString(s) + "\"");
} else if (operand is char) { } else if (operand is char) {
writer.Write(((int)(char)operand).ToString()); writer.Write(((int)(char)operand).ToString());
} else if (operand is float) { } else if (operand is float) {

12
ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs

@ -126,10 +126,10 @@ namespace ICSharpCode.Decompiler.Disassembler
output.Write("pinvokeimpl"); output.Write("pinvokeimpl");
if (method.HasPInvokeInfo && method.PInvokeInfo != null) { if (method.HasPInvokeInfo && method.PInvokeInfo != null) {
PInvokeInfo info = method.PInvokeInfo; PInvokeInfo info = method.PInvokeInfo;
output.Write("(\"" + NRefactory.CSharp.OutputVisitor.ConvertString(info.Module.Name) + "\""); output.Write("(\"" + NRefactory.CSharp.CSharpOutputVisitor.ConvertString(info.Module.Name) + "\"");
if (!string.IsNullOrEmpty(info.EntryPoint) && info.EntryPoint != method.Name) if (!string.IsNullOrEmpty(info.EntryPoint) && info.EntryPoint != method.Name)
output.Write(" as \"" + NRefactory.CSharp.OutputVisitor.ConvertString(info.EntryPoint) + "\""); output.Write(" as \"" + NRefactory.CSharp.CSharpOutputVisitor.ConvertString(info.EntryPoint) + "\"");
if (info.IsNoMangle) if (info.IsNoMangle)
output.Write(" nomangle"); output.Write(" nomangle");
@ -344,7 +344,7 @@ namespace ICSharpCode.Decompiler.Disassembler
output.Write(" = "); output.Write(" = ");
if (na.Argument.Value is string) { if (na.Argument.Value is string) {
// secdecls use special syntax for strings // secdecls use special syntax for strings
output.Write("string('{0}')", NRefactory.CSharp.OutputVisitor.ConvertString((string)na.Argument.Value).Replace("'", "\'")); output.Write("string('{0}')", NRefactory.CSharp.CSharpOutputVisitor.ConvertString((string)na.Argument.Value).Replace("'", "\'"));
} else { } else {
WriteConstant(na.Argument.Value); WriteConstant(na.Argument.Value);
} }
@ -572,10 +572,10 @@ namespace ICSharpCode.Decompiler.Disassembler
if (cmi == null) if (cmi == null)
goto default; goto default;
output.Write("custom(\"{0}\", \"{1}\"", output.Write("custom(\"{0}\", \"{1}\"",
NRefactory.CSharp.OutputVisitor.ConvertString(cmi.ManagedType.FullName), NRefactory.CSharp.CSharpOutputVisitor.ConvertString(cmi.ManagedType.FullName),
NRefactory.CSharp.OutputVisitor.ConvertString(cmi.Cookie)); NRefactory.CSharp.CSharpOutputVisitor.ConvertString(cmi.Cookie));
if (cmi.Guid != Guid.Empty || !string.IsNullOrEmpty(cmi.UnmanagedType)) { if (cmi.Guid != Guid.Empty || !string.IsNullOrEmpty(cmi.UnmanagedType)) {
output.Write(", \"{0}\", \"{1}\"", cmi.Guid.ToString(), NRefactory.CSharp.OutputVisitor.ConvertString(cmi.UnmanagedType)); output.Write(", \"{0}\", \"{1}\"", cmi.Guid.ToString(), NRefactory.CSharp.CSharpOutputVisitor.ConvertString(cmi.UnmanagedType));
} }
output.Write(')'); output.Write(')');
break; break;

4
ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj

@ -122,6 +122,10 @@
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project> <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
<Name>Mono.Cecil</Name> <Name>Mono.Cecil</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\NRefactory\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory.CSharp.csproj">
<Project>{53DCA265-3C3C-42F9-B647-F72BA678122B}</Project>
<Name>ICSharpCode.NRefactory.CSharp</Name>
</ProjectReference>
<ProjectReference Include="..\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj"> <ProjectReference Include="..\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project> <Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
<Name>ICSharpCode.NRefactory</Name> <Name>ICSharpCode.NRefactory</Name>

4
ICSharpCode.Decompiler/Tests/ICSharpCode.Decompiler.Tests.csproj

@ -95,6 +95,10 @@
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project> <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
<Name>Mono.Cecil</Name> <Name>Mono.Cecil</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\NRefactory\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory.CSharp.csproj">
<Project>{53DCA265-3C3C-42F9-B647-F72BA678122B}</Project>
<Name>ICSharpCode.NRefactory.CSharp</Name>
</ProjectReference>
<ProjectReference Include="..\..\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj"> <ProjectReference Include="..\..\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project> <Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
<Name>ICSharpCode.NRefactory</Name> <Name>ICSharpCode.NRefactory</Name>

4
ILSpy.SharpDevelop.LGPL/AvalonEdit/IconBarMargin.cs

@ -7,7 +7,6 @@ using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using ICSharpCode.AvalonEdit.Editing; using ICSharpCode.AvalonEdit.Editing;
using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.AvalonEdit.Utils; using ICSharpCode.AvalonEdit.Utils;
@ -16,6 +15,7 @@ using ICSharpCode.ILSpy.Bookmarks;
using ICSharpCode.ILSpy.Debugger; using ICSharpCode.ILSpy.Debugger;
using ICSharpCode.ILSpy.Debugger.Bookmarks; using ICSharpCode.ILSpy.Debugger.Bookmarks;
using ICSharpCode.ILSpy.Debugger.Services; using ICSharpCode.ILSpy.Debugger.Services;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp;
using Mono.Cecil; using Mono.Cecil;
@ -308,7 +308,7 @@ namespace ICSharpCode.ILSpy.AvalonEdit
if (map != null) { if (map != null) {
BreakpointBookmark newBookmark = new BreakpointBookmark( BreakpointBookmark newBookmark = new BreakpointBookmark(
breakpoint.MemberReference, new AstLocation(map.SourceCodeLine, 0), breakpoint.FunctionToken, breakpoint.MemberReference, new TextLocation(map.SourceCodeLine, 0), breakpoint.FunctionToken,
map.ILInstructionOffset, BreakpointAction.Break, DebugInformation.Language); map.ILInstructionOffset, BreakpointAction.Break, DebugInformation.Language);
newBookmark.IsEnabled = breakpoint.IsEnabled; newBookmark.IsEnabled = breakpoint.IsEnabled;

8
ILSpy.SharpDevelop.LGPL/Bookmarks/BookmarkBase.cs

@ -4,7 +4,7 @@
using System; using System;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp;
using Mono.Cecil; using Mono.Cecil;
@ -15,14 +15,14 @@ namespace ICSharpCode.ILSpy.Bookmarks
/// </summary> /// </summary>
public class BookmarkBase : IBookmark public class BookmarkBase : IBookmark
{ {
AstLocation location; TextLocation location;
protected virtual void RemoveMark() protected virtual void RemoveMark()
{ {
} }
public AstLocation Location { public TextLocation Location {
get { return location; } get { return location; }
set { location = value; } set { location = value; }
} }
@ -64,7 +64,7 @@ namespace ICSharpCode.ILSpy.Bookmarks
} }
} }
public BookmarkBase(MemberReference member, AstLocation location) public BookmarkBase(MemberReference member, TextLocation location)
{ {
this.MemberReference = member; this.MemberReference = member;
this.Location = location; this.Location = location;

5
ILSpy.SharpDevelop.LGPL/Bookmarks/BookmarkManager.cs

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using ICSharpCode.Decompiler; using ICSharpCode.Decompiler;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp;
using Mono.Cecil; using Mono.Cecil;
using Mono.CSharp; using Mono.CSharp;
@ -97,7 +98,7 @@ namespace ICSharpCode.ILSpy.Bookmarks
public static void ToggleBookmark(string typeName, int line, public static void ToggleBookmark(string typeName, int line,
Predicate<BookmarkBase> canToggle, Predicate<BookmarkBase> canToggle,
Func<AstLocation, BookmarkBase> bookmarkFactory) Func<TextLocation, BookmarkBase> bookmarkFactory)
{ {
foreach (BookmarkBase bookmark in GetBookmarks(typeName)) { foreach (BookmarkBase bookmark in GetBookmarks(typeName)) {
if (canToggle(bookmark) && bookmark.LineNumber == line) { if (canToggle(bookmark) && bookmark.LineNumber == line) {
@ -107,7 +108,7 @@ namespace ICSharpCode.ILSpy.Bookmarks
} }
// no bookmark at that line: create a new bookmark // no bookmark at that line: create a new bookmark
BookmarkManager.AddMark(bookmarkFactory(new AstLocation(line, 0))); BookmarkManager.AddMark(bookmarkFactory(new TextLocation(line, 0)));
} }
public static event BookmarkEventHandler Removed; public static event BookmarkEventHandler Removed;

3
ILSpy.SharpDevelop.LGPL/Bookmarks/BreakpointBookmark.cs

@ -8,6 +8,7 @@ using ICSharpCode.Decompiler.ILAst;
using ICSharpCode.ILSpy.AvalonEdit; using ICSharpCode.ILSpy.AvalonEdit;
using ICSharpCode.ILSpy.Bookmarks; using ICSharpCode.ILSpy.Bookmarks;
using ICSharpCode.ILSpy.SharpDevelop; using ICSharpCode.ILSpy.SharpDevelop;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp;
using Mono.Cecil; using Mono.Cecil;
@ -83,7 +84,7 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
public string Tooltip { get; private set; } public string Tooltip { get; private set; }
public BreakpointBookmark(MemberReference member, AstLocation location, int functionToken, ILRange range, BreakpointAction action, DecompiledLanguages language) public BreakpointBookmark(MemberReference member, TextLocation location, int functionToken, ILRange range, BreakpointAction action, DecompiledLanguages language)
: base(member, location) : base(member, location)
{ {
this.action = action; this.action = action;

5
ILSpy.SharpDevelop.LGPL/Bookmarks/CurrentLineBookmark.cs

@ -6,6 +6,7 @@ using System.Windows.Media;
using ICSharpCode.ILSpy.AvalonEdit; using ICSharpCode.ILSpy.AvalonEdit;
using ICSharpCode.ILSpy.Bookmarks; using ICSharpCode.ILSpy.Bookmarks;
using ICSharpCode.ILSpy.SharpDevelop; using ICSharpCode.ILSpy.SharpDevelop;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp;
using Mono.Cecil; using Mono.Cecil;
@ -33,7 +34,7 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
endLine = makerEndLine; endLine = makerEndLine;
endColumn = makerEndColumn; endColumn = makerEndColumn;
instance = new CurrentLineBookmark(memberReference, new AstLocation(startLine, startColumn), ilOffset); instance = new CurrentLineBookmark(memberReference, new TextLocation(startLine, startColumn), ilOffset);
BookmarkManager.AddMark(instance); BookmarkManager.AddMark(instance);
} }
@ -53,7 +54,7 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
get { return 100; } get { return 100; }
} }
private CurrentLineBookmark(MemberReference member, AstLocation location, int ilOffset) : base(member, location) private CurrentLineBookmark(MemberReference member, TextLocation location, int ilOffset) : base(member, location)
{ {
this.ILOffset = ilOffset; this.ILOffset = ilOffset;
} }

3
ILSpy.SharpDevelop.LGPL/Bookmarks/MarkerBookmark.cs

@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System; using System;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.ILSpy.AvalonEdit; using ICSharpCode.ILSpy.AvalonEdit;
using Mono.Cecil; using Mono.Cecil;
@ -10,7 +11,7 @@ namespace ICSharpCode.ILSpy.Bookmarks
{ {
public abstract class MarkerBookmark : BookmarkBase public abstract class MarkerBookmark : BookmarkBase
{ {
public MarkerBookmark(MemberReference member, AstLocation location) : base(member, location) public MarkerBookmark(MemberReference member, TextLocation location) : base(member, location)
{ {
} }

4
ILSpy.SharpDevelop.LGPL/ILSpy.SharpDevelop.LGPL.csproj

@ -101,6 +101,10 @@
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project> <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
<Name>Mono.Cecil</Name> <Name>Mono.Cecil</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\NRefactory\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory.CSharp.csproj">
<Project>{53DCA265-3C3C-42F9-B647-F72BA678122B}</Project>
<Name>ICSharpCode.NRefactory.CSharp</Name>
</ProjectReference>
<ProjectReference Include="..\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj"> <ProjectReference Include="..\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project> <Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
<Name>ICSharpCode.NRefactory</Name> <Name>ICSharpCode.NRefactory</Name>

3
ILSpy.SharpDevelop.LGPL/Models/ToolTipRequestEventArgs.cs

@ -3,6 +3,7 @@
using System; using System;
using ICSharpCode.AvalonEdit; using ICSharpCode.AvalonEdit;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp;
namespace ICSharpCode.ILSpy.Debugger.Tooltips namespace ICSharpCode.ILSpy.Debugger.Tooltips
@ -27,7 +28,7 @@ namespace ICSharpCode.ILSpy.Debugger.Tooltips
/// <summary> /// <summary>
/// The mouse position, in document coordinates. /// The mouse position, in document coordinates.
/// </summary> /// </summary>
public AstLocation LogicalPosition { get; set; } public TextLocation LogicalPosition { get; set; }
/// <summary> /// <summary>
/// Gets/Sets the content to show as a tooltip. /// Gets/Sets the content to show as a tooltip.

1
ILSpy.SharpDevelop.LGPL/Services/DebuggerService.cs

@ -11,6 +11,7 @@ using ICSharpCode.ILSpy.Bookmarks;
using ICSharpCode.ILSpy.Debugger.Bookmarks; using ICSharpCode.ILSpy.Debugger.Bookmarks;
using ICSharpCode.ILSpy.Debugger.Tooltips; using ICSharpCode.ILSpy.Debugger.Tooltips;
using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.CSharp.Resolver;
using ICSharpCode.NRefactory.Semantics;
using Mono.Cecil; using Mono.Cecil;
namespace ICSharpCode.ILSpy.Debugger.Services namespace ICSharpCode.ILSpy.Debugger.Services

3
ILSpy.SharpDevelop.LGPL/Services/IDebugger.cs

@ -4,6 +4,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using ICSharpCode.Decompiler; using ICSharpCode.Decompiler;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp;
namespace ICSharpCode.ILSpy.Debugger.Services namespace ICSharpCode.ILSpy.Debugger.Services
@ -84,7 +85,7 @@ namespace ICSharpCode.ILSpy.Debugger.Services
/// Gets the tooltip control that shows the value of given variable. /// Gets the tooltip control that shows the value of given variable.
/// Return null if no tooltip is available. /// Return null if no tooltip is available.
/// </summary> /// </summary>
object GetTooltipControl(AstLocation logicalPosition, string variable); object GetTooltipControl(TextLocation logicalPosition, string variable);
/// <summary> /// <summary>
/// Queries the debugger whether it is possible to set the instruction pointer to a given position. /// Queries the debugger whether it is possible to set the instruction pointer to a given position.

16
ILSpy.sln

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
# SharpDevelop 4.1.0.7638-alpha # SharpDevelop 4.2.0.7998-alpha
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{F45DB999-7E72-4000-B5AD-3A7B485A0896}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{F45DB999-7E72-4000-B5AD-3A7B485A0896}"
ProjectSection(SolutionItems) = postProject ProjectSection(SolutionItems) = postProject
doc\Command Line.txt = doc\Command Line.txt doc\Command Line.txt = doc\Command Line.txt
@ -11,10 +11,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debugger", "Debugger", "{89
ProjectSection(SolutionItems) = postProject ProjectSection(SolutionItems) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Core", "Debugger\Debugger.Core\Debugger.Core.csproj", "{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy.Debugger", "Debugger\ILSpy.Debugger\ILSpy.Debugger.csproj", "{6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy.Debugger", "Debugger\ILSpy.Debugger\ILSpy.Debugger.csproj", "{6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Core", "Debugger\Debugger.Core\Debugger.Core.csproj", "{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy", "ILSpy\ILSpy.csproj", "{1E85EFF9-E370-4683-83E4-8A3D063FF791}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy", "ILSpy\ILSpy.csproj", "{1E85EFF9-E370-4683-83E4-8A3D063FF791}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TreeView", "SharpTreeView\ICSharpCode.TreeView.csproj", "{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TreeView", "SharpTreeView\ICSharpCode.TreeView.csproj", "{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}"
@ -41,6 +41,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy.BamlDecompiler.Tests"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy.SharpDevelop.LGPL", "ILSpy.SharpDevelop.LGPL\ILSpy.SharpDevelop.LGPL.csproj", "{704F66F1-5C7F-4326-A7AA-C604A3896D4E}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy.SharpDevelop.LGPL", "ILSpy.SharpDevelop.LGPL\ILSpy.SharpDevelop.LGPL.csproj", "{704F66F1-5C7F-4326-A7AA-C604A3896D4E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory.CSharp", "NRefactory\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory.CSharp.csproj", "{53DCA265-3C3C-42F9-B647-F72BA678122B}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -161,6 +163,14 @@ Global
{704F66F1-5C7F-4326-A7AA-C604A3896D4E}.Release|Any CPU.ActiveCfg = Release|x86 {704F66F1-5C7F-4326-A7AA-C604A3896D4E}.Release|Any CPU.ActiveCfg = Release|x86
{704F66F1-5C7F-4326-A7AA-C604A3896D4E}.Release|x86.Build.0 = Release|x86 {704F66F1-5C7F-4326-A7AA-C604A3896D4E}.Release|x86.Build.0 = Release|x86
{704F66F1-5C7F-4326-A7AA-C604A3896D4E}.Release|x86.ActiveCfg = Release|x86 {704F66F1-5C7F-4326-A7AA-C604A3896D4E}.Release|x86.ActiveCfg = Release|x86
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|x86.Build.0 = Debug|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|x86.ActiveCfg = Debug|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|Any CPU.Build.0 = Release|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|x86.Build.0 = Release|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

2
ILSpy/Bookmarks/MemberBookmark.cs

@ -138,8 +138,6 @@ namespace ICSharpCode.ILSpy.Bookmarks
var n = Node as TypeDeclaration; var n = Node as TypeDeclaration;
switch (n.ClassType) switch (n.ClassType)
{ {
case ClassType.Delegate:
return GetTypeOverlayedImage(attrNode, TypeIcon.Delegate);
case ClassType.Enum: case ClassType.Enum:
return GetTypeOverlayedImage(attrNode, TypeIcon.Enum); return GetTypeOverlayedImage(attrNode, TypeIcon.Enum);
case ClassType.Struct: case ClassType.Struct:

4
ILSpy/ILSpy.csproj

@ -355,6 +355,10 @@
<Project>{63E6915C-7EA4-4D76-AB28-0D7191EEA626}</Project> <Project>{63E6915C-7EA4-4D76-AB28-0D7191EEA626}</Project>
<Name>Mono.Cecil.Pdb</Name> <Name>Mono.Cecil.Pdb</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\NRefactory\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory.CSharp.csproj">
<Project>{53DCA265-3C3C-42F9-B647-F72BA678122B}</Project>
<Name>ICSharpCode.NRefactory.CSharp</Name>
</ProjectReference>
<ProjectReference Include="..\NRefactory\ICSharpCode.NRefactory.VB\ICSharpCode.NRefactory.VB.csproj"> <ProjectReference Include="..\NRefactory\ICSharpCode.NRefactory.VB\ICSharpCode.NRefactory.VB.csproj">
<Project>{7B82B671-419F-45F4-B778-D9286F996EFA}</Project> <Project>{7B82B671-419F-45F4-B778-D9286F996EFA}</Project>
<Name>ICSharpCode.NRefactory.VB</Name> <Name>ICSharpCode.NRefactory.VB</Name>

2
ILSpy/Languages/CSharpLanguage.cs

@ -575,7 +575,7 @@ namespace ICSharpCode.ILSpy
((ComposedType)astType).PointerRank--; ((ComposedType)astType).PointerRank--;
} }
astType.AcceptVisitor(new OutputVisitor(w, new CSharpFormattingOptions()), null); astType.AcceptVisitor(new CSharpOutputVisitor(w, new CSharpFormattingOptions()), null);
return w.ToString(); return w.ToString();
} }

19
ILSpy/VB/ILSpyEnvironmentProvider.cs

@ -74,22 +74,25 @@ namespace ICSharpCode.ILSpy.VB
return loader.ReadTypeReference(annotation, entity: current).Resolve(context); return loader.ReadTypeReference(annotation, entity: current).Resolve(context);
} }
public ClassType GetClassTypeForAstType(ICSharpCode.NRefactory.CSharp.AstType type) public TypeKind GetTypeKindForAstType(ICSharpCode.NRefactory.CSharp.AstType type)
{ {
var definition = type.Annotations.OfType<TypeReference>().First().ResolveOrThrow(); var annotation = type.Annotation<TypeReference>();
if (annotation == null)
return TypeKind.Unknown;
var definition = annotation.ResolveOrThrow();
if (definition.IsClass) if (definition.IsClass)
return ClassType.Class; return TypeKind.Class;
if (definition.IsInterface) if (definition.IsInterface)
return ClassType.Interface; return TypeKind.Interface;
if (definition.IsEnum) if (definition.IsEnum)
return ClassType.Enum; return TypeKind.Enum;
if (definition.IsFunctionPointer) if (definition.IsFunctionPointer)
return ClassType.Delegate; return TypeKind.Delegate;
if (definition.IsValueType) if (definition.IsValueType)
return ClassType.Struct; return TypeKind.Struct;
return ClassType.Module; return TypeKind.Unknown;
} }
public TypeCode ResolveExpression(ICSharpCode.NRefactory.CSharp.Expression expression) public TypeCode ResolveExpression(ICSharpCode.NRefactory.CSharp.Expression expression)

4
NRefactory/ICSharpCode.NRefactory.VB/Visitors/CSharpToVBConverterVisitor.cs

@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors
{ {
string RootNamespace { get; } string RootNamespace { get; }
string GetTypeNameForAttribute(CSharp.Attribute attribute); string GetTypeNameForAttribute(CSharp.Attribute attribute);
ClassType GetClassTypeForAstType(CSharp.AstType type); TypeKind GetTypeKindForAstType(CSharp.AstType type);
TypeCode ResolveExpression(CSharp.Expression expression); TypeCode ResolveExpression(CSharp.Expression expression);
bool? IsReferenceType(CSharp.Expression expression); bool? IsReferenceType(CSharp.Expression expression);
ITypeResolveContext ResolveContext { get; } ITypeResolveContext ResolveContext { get; }
@ -881,7 +881,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors
if (typeDeclaration.BaseTypes.Any()) { if (typeDeclaration.BaseTypes.Any()) {
var first = typeDeclaration.BaseTypes.First(); var first = typeDeclaration.BaseTypes.First();
if (provider.GetClassTypeForAstType(first) != ClassType.Interface) { if (provider.GetTypeKindForAstType(first) != TypeKind.Interface) {
ConvertNodes(typeDeclaration.BaseTypes.Skip(1), type.ImplementsTypes); ConvertNodes(typeDeclaration.BaseTypes.Skip(1), type.ImplementsTypes);
type.InheritsType = (AstType)first.AcceptVisitor(this, data); type.InheritsType = (AstType)first.AcceptVisitor(this, data);
} else } else

4
TestPlugin/TestPlugin.csproj

@ -94,6 +94,10 @@
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project> <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
<Name>Mono.Cecil</Name> <Name>Mono.Cecil</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\NRefactory\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory.CSharp.csproj">
<Project>{53DCA265-3C3C-42F9-B647-F72BA678122B}</Project>
<Name>ICSharpCode.NRefactory.CSharp</Name>
</ProjectReference>
<ProjectReference Include="..\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj"> <ProjectReference Include="..\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project> <Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
<Name>ICSharpCode.NRefactory</Name> <Name>ICSharpCode.NRefactory</Name>

Loading…
Cancel
Save