Browse Source

Merge branch 'master' of https://github.com/icsharpcode/ILSpy into Debugger

newNRvisualizers
Eusebiu Marcu 14 years ago
parent
commit
a29b397f06
  1. 14
      ICSharpCode.NRefactory/CSharp/Analysis/DefiniteAssignmentAnalysis.cs
  2. 4
      ICSharpCode.NRefactory/CSharp/Ast/ComposedType.cs
  3. 2
      ICSharpCode.NRefactory/CSharp/Ast/Identifier.cs
  4. 17
      ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs
  5. 4
      ICSharpCode.NRefactory/CSharp/Parser/TypeSystemConvertVisitor.cs
  6. 4
      ICSharpCode.NRefactory/CSharp/Resolver/ResolveVisitor.cs
  7. 2
      ICSharpCode.NRefactory/Documentation/XmlDocumentationProvider.cs

14
ICSharpCode.NRefactory/CSharp/Analysis/DefiniteAssignmentAnalysis.cs

@ -167,12 +167,14 @@ namespace ICSharpCode.NRefactory.CSharp.Analysis @@ -167,12 +167,14 @@ namespace ICSharpCode.NRefactory.CSharp.Analysis
/// This method can be used to restrict the analysis to only a part of the method.
/// Only the control flow paths that are fully contained within the selected part will be analyzed.
/// </summary>
/// <remarks>Both 'start' and 'end' are inclusive.</remarks>
public void SetAnalyzedRange(Statement start, Statement end)
{
Debug.Assert(beginNodeDict.ContainsKey(start) && endNodeDict.ContainsKey(end));
int startIndex = beginNodeDict[start].Index;
int endIndex = endNodeDict[end].Index;
/// <remarks>By default, both 'start' and 'end' are inclusive.</remarks>
public void SetAnalyzedRange(Statement start, Statement end, bool startInclusive = true, bool endInclusive = true)
{
var dictForStart = startInclusive ? beginNodeDict : endNodeDict;
var dictForEnd = endInclusive ? endNodeDict : beginNodeDict;
Debug.Assert(dictForStart.ContainsKey(start) && dictForEnd.ContainsKey(end));
int startIndex = dictForStart[start].Index;
int endIndex = dictForEnd[end].Index;
if (startIndex > endIndex)
throw new ArgumentException("The start statement must be lexically preceding the end statement");
this.analyzedRangeStart = startIndex;

4
ICSharpCode.NRefactory/CSharp/Ast/ComposedType.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.CSharp
public int PointerRank {
get {
return GetChildrenByRole(PointerRole).Count();
return GetChildrenByRole(PointerRole).Count;
}
set {
if (value < 0)
@ -141,7 +141,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -141,7 +141,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
public int Dimensions {
get { return 1 + GetChildrenByRole(Roles.Comma).Count(); }
get { return 1 + GetChildrenByRole(Roles.Comma).Count; }
set {
int d = this.Dimensions;
while (d > value) {

2
ICSharpCode.NRefactory/CSharp/Ast/Identifier.cs

@ -96,7 +96,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -96,7 +96,7 @@ namespace ICSharpCode.NRefactory.CSharp
{
if (name == null)
throw new ArgumentNullException("name");
IsVerbatim = name.StartsWith ("@");
IsVerbatim = name.Length > 0 && name[0] == '@';
this.Name = IsVerbatim ? name.Substring (1) : name;
this.startLocation = location;
}

17
ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs

@ -941,7 +941,11 @@ namespace ICSharpCode.NRefactory.CSharp @@ -941,7 +941,11 @@ namespace ICSharpCode.NRefactory.CSharp
return ConvertChar(ch);
}
static string ConvertChar(char ch)
/// <summary>
/// Gets the escape sequence for the specified character.
/// </summary>
/// <remarks>This method does not convert ' or ".</remarks>
public static string ConvertChar(char ch)
{
switch (ch) {
case '\\':
@ -963,7 +967,9 @@ namespace ICSharpCode.NRefactory.CSharp @@ -963,7 +967,9 @@ namespace ICSharpCode.NRefactory.CSharp
case '\v':
return "\\v";
default:
if (char.IsControl(ch) || char.IsSurrogate(ch)) {
if (char.IsControl(ch) || char.IsSurrogate(ch) ||
// print all uncommon white spaces as numbers
(char.IsWhiteSpace(ch) && ch != ' ')) {
return "\\u" + ((int)ch).ToString("x4");
} else {
return ch.ToString();
@ -971,7 +977,10 @@ namespace ICSharpCode.NRefactory.CSharp @@ -971,7 +977,10 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
static string ConvertString(string str)
/// <summary>
/// Converts special characters to escape sequences within the given string.
/// </summary>
public static string ConvertString(string str)
{
StringBuilder sb = new StringBuilder();
foreach (char ch in str) {
@ -2145,7 +2154,9 @@ namespace ICSharpCode.NRefactory.CSharp @@ -2145,7 +2154,9 @@ namespace ICSharpCode.NRefactory.CSharp
// "1.0 / /*comment*/a", then we need to insert a space in front of the comment.
formatter.Space();
}
formatter.StartNode(comment);
formatter.WriteComment(comment.CommentType, comment.Content);
formatter.EndNode(comment);
lastWritten = LastWritten.Whitespace;
return null;
}

4
ICSharpCode.NRefactory/CSharp/Parser/TypeSystemConvertVisitor.cs

@ -263,7 +263,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -263,7 +263,7 @@ namespace ICSharpCode.NRefactory.CSharp
#region Fields
public override IEntity VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data)
{
bool isSingleField = fieldDeclaration.Variables.Count() == 1;
bool isSingleField = fieldDeclaration.Variables.Count == 1;
Modifiers modifiers = fieldDeclaration.Modifiers;
DefaultField field = null;
foreach (VariableInitializer vi in fieldDeclaration.Variables) {
@ -476,7 +476,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -476,7 +476,7 @@ namespace ICSharpCode.NRefactory.CSharp
#region Events
public override IEntity VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
{
bool isSingleEvent = eventDeclaration.Variables.Count() == 1;
bool isSingleEvent = eventDeclaration.Variables.Count == 1;
Modifiers modifiers = eventDeclaration.Modifiers;
DefaultEvent ev = null;
foreach (VariableInitializer vi in eventDeclaration.Variables) {

4
ICSharpCode.NRefactory/CSharp/Resolver/ResolveVisitor.cs

@ -241,7 +241,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver @@ -241,7 +241,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver
ResolveResult VisitFieldOrEventDeclaration(AttributedNode fieldOrEventDeclaration)
{
int initializerCount = fieldOrEventDeclaration.GetChildrenByRole(FieldDeclaration.Roles.Variable).Count();
int initializerCount = fieldOrEventDeclaration.GetChildrenByRole(FieldDeclaration.Roles.Variable).Count;
ResolveResult result = null;
for (AstNode node = fieldOrEventDeclaration.FirstChild; node != null; node = node.NextSibling) {
if (node.Role == FieldDeclaration.Roles.Variable) {
@ -939,7 +939,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver @@ -939,7 +939,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver
firstInitializer != null ? firstInitializer.Initializer : null,
false);
int initializerCount = variableDeclarationStatement.Variables.Count();
int initializerCount = variableDeclarationStatement.Variables.Count;
ResolveResult result = null;
for (AstNode node = variableDeclarationStatement.FirstChild; node != null; node = node.NextSibling) {
if (node.Role == FieldDeclaration.Roles.Variable) {

2
ICSharpCode.NRefactory/Documentation/XmlDocumentationProvider.cs

@ -120,7 +120,7 @@ namespace ICSharpCode.NRefactory.Documentation @@ -120,7 +120,7 @@ namespace ICSharpCode.NRefactory.Documentation
static string GetRedirectionTarget(string target)
{
string programFilesDir = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
string programFilesDir = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
programFilesDir = AppendDirectorySeparator(programFilesDir);
string corSysDir = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory();

Loading…
Cancel
Save