mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
8db1fe2 Enforce space in output visitor when printing "ptr & &v". b00cf19 Add parentheses test for "a + (b == null ? c : d)" 9b5fdd9 fixed endlocation bug. 914df80 Merge remote branch 'origin/master' into master. 9dc67b8 Fix CecilLoaderTests for Dictionary<,>.ValueCollection::Count (it's a non-virtual property implementing an interface; and isn't considered sealed in C#). 28d8b3a Include Mono.Cecil in solution. 16baa75 Corrected astvisitor interface naming. 41168e3 Fixed tests. e0a6909 added more bugfixes. 31113d2 fixed switch section. daccb3a Fixed parser bug. 59da5a2 Worked on type parsing. 65d688a Added some missing token properties. 83a7d2f Splitted the goto statement cases: GotoStatement, GotoCaseStatement, GotoDefaultStatement. ecc1772 Added YieldBreakStatement. 915a122 Added some comments. b8cf7d3 Splitted while & do while statements. b6c562e Fix some formatting issues with the C# output visitor. 48d8ac5 Fixed detection of 'sealed' method modifier. dc6daa1 Fixed output of enum members and the "const" modifier. 6e47f53 Add missing newline after property declarations. a33009d Add hyperlink support to decompiler. 43625b4 Initial port to new NRefactory. 76d844f Merge commit 'd87c5ea2c89dda7da5eab2dce7a30fe10729481f' 57522bf Enable automatic removal when replacing a node with its own descendant. bad0fdb Merge commit 'e1552755b97863393b543603557590ad90d8ef98' 39ad4c4 Update NRefactory to new Mono.Cecil. git-subtree-dir: NRefactory git-subtree-split: 8db1fe252f6539e9cde8c9fb5f59aa60e4089d8fpull/129/head
106 changed files with 1047 additions and 400 deletions
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp |
||||
{ |
||||
/// <summary>
|
||||
/// Compares whether two ASTs are structurally identical.
|
||||
/// </summary>
|
||||
public static class AstComparer |
||||
{ |
||||
static HashSet<Type> nodeTypesWithoutExtraInfo = new HashSet<Type> { |
||||
typeof(IdentifierExpression) |
||||
}; |
||||
|
||||
public static bool? AreEqual(AstNode node1, AstNode node2) |
||||
{ |
||||
if (node1 == node2) |
||||
return true; |
||||
if (node1 == null || node1.IsNull || node2 == null || node2.IsNull) |
||||
return false; |
||||
Type nodeType = node1.GetType(); |
||||
if (nodeType != node2.GetType()) |
||||
return false; |
||||
if (node1.Role != node2.Role) |
||||
return false; |
||||
AstNode child1 = node1.FirstChild; |
||||
AstNode child2 = node2.FirstChild; |
||||
bool? result = true; |
||||
while (result != false && (child1 != null || child2 != null)) { |
||||
result &= AreEqual(child1, child2); |
||||
} |
||||
if (nodeTypesWithoutExtraInfo.Contains(nodeType)) |
||||
return result; |
||||
if (nodeType == typeof(Identifier)) |
||||
return ((Identifier)node1).Name == ((Identifier)node2).Name; |
||||
return null; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp |
||||
{ |
||||
/// <summary>
|
||||
/// Represents an AstType as an expression.
|
||||
/// This is used when calling a method on a primitive type: "int.Parse()"
|
||||
/// </summary>
|
||||
public class TypeReferenceExpression : Expression |
||||
{ |
||||
public AstType Type { |
||||
get { return GetChildByRole(Roles.Type); } |
||||
set { SetChildByRole(Roles.Type, value); } |
||||
} |
||||
|
||||
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data) |
||||
{ |
||||
return visitor.VisitTypeReferenceExpression(this, data); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,73 @@
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// DoWhileStatement.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@novell.com>
|
||||
//
|
||||
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.using System;
|
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp |
||||
{ |
||||
/// <summary>
|
||||
/// "do EmbeddedStatement while(Condition);"
|
||||
/// </summary>
|
||||
public class DoWhileStatement : Statement |
||||
{ |
||||
public static readonly Role<CSharpTokenNode> DoKeywordRole = new Role<CSharpTokenNode>("DoKeyword", CSharpTokenNode.Null); |
||||
public static readonly Role<CSharpTokenNode> WhileKeywordRole = new Role<CSharpTokenNode>("WhileKeyword", CSharpTokenNode.Null); |
||||
|
||||
public CSharpTokenNode DoToken { |
||||
get { return GetChildByRole (DoKeywordRole); } |
||||
} |
||||
|
||||
public Statement EmbeddedStatement { |
||||
get { return GetChildByRole (Roles.EmbeddedStatement); } |
||||
set { SetChildByRole (Roles.EmbeddedStatement, value); } |
||||
} |
||||
|
||||
public CSharpTokenNode WhileToken { |
||||
get { return GetChildByRole (WhileKeywordRole); } |
||||
} |
||||
|
||||
public CSharpTokenNode LParToken { |
||||
get { return GetChildByRole (Roles.LPar); } |
||||
} |
||||
|
||||
public Expression Condition { |
||||
get { return GetChildByRole (Roles.Condition); } |
||||
set { SetChildByRole (Roles.Condition, value); } |
||||
} |
||||
|
||||
public CSharpTokenNode RParToken { |
||||
get { return GetChildByRole (Roles.RPar); } |
||||
} |
||||
|
||||
public CSharpTokenNode SemicolonToken { |
||||
get { return GetChildByRole (Roles.Semicolon); } |
||||
} |
||||
|
||||
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data) |
||||
{ |
||||
return visitor.VisitDoWhileStatement (this, data); |
||||
} |
||||
} |
||||
} |
||||
|
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// YieldBreakStatement.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@novell.com>
|
||||
//
|
||||
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp |
||||
{ |
||||
/// <summary>
|
||||
/// yield break;
|
||||
/// </summary>
|
||||
public class YieldBreakStatement : Statement |
||||
{ |
||||
public static readonly Role<CSharpTokenNode> YieldKeywordRole = new Role<CSharpTokenNode>("YieldKeyword", CSharpTokenNode.Null); |
||||
public static readonly Role<CSharpTokenNode> BreakKeywordRole = new Role<CSharpTokenNode>("BreakKeyword", CSharpTokenNode.Null); |
||||
|
||||
public CSharpTokenNode YieldToken { |
||||
get { return GetChildByRole (YieldKeywordRole); } |
||||
} |
||||
|
||||
public CSharpTokenNode BreakToken { |
||||
get { return GetChildByRole (BreakKeywordRole); } |
||||
} |
||||
|
||||
public CSharpTokenNode SemicolonToken { |
||||
get { return GetChildByRole (Roles.Semicolon); } |
||||
} |
||||
|
||||
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data) |
||||
{ |
||||
return visitor.VisitYieldBreakStatement (this, data); |
||||
} |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue