diff --git a/ICSharpCode.NRefactory/CSharp/Analysis/ControlFlow.cs b/ICSharpCode.NRefactory.CSharp/Analysis/ControlFlow.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Analysis/ControlFlow.cs rename to ICSharpCode.NRefactory.CSharp/Analysis/ControlFlow.cs diff --git a/ICSharpCode.NRefactory/CSharp/Analysis/DefiniteAssignmentAnalysis.cs b/ICSharpCode.NRefactory.CSharp/Analysis/DefiniteAssignmentAnalysis.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Analysis/DefiniteAssignmentAnalysis.cs rename to ICSharpCode.NRefactory.CSharp/Analysis/DefiniteAssignmentAnalysis.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs similarity index 96% rename from ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs rename to ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs index 943ebba115..7f8c62e5b6 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs @@ -117,20 +117,20 @@ namespace ICSharpCode.NRefactory.CSharp } } - public virtual AstLocation StartLocation { + public virtual TextLocation StartLocation { get { var child = firstChild; if (child == null) - return AstLocation.Empty; + return TextLocation.Empty; return child.StartLocation; } } - public virtual AstLocation EndLocation { + public virtual TextLocation EndLocation { get { var child = lastChild; if (child == null) - return AstLocation.Empty; + return TextLocation.Empty; return child.EndLocation; } } @@ -506,10 +506,10 @@ namespace ICSharpCode.NRefactory.CSharp public AstNode GetNodeAt (int line, int column, Predicate pred = null) { - return GetNodeAt (new AstLocation (line, column), pred); + return GetNodeAt (new TextLocation (line, column), pred); } - public AstNode GetNodeAt (AstLocation location, Predicate pred = null) + public AstNode GetNodeAt (TextLocation location, Predicate pred = null) { AstNode result = null; AstNode node = this; @@ -533,14 +533,14 @@ namespace ICSharpCode.NRefactory.CSharp public T GetNodeAt (int line, int column) where T : AstNode { - return GetNodeAt (new AstLocation (line, column)); + return GetNodeAt (new TextLocation (line, column)); } /// /// Gets the node specified by T at location. This is useful for getting a specific node from the tree. For example searching /// the current method declaration. /// - public T GetNodeAt (AstLocation location) where T : AstNode + public T GetNodeAt (TextLocation location) where T : AstNode { T result = null; AstNode node = this; @@ -564,10 +564,10 @@ namespace ICSharpCode.NRefactory.CSharp public IEnumerable GetNodesBetween (int startLine, int startColumn, int endLine, int endColumn) { - return GetNodesBetween (new AstLocation (startLine, startColumn), new AstLocation (endLine, endColumn)); + return GetNodesBetween (new TextLocation (startLine, startColumn), new TextLocation (endLine, endColumn)); } - public IEnumerable GetNodesBetween (AstLocation start, AstLocation end) + public IEnumerable GetNodesBetween (TextLocation start, TextLocation end) { AstNode node = this; while (node != null) { @@ -593,10 +593,10 @@ namespace ICSharpCode.NRefactory.CSharp public bool Contains (int line, int column) { - return Contains (new AstLocation (line, column)); + return Contains (new TextLocation (line, column)); } - public bool Contains (AstLocation location) + public bool Contains (TextLocation location) { return this.StartLocation <= location && location < this.EndLocation; } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/AstNodeCollection.cs b/ICSharpCode.NRefactory.CSharp/Ast/AstNodeCollection.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/AstNodeCollection.cs rename to ICSharpCode.NRefactory.CSharp/Ast/AstNodeCollection.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/AstType.cs b/ICSharpCode.NRefactory.CSharp/Ast/AstType.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/AstType.cs rename to ICSharpCode.NRefactory.CSharp/Ast/AstType.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/CSharpModifierToken.cs b/ICSharpCode.NRefactory.CSharp/Ast/CSharpModifierToken.cs similarity index 97% rename from ICSharpCode.NRefactory/CSharp/Ast/CSharpModifierToken.cs rename to ICSharpCode.NRefactory.CSharp/Ast/CSharpModifierToken.cs index 28d72cb996..59d021aeba 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/CSharpModifierToken.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/CSharpModifierToken.cs @@ -64,7 +64,7 @@ namespace ICSharpCode.NRefactory.CSharp get { return allModifiers; } } - public CSharpModifierToken (AstLocation location, Modifiers modifier) : base (location, 0) + public CSharpModifierToken (TextLocation location, Modifiers modifier) : base (location, 0) { this.Modifier = modifier; } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/CSharpTokenNode.cs b/ICSharpCode.NRefactory.CSharp/Ast/CSharpTokenNode.cs similarity index 86% rename from ICSharpCode.NRefactory/CSharp/Ast/CSharpTokenNode.cs rename to ICSharpCode.NRefactory.CSharp/Ast/CSharpTokenNode.cs index b125413d0f..f174adecca 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/CSharpTokenNode.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/CSharpTokenNode.cs @@ -1,4 +1,4 @@ -// +// // TokenNode.cs // // Author: @@ -38,7 +38,7 @@ namespace ICSharpCode.NRefactory.CSharp } } - public NullCSharpTokenNode () : base (AstLocation.Empty, 0) + public NullCSharpTokenNode () : base (TextLocation.Empty, 0) { } @@ -60,28 +60,28 @@ namespace ICSharpCode.NRefactory.CSharp } } - AstLocation startLocation; - public override AstLocation StartLocation { + TextLocation startLocation; + public override TextLocation StartLocation { get { return startLocation; } } protected int tokenLength; - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { - return new AstLocation (StartLocation.Line, StartLocation.Column + tokenLength); + return new TextLocation (StartLocation.Line, StartLocation.Column + tokenLength); } } - public CSharpTokenNode (AstLocation location, int tokenLength) + public CSharpTokenNode (TextLocation location, int tokenLength) { this.startLocation = location; this.tokenLength = tokenLength; } #region IRelocationable implementation - void IRelocatable.SetStartLocation (AstLocation startLocation) + void IRelocatable.SetStartLocation (TextLocation startLocation) { this.startLocation = startLocation; } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/CSharpUtil.cs b/ICSharpCode.NRefactory.CSharp/Ast/CSharpUtil.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/CSharpUtil.cs rename to ICSharpCode.NRefactory.CSharp/Ast/CSharpUtil.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/CompilationUnit.cs b/ICSharpCode.NRefactory.CSharp/Ast/CompilationUnit.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/CompilationUnit.cs rename to ICSharpCode.NRefactory.CSharp/Ast/CompilationUnit.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/ComposedType.cs b/ICSharpCode.NRefactory.CSharp/Ast/ComposedType.cs similarity index 96% rename from ICSharpCode.NRefactory/CSharp/Ast/ComposedType.cs rename to ICSharpCode.NRefactory.CSharp/Ast/ComposedType.cs index 813f472137..dceeae35f0 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/ComposedType.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/ComposedType.cs @@ -46,7 +46,7 @@ namespace ICSharpCode.NRefactory.CSharp return !GetChildByRole(NullableRole).IsNull; } set { - SetChildByRole(NullableRole, value ? new CSharpTokenNode(AstLocation.Empty, 1) : null); + SetChildByRole(NullableRole, value ? new CSharpTokenNode(TextLocation.Empty, 1) : null); } } @@ -63,7 +63,7 @@ namespace ICSharpCode.NRefactory.CSharp d--; } while (d < value) { - InsertChildBefore(GetChildByRole(PointerRole), new CSharpTokenNode(AstLocation.Empty, 1), PointerRole); + InsertChildBefore(GetChildByRole(PointerRole), new CSharpTokenNode(TextLocation.Empty, 1), PointerRole); d++; } } @@ -149,7 +149,7 @@ namespace ICSharpCode.NRefactory.CSharp d--; } while (d < value) { - InsertChildBefore(GetChildByRole(Roles.Comma), new CSharpTokenNode(AstLocation.Empty, 1), Roles.Comma); + InsertChildBefore(GetChildByRole(Roles.Comma), new CSharpTokenNode(TextLocation.Empty, 1), Roles.Comma); d++; } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/DepthFirstAstVisitor.cs b/ICSharpCode.NRefactory.CSharp/Ast/DepthFirstAstVisitor.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/DepthFirstAstVisitor.cs rename to ICSharpCode.NRefactory.CSharp/Ast/DepthFirstAstVisitor.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/ErrorNode.cs b/ICSharpCode.NRefactory.CSharp/Ast/ErrorNode.cs similarity index 92% rename from ICSharpCode.NRefactory/CSharp/Ast/ErrorNode.cs rename to ICSharpCode.NRefactory.CSharp/Ast/ErrorNode.cs index af2fed7506..c8569c55a8 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/ErrorNode.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/ErrorNode.cs @@ -1,4 +1,4 @@ -// +// // ErrorNode.cs // // Author: @@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.CSharp /// public class ErrorNode : AstNode { - static AstLocation maxLoc = new AstLocation (int.MaxValue, int.MaxValue); + static TextLocation maxLoc = new TextLocation (int.MaxValue, int.MaxValue); public override NodeType NodeType { get { @@ -42,13 +42,13 @@ namespace ICSharpCode.NRefactory.CSharp } } - public override AstLocation StartLocation { + public override TextLocation StartLocation { get { return maxLoc; } } - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { return maxLoc; } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/AnonymousMethodExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/AnonymousMethodExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/AnonymousMethodExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/AnonymousMethodExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/AnonymousTypeCreateExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/AnonymousTypeCreateExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/AnonymousTypeCreateExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/AnonymousTypeCreateExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ArrayCreateExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ArrayCreateExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/ArrayCreateExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/ArrayCreateExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ArrayInitializerExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ArrayInitializerExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/ArrayInitializerExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/ArrayInitializerExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/AsExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/AsExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/AsExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/AsExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/AssignmentExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/AssignmentExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/AssignmentExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/AssignmentExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/BaseReferenceExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/BaseReferenceExpression.cs similarity index 89% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/BaseReferenceExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/BaseReferenceExpression.cs index b75fb95344..de964170b6 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/BaseReferenceExpression.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/BaseReferenceExpression.cs @@ -31,19 +31,19 @@ namespace ICSharpCode.NRefactory.CSharp /// public class BaseReferenceExpression : Expression { - public AstLocation Location { + public TextLocation Location { get; set; } - public override AstLocation StartLocation { + public override TextLocation StartLocation { get { return Location; } } - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { - return new AstLocation (Location.Line, Location.Column + "base".Length); + return new TextLocation (Location.Line, Location.Column + "base".Length); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/BinaryOperatorExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/BinaryOperatorExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/BinaryOperatorExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/BinaryOperatorExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/CastExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/CastExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/CastExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/CastExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/CheckedExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/CheckedExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/CheckedExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/CheckedExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ConditionalExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ConditionalExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/ConditionalExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/ConditionalExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/DefaultValueExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/DefaultValueExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/DefaultValueExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/DefaultValueExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/DirectionExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/DirectionExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/DirectionExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/DirectionExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/EmptyExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/EmptyExpression.cs similarity index 89% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/EmptyExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/EmptyExpression.cs index 3c23f54f88..9ea3c99079 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/EmptyExpression.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/EmptyExpression.cs @@ -1,4 +1,4 @@ -// +// // EmptyExpression.cs // // Author: @@ -32,15 +32,15 @@ namespace ICSharpCode.NRefactory.CSharp /// public class EmptyExpression : Expression, IRelocatable { - AstLocation location; + TextLocation location; - public override AstLocation StartLocation { + public override TextLocation StartLocation { get { return location; } } - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { return location; } @@ -50,13 +50,13 @@ namespace ICSharpCode.NRefactory.CSharp { } - public EmptyExpression (AstLocation location) + public EmptyExpression (TextLocation location) { this.location = location; } #region IRelocationable implementation - void IRelocatable.SetStartLocation (AstLocation startLocation) + void IRelocatable.SetStartLocation (TextLocation startLocation) { this.location = startLocation; } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/Expression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/Expression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/Expression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/Expression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/IdentifierExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/IdentifierExpression.cs similarity index 96% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/IdentifierExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/IdentifierExpression.cs index e982f13201..cce153e97b 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/IdentifierExpression.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/IdentifierExpression.cs @@ -38,7 +38,7 @@ namespace ICSharpCode.NRefactory.CSharp this.Identifier = identifier; } - public IdentifierExpression(string identifier, AstLocation location) + public IdentifierExpression(string identifier, TextLocation location) { SetChildByRole(Roles.Identifier, CSharp.Identifier.Create (identifier, location)); } @@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole(Roles.Identifier, CSharp.Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(Roles.Identifier, CSharp.Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/IndexerExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/IndexerExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/IndexerExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/IndexerExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/InvocationExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/InvocationExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/InvocationExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/InvocationExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/IsExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/IsExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/IsExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/IsExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/LambdaExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/LambdaExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/LambdaExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/LambdaExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/MemberReferenceExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/MemberReferenceExpression.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/MemberReferenceExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/MemberReferenceExpression.cs index 4a7decbe0e..fdea7dc635 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/MemberReferenceExpression.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/MemberReferenceExpression.cs @@ -1,4 +1,4 @@ -// +// // MemberReferenceExpression.cs // // Author: @@ -43,7 +43,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole (Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/NamedArgumentExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/NamedArgumentExpression.cs similarity index 98% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/NamedArgumentExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/NamedArgumentExpression.cs index d0005f5f21..c4cf8e8a58 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/NamedArgumentExpression.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/NamedArgumentExpression.cs @@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole(Roles.Identifier, CSharp.Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(Roles.Identifier, CSharp.Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/NamedExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/NamedExpression.cs similarity index 98% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/NamedExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/NamedExpression.cs index c0b78ce042..5c4892f131 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/NamedExpression.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/NamedExpression.cs @@ -1,4 +1,4 @@ -// +// // NamedExpression.cs // // Author: @@ -50,7 +50,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole(Roles.Identifier, CSharp.Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(Roles.Identifier, CSharp.Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/NullReferenceExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/NullReferenceExpression.cs similarity index 88% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/NullReferenceExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/NullReferenceExpression.cs index df95202b8d..3fe5a0e49a 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/NullReferenceExpression.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/NullReferenceExpression.cs @@ -31,16 +31,16 @@ namespace ICSharpCode.NRefactory.CSharp /// public class NullReferenceExpression : Expression { - AstLocation location; - public override AstLocation StartLocation { + TextLocation location; + public override TextLocation StartLocation { get { return location; } } - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { - return new AstLocation (location.Line, location.Column + "null".Length); + return new TextLocation (location.Line, location.Column + "null".Length); } } @@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp { } - public NullReferenceExpression (AstLocation location) + public NullReferenceExpression (TextLocation location) { this.location = location; } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ObjectCreateExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ObjectCreateExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/ObjectCreateExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/ObjectCreateExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ParenthesizedExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ParenthesizedExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/ParenthesizedExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/ParenthesizedExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/PointerReferenceExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/PointerReferenceExpression.cs similarity index 98% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/PointerReferenceExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/PointerReferenceExpression.cs index 21e805b671..b9f3a95299 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/PointerReferenceExpression.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/PointerReferenceExpression.cs @@ -1,4 +1,4 @@ -// +// // PointerReferenceExpression.cs // // Author: @@ -45,7 +45,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole(Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/PrimitiveExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/PrimitiveExpression.cs similarity index 86% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/PrimitiveExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/PrimitiveExpression.cs index 22e16e29ba..4ba03a1508 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/PrimitiveExpression.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/PrimitiveExpression.cs @@ -33,17 +33,17 @@ namespace ICSharpCode.NRefactory.CSharp { public static readonly object AnyValue = new object(); - AstLocation startLocation; - public override AstLocation StartLocation { + TextLocation startLocation; + public override TextLocation StartLocation { get { return startLocation; } } string literalValue; - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { - return new AstLocation (StartLocation.Line, StartLocation.Column + literalValue.Length); + return new TextLocation (StartLocation.Line, StartLocation.Column + literalValue.Length); } } @@ -69,7 +69,7 @@ namespace ICSharpCode.NRefactory.CSharp this.literalValue = literalValue ?? ""; } - public PrimitiveExpression (object value, AstLocation startLocation, string literalValue) + public PrimitiveExpression (object value, TextLocation startLocation, string literalValue) { this.Value = value; this.startLocation = startLocation; @@ -77,7 +77,7 @@ namespace ICSharpCode.NRefactory.CSharp } #region IRelocationable implementation - void IRelocatable.SetStartLocation (AstLocation startLocation) + void IRelocatable.SetStartLocation (TextLocation startLocation) { this.startLocation = startLocation; } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/QueryExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/QueryExpression.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/QueryExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/QueryExpression.cs index 214d312178..6280b676d8 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/QueryExpression.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/QueryExpression.cs @@ -104,7 +104,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole(Roles.Identifier, CSharp.Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(Roles.Identifier, CSharp.Identifier.Create (value, TextLocation.Empty)); } } @@ -139,7 +139,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole(Roles.Identifier, CSharp.Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(Roles.Identifier, CSharp.Identifier.Create (value, TextLocation.Empty)); } } @@ -176,7 +176,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole(Roles.Identifier).Name; } set { - SetChildByRole(Roles.Identifier, CSharp.Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(Roles.Identifier, CSharp.Identifier.Create (value, TextLocation.Empty)); } } @@ -264,7 +264,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole(JoinIdentifierRole).Name; } set { - SetChildByRole(JoinIdentifierRole, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(JoinIdentifierRole, Identifier.Create (value, TextLocation.Empty)); } } @@ -308,7 +308,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (IntoIdentifierRole).Name; } set { - SetChildByRole(IntoIdentifierRole, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(IntoIdentifierRole, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/SizeOfExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/SizeOfExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/SizeOfExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/SizeOfExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/StackAllocExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/StackAllocExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/StackAllocExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/StackAllocExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ThisReferenceExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ThisReferenceExpression.cs similarity index 89% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/ThisReferenceExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/ThisReferenceExpression.cs index 5428cf04b9..b874758b35 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ThisReferenceExpression.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ThisReferenceExpression.cs @@ -31,19 +31,19 @@ namespace ICSharpCode.NRefactory.CSharp /// public class ThisReferenceExpression : Expression { - public AstLocation Location { + public TextLocation Location { get; set; } - public override AstLocation StartLocation { + public override TextLocation StartLocation { get { return Location; } } - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { - return new AstLocation (Location.Line, Location.Column + "this".Length); + return new TextLocation (Location.Line, Location.Column + "this".Length); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/TypeOfExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/TypeOfExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/TypeOfExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/TypeOfExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/TypeReferenceExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/TypeReferenceExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/TypeReferenceExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/TypeReferenceExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/UnaryOperatorExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/UnaryOperatorExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/UnaryOperatorExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/UnaryOperatorExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/UncheckedExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/UncheckedExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/UncheckedExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/UncheckedExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Expressions/UndocumentedExpression.cs b/ICSharpCode.NRefactory.CSharp/Ast/Expressions/UndocumentedExpression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Expressions/UndocumentedExpression.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Expressions/UndocumentedExpression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Attribute.cs b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/Attribute.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Attribute.cs rename to ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/Attribute.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/AttributeSection.cs b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/AttributeSection.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/AttributeSection.cs rename to ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/AttributeSection.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Comment.cs b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/Comment.cs similarity index 83% rename from ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Comment.cs rename to ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/Comment.cs index 238bc38cad..7d3cbdaa0c 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Comment.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/Comment.cs @@ -55,15 +55,15 @@ namespace ICSharpCode.NRefactory.CSharp set; } - AstLocation startLocation; - public override AstLocation StartLocation { + TextLocation startLocation; + public override TextLocation StartLocation { get { return startLocation; } } - AstLocation endLocation; - public override AstLocation EndLocation { + TextLocation endLocation; + public override TextLocation EndLocation { get { return endLocation; } @@ -75,7 +75,7 @@ namespace ICSharpCode.NRefactory.CSharp this.Content = content; } - public Comment (CommentType commentType, AstLocation startLocation, AstLocation endLocation) + public Comment (CommentType commentType, TextLocation startLocation, TextLocation endLocation) { this.CommentType = commentType; this.startLocation = startLocation; @@ -83,10 +83,10 @@ namespace ICSharpCode.NRefactory.CSharp } #region IRelocationable implementation - void IRelocatable.SetStartLocation (AstLocation startLocation) + void IRelocatable.SetStartLocation (TextLocation startLocation) { int lineDelta = startLocation.Line - this.startLocation.Line; - endLocation = new AstLocation (endLocation.Line + lineDelta, lineDelta != 0 ? endLocation.Column : endLocation.Column + startLocation.Column - this.startLocation.Column); + endLocation = new TextLocation (endLocation.Line + lineDelta, lineDelta != 0 ? endLocation.Column : endLocation.Column + startLocation.Column - this.startLocation.Column); this.startLocation = startLocation; } #endregion diff --git a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Constraint.cs b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/Constraint.cs similarity index 98% rename from ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Constraint.cs rename to ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/Constraint.cs index 48c4e0ecb4..cac7230997 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Constraint.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/Constraint.cs @@ -1,4 +1,4 @@ -// +// // Constraint.cs // // Author: @@ -50,7 +50,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole(Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/DelegateDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/DelegateDeclaration.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/DelegateDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/DelegateDeclaration.cs index c33c0bf246..c6aebc4a4a 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/DelegateDeclaration.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/DelegateDeclaration.cs @@ -1,4 +1,4 @@ -// +// // DelegateDeclaration.cs // // Author: @@ -50,7 +50,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole (Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/ExternAliasDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/ExternAliasDeclaration.cs similarity index 98% rename from ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/ExternAliasDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/ExternAliasDeclaration.cs index 7d9a33df4f..2e4857498e 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/ExternAliasDeclaration.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/ExternAliasDeclaration.cs @@ -1,4 +1,4 @@ -// +// // ExternAliasDeclaration.cs // // Author: @@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole (Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/NamespaceDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/NamespaceDeclaration.cs similarity index 97% rename from ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/NamespaceDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/NamespaceDeclaration.cs index c580f3790c..5382033e46 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/NamespaceDeclaration.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/NamespaceDeclaration.cs @@ -1,4 +1,4 @@ -// +// // NamespaceDeclaration.cs // // Author: @@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.CSharp return builder.ToString (); } set { - GetChildrenByRole(Roles.Identifier).ReplaceWith(value.Split('.').Select(ident => Identifier.Create (ident, AstLocation.Empty))); + GetChildrenByRole(Roles.Identifier).ReplaceWith(value.Split('.').Select(ident => Identifier.Create (ident, TextLocation.Empty))); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/TypeDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/TypeDeclaration.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/TypeDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/TypeDeclaration.cs index 11db631be8..e828c7a76e 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/TypeDeclaration.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/TypeDeclaration.cs @@ -63,7 +63,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole (Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/TypeParameterDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/TypeParameterDeclaration.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/TypeParameterDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/TypeParameterDeclaration.cs index dbab9d5ec9..99184b7643 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/TypeParameterDeclaration.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/TypeParameterDeclaration.cs @@ -50,7 +50,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole(Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/UsingAliasDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/UsingAliasDeclaration.cs similarity index 92% rename from ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/UsingAliasDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/UsingAliasDeclaration.cs index 7fd3dfa096..5fc25031d1 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/UsingAliasDeclaration.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/UsingAliasDeclaration.cs @@ -1,4 +1,4 @@ -// +// // UsingAliasDeclaration.cs // // Author: @@ -49,7 +49,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (AliasRole).Name; } set { - SetChildByRole(AliasRole, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(AliasRole, Identifier.Create (value, TextLocation.Empty)); } } @@ -72,13 +72,13 @@ namespace ICSharpCode.NRefactory.CSharp public UsingAliasDeclaration (string alias, string nameSpace) { - AddChild (Identifier.Create (alias, AstLocation.Empty), AliasRole); + AddChild (Identifier.Create (alias, TextLocation.Empty), AliasRole); AddChild (new SimpleType (nameSpace), ImportRole); } public UsingAliasDeclaration (string alias, AstType import) { - AddChild (Identifier.Create (alias, AstLocation.Empty), AliasRole); + AddChild (Identifier.Create (alias, TextLocation.Empty), AliasRole); AddChild (import, ImportRole); } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/UsingDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/UsingDeclaration.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/UsingDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/UsingDeclaration.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/IAstVisitor.cs b/ICSharpCode.NRefactory.CSharp/Ast/IAstVisitor.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/IAstVisitor.cs rename to ICSharpCode.NRefactory.CSharp/Ast/IAstVisitor.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/IRelocatable.cs b/ICSharpCode.NRefactory.CSharp/Ast/IRelocatable.cs similarity index 95% rename from ICSharpCode.NRefactory/CSharp/Ast/IRelocatable.cs rename to ICSharpCode.NRefactory.CSharp/Ast/IRelocatable.cs index 48205191fc..cbb282a19c 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/IRelocatable.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/IRelocatable.cs @@ -1,4 +1,4 @@ -// +// // IRelocationable.cs // // Author: @@ -29,7 +29,7 @@ namespace ICSharpCode.NRefactory.CSharp { public interface IRelocatable { - void SetStartLocation (AstLocation startLocation); + void SetStartLocation (TextLocation startLocation); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Identifier.cs b/ICSharpCode.NRefactory.CSharp/Ast/Identifier.cs similarity index 81% rename from ICSharpCode.NRefactory/CSharp/Ast/Identifier.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Identifier.cs index ba6bbf612f..e95e36a90a 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Identifier.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Identifier.cs @@ -66,8 +66,8 @@ namespace ICSharpCode.NRefactory.CSharp } } - AstLocation startLocation; - public override AstLocation StartLocation { + TextLocation startLocation; + public override TextLocation StartLocation { get { return startLocation; } @@ -81,15 +81,15 @@ namespace ICSharpCode.NRefactory.CSharp } #region IRelocationable implementation - void IRelocatable.SetStartLocation (AstLocation startLocation) + void IRelocatable.SetStartLocation (TextLocation startLocation) { this.startLocation = startLocation; } #endregion - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { - return new AstLocation (StartLocation.Line, StartLocation.Column + (Name ?? "").Length); + return new TextLocation (StartLocation.Line, StartLocation.Column + (Name ?? "").Length); } } @@ -98,7 +98,7 @@ namespace ICSharpCode.NRefactory.CSharp this.name = string.Empty; } - protected Identifier (string name, AstLocation location) + protected Identifier (string name, TextLocation location) { if (name == null) throw new ArgumentNullException("name"); @@ -108,10 +108,10 @@ namespace ICSharpCode.NRefactory.CSharp public static Identifier Create (string name) { - return Create (name, AstLocation.Empty); + return Create (name, TextLocation.Empty); } - public static Identifier Create (string name, AstLocation location) + public static Identifier Create (string name, TextLocation location) { if (name == null) throw new ArgumentNullException("name"); @@ -120,7 +120,7 @@ namespace ICSharpCode.NRefactory.CSharp return new Identifier (name, location); } - public static Identifier Create (string name, AstLocation location, bool isVerbatim) + public static Identifier Create (string name, TextLocation location, bool isVerbatim) { if (name == null) throw new ArgumentNullException("name"); @@ -143,9 +143,9 @@ namespace ICSharpCode.NRefactory.CSharp class VerbatimIdentifier : Identifier { - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { - return new AstLocation (StartLocation.Line, StartLocation.Column + (Name ?? "").Length + 1); // @"..." + return new TextLocation (StartLocation.Line, StartLocation.Column + (Name ?? "").Length + 1); // @"..." } } @@ -155,7 +155,7 @@ namespace ICSharpCode.NRefactory.CSharp } } - public VerbatimIdentifier(string name, AstLocation location) : base (name, location) + public VerbatimIdentifier(string name, TextLocation location) : base (name, location) { } } diff --git a/ICSharpCode.NRefactory.CSharp/Ast/IdentifierExpressionBackreference.cs b/ICSharpCode.NRefactory.CSharp/Ast/IdentifierExpressionBackreference.cs new file mode 100644 index 0000000000..89da7231ce --- /dev/null +++ b/ICSharpCode.NRefactory.CSharp/Ast/IdentifierExpressionBackreference.cs @@ -0,0 +1,54 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// +// 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; +using System.Linq; +using ICSharpCode.NRefactory.PatternMatching; + +namespace ICSharpCode.NRefactory.CSharp +{ + /// + /// Matches identifier expressions that have the same identifier as the referenced variable/type definition/method definition. + /// + public class IdentifierExpressionBackreference : Pattern + { + readonly string referencedGroupName; + + public string ReferencedGroupName { + get { return referencedGroupName; } + } + + public IdentifierExpressionBackreference(string referencedGroupName) + { + if (referencedGroupName == null) + throw new ArgumentNullException("referencedGroupName"); + this.referencedGroupName = referencedGroupName; + } + + public override bool DoMatch(INode other, Match match) + { + CSharp.IdentifierExpression ident = other as CSharp.IdentifierExpression; + if (ident == null || ident.TypeArguments.Any()) + return false; + CSharp.AstNode referenced = (CSharp.AstNode)match.Get(referencedGroupName).Last(); + if (referenced == null) + return false; + return ident.Identifier == referenced.GetChildByRole(CSharp.AstNode.Roles.Identifier).Name; + } + } +} diff --git a/ICSharpCode.NRefactory/CSharp/Ast/MemberType.cs b/ICSharpCode.NRefactory.CSharp/Ast/MemberType.cs similarity index 97% rename from ICSharpCode.NRefactory/CSharp/Ast/MemberType.cs rename to ICSharpCode.NRefactory.CSharp/Ast/MemberType.cs index 771623eac5..dc16f98cc4 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/MemberType.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/MemberType.cs @@ -1,4 +1,4 @@ -// +// // FullTypeName.cs // // Author: @@ -47,7 +47,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole (Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } @@ -109,7 +109,7 @@ namespace ICSharpCode.NRefactory.CSharp b.Append(this.MemberName); if (this.TypeArguments.Any()) { b.Append('<'); - b.Append(DotNet35Compat.StringJoin(", ", this.TypeArguments)); + b.Append(string.Join(", ", this.TypeArguments)); b.Append('>'); } return b.ToString(); diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Modifiers.cs b/ICSharpCode.NRefactory.CSharp/Ast/Modifiers.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Modifiers.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Modifiers.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/NodeType.cs b/ICSharpCode.NRefactory.CSharp/Ast/NodeType.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/NodeType.cs rename to ICSharpCode.NRefactory.CSharp/Ast/NodeType.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/ObservableAstVisitor.cs b/ICSharpCode.NRefactory.CSharp/Ast/ObservableAstVisitor.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/ObservableAstVisitor.cs rename to ICSharpCode.NRefactory.CSharp/Ast/ObservableAstVisitor.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/PrimitiveType.cs b/ICSharpCode.NRefactory.CSharp/Ast/PrimitiveType.cs similarity index 85% rename from ICSharpCode.NRefactory/CSharp/Ast/PrimitiveType.cs rename to ICSharpCode.NRefactory.CSharp/Ast/PrimitiveType.cs index 26c93b21a7..85e2e723ae 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/PrimitiveType.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/PrimitiveType.cs @@ -32,7 +32,7 @@ namespace ICSharpCode.NRefactory.CSharp public class PrimitiveType : AstType, IRelocatable { public string Keyword { get; set; } - public AstLocation Location { get; set; } + public TextLocation Location { get; set; } public PrimitiveType() { @@ -43,26 +43,26 @@ namespace ICSharpCode.NRefactory.CSharp this.Keyword = keyword; } - public PrimitiveType(string keyword, AstLocation location) + public PrimitiveType(string keyword, TextLocation location) { this.Keyword = keyword; this.Location = location; } - public override AstLocation StartLocation { + public override TextLocation StartLocation { get { return Location; } } - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { - return new AstLocation (Location.Line, Location.Column + (Keyword != null ? Keyword.Length : 0)); + return new TextLocation (Location.Line, Location.Column + (Keyword != null ? Keyword.Length : 0)); } } #region IRelocationable implementation - void IRelocatable.SetStartLocation (AstLocation startLocation) + void IRelocatable.SetStartLocation (TextLocation startLocation) { this.Location = startLocation; } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/SimpleType.cs b/ICSharpCode.NRefactory.CSharp/Ast/SimpleType.cs similarity index 94% rename from ICSharpCode.NRefactory/CSharp/Ast/SimpleType.cs rename to ICSharpCode.NRefactory.CSharp/Ast/SimpleType.cs index 2609473e71..cf451339c3 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/SimpleType.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/SimpleType.cs @@ -1,4 +1,4 @@ -// +// // FullTypeName.cs // // Author: @@ -42,7 +42,7 @@ namespace ICSharpCode.NRefactory.CSharp this.Identifier = identifier; } - public SimpleType(string identifier, AstLocation location) + public SimpleType(string identifier, TextLocation location) { SetChildByRole (Roles.Identifier, CSharp.Identifier.Create (identifier, location)); } @@ -64,7 +64,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole (Roles.Identifier, CSharp.Identifier.Create (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, CSharp.Identifier.Create (value, TextLocation.Empty)); } } @@ -97,7 +97,7 @@ namespace ICSharpCode.NRefactory.CSharp StringBuilder b = new StringBuilder(this.Identifier); if (this.TypeArguments.Any()) { b.Append('<'); - b.Append(DotNet35Compat.StringJoin(", ", this.TypeArguments)); + b.Append(string.Join(", ", this.TypeArguments)); b.Append('>'); } return b.ToString(); diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/BlockStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/BlockStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/BlockStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/BlockStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/BreakStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/BreakStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/BreakStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/BreakStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/CheckedStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/CheckedStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/CheckedStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/CheckedStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/ContinueStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/ContinueStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/ContinueStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/ContinueStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/DoWhileStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/DoWhileStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/DoWhileStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/DoWhileStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/EmptyStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/EmptyStatement.cs similarity index 87% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/EmptyStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/EmptyStatement.cs index c75adbec68..e8c460913e 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Statements/EmptyStatement.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Statements/EmptyStatement.cs @@ -1,4 +1,4 @@ -// +// // EmptyStatement.cs // // Author: @@ -31,25 +31,25 @@ namespace ICSharpCode.NRefactory.CSharp /// public class EmptyStatement : Statement, IRelocatable { - public AstLocation Location { + public TextLocation Location { get; set; } - public override AstLocation StartLocation { + public override TextLocation StartLocation { get { return Location; } } - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { - return new AstLocation (Location.Line, Location.Column); + return new TextLocation (Location.Line, Location.Column); } } #region IRelocationable implementation - void IRelocatable.SetStartLocation (AstLocation startLocation) + void IRelocatable.SetStartLocation (TextLocation startLocation) { this.Location = startLocation; } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/ExpressionStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/ExpressionStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/ExpressionStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/ExpressionStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/FixedStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/FixedStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/FixedStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/FixedStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/ForStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/ForStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/ForStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/ForStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/ForeachStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/ForeachStatement.cs similarity index 97% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/ForeachStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/ForeachStatement.cs index 52be5da59a..c9791bd5d8 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Statements/ForeachStatement.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Statements/ForeachStatement.cs @@ -1,4 +1,4 @@ -// +// // ForeachStatement.cs // // Author: @@ -49,7 +49,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole(Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/GotoStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/GotoStatement.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/GotoStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/GotoStatement.cs index 0bcc5e2388..c7d57644f4 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Statements/GotoStatement.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Statements/GotoStatement.cs @@ -1,4 +1,4 @@ -// +// // GotoStatement.cs // // Author: @@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.CSharp if (string.IsNullOrEmpty(value)) SetChildByRole(Roles.Identifier, null); else - SetChildByRole(Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/IfElseStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/IfElseStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/IfElseStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/IfElseStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/LabelStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/LabelStatement.cs similarity index 98% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/LabelStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/LabelStatement.cs index b23c80a4c2..81a9a186f5 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Statements/LabelStatement.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Statements/LabelStatement.cs @@ -1,4 +1,4 @@ -// +// // LabelStatement.cs // // Author: @@ -36,7 +36,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole(Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole(Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/LockStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/LockStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/LockStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/LockStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/ReturnStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/ReturnStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/ReturnStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/ReturnStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/Statement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/Statement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/Statement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/Statement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/SwitchStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/SwitchStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/SwitchStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/SwitchStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/ThrowStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/ThrowStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/ThrowStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/ThrowStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/TryCatchStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/TryCatchStatement.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/TryCatchStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/TryCatchStatement.cs index 77ef45e6b2..e6cc8a48f9 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/Statements/TryCatchStatement.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Statements/TryCatchStatement.cs @@ -1,4 +1,4 @@ -// +// // TryCatchStatement.cs // // Author: @@ -140,7 +140,7 @@ namespace ICSharpCode.NRefactory.CSharp if (string.IsNullOrEmpty(value)) SetChildByRole (Roles.Identifier, null); else - SetChildByRole (Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/UncheckedStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/UncheckedStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/UncheckedStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/UncheckedStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/UnsafeStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/UnsafeStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/UnsafeStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/UnsafeStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/UsingStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/UsingStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/UsingStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/UsingStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/VariableDeclarationStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/VariableDeclarationStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/VariableDeclarationStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/VariableDeclarationStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/WhileStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/WhileStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/WhileStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/WhileStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/YieldBreakStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/YieldBreakStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/YieldBreakStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/YieldBreakStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Statements/YieldStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/YieldStatement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Statements/YieldStatement.cs rename to ICSharpCode.NRefactory.CSharp/Ast/Statements/YieldStatement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/Accessor.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/Accessor.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/Accessor.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/Accessor.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/AttributedNode.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/AttributedNode.cs similarity index 97% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/AttributedNode.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/AttributedNode.cs index 9b34171fe6..f854c594a7 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/AttributedNode.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/AttributedNode.cs @@ -57,7 +57,7 @@ namespace ICSharpCode.NRefactory.CSharp if ((m & newValue) != 0) { if ((m & oldValue) == 0) { // Modifier was added - var newToken = new CSharpModifierToken(AstLocation.Empty, m); + var newToken = new CSharpModifierToken(TextLocation.Empty, m); node.InsertChildAfter(insertionPos, newToken, ModifierRole); insertionPos = newToken; } else { diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/ConstructorDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/ConstructorDeclaration.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/ConstructorDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/ConstructorDeclaration.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/DestructorDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/DestructorDeclaration.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/DestructorDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/DestructorDeclaration.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/EnumMemberDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EnumMemberDeclaration.cs similarity index 98% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/EnumMemberDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EnumMemberDeclaration.cs index 8c31562983..286800cbe3 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/EnumMemberDeclaration.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EnumMemberDeclaration.cs @@ -1,4 +1,4 @@ -// +// // EnumMemberDeclaration.cs // // Author: @@ -36,7 +36,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole (Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/EventDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EventDeclaration.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/EventDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EventDeclaration.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/FieldDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/FieldDeclaration.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/FieldDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/FieldDeclaration.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/FixedFieldDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/FixedFieldDeclaration.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/FixedFieldDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/FixedFieldDeclaration.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/FixedVariableInitializer.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/FixedVariableInitializer.cs similarity index 98% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/FixedVariableInitializer.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/FixedVariableInitializer.cs index 1d5d9da935..d6dbaf91a2 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/FixedVariableInitializer.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/FixedVariableInitializer.cs @@ -1,4 +1,4 @@ -// +// // FixedFieldDeclaration.cs // // Author: @@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole (Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/IndexerDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/IndexerDeclaration.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/IndexerDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/IndexerDeclaration.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/MemberDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/MemberDeclaration.cs similarity index 98% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/MemberDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/MemberDeclaration.cs index f2fd816830..e1463c0771 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/MemberDeclaration.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/MemberDeclaration.cs @@ -1,4 +1,4 @@ -// +// // AbstractMember.cs // // Author: @@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole (Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/MethodDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/MethodDeclaration.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/MethodDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/MethodDeclaration.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/OperatorDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/OperatorDeclaration.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/OperatorDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/OperatorDeclaration.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/ParameterDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/ParameterDeclaration.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/ParameterDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/ParameterDeclaration.cs index 287611ef69..8641a72277 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/ParameterDeclaration.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/ParameterDeclaration.cs @@ -1,4 +1,4 @@ -// +// // ParameterDeclarationExpression.cs // // Author: @@ -68,7 +68,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole (Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/PropertyDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/PropertyDeclaration.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/PropertyDeclaration.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/PropertyDeclaration.cs diff --git a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/VariableInitializer.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/VariableInitializer.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/VariableInitializer.cs rename to ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/VariableInitializer.cs index 18d42e08a3..8ebfc938d6 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/VariableInitializer.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/VariableInitializer.cs @@ -85,7 +85,7 @@ namespace ICSharpCode.NRefactory.CSharp return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole (Roles.Identifier, Identifier.Create (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, Identifier.Create (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory/CSharp/Formatter/AstFormattingVisitor.cs b/ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Formatter/AstFormattingVisitor.cs rename to ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs index 20e4bbfbf7..99b8f67a3e 100644 --- a/ICSharpCode.NRefactory/CSharp/Formatter/AstFormattingVisitor.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs @@ -270,7 +270,7 @@ namespace ICSharpCode.NRefactory.CSharp { if (n == null) return; - AstLocation location = n.EndLocation; + TextLocation location = n.EndLocation; int offset = data.LocationToOffset (location.Line, location.Column); if (location.Column > data.GetEditableLength (location.Line)) return; @@ -301,7 +301,7 @@ namespace ICSharpCode.NRefactory.CSharp { if (n == null || n.IsNull) return 0; - AstLocation location = n.StartLocation; + TextLocation location = n.StartLocation; // respect manual line breaks. if (location.Column <= 1 || data.GetIndentation (location.Line).Length == location.Column - 1) return 0; @@ -971,7 +971,7 @@ namespace ICSharpCode.NRefactory.CSharp changes.Add (factory.CreateTextReplaceAction (offset, removedChars, insertedText)); } - public bool IsLineIsEmptyUpToEol (AstLocation startLocation) + public bool IsLineIsEmptyUpToEol (TextLocation startLocation) { return IsLineIsEmptyUpToEol (data.LocationToOffset (startLocation.Line, startLocation.Column) - 1); } @@ -1547,7 +1547,7 @@ namespace ICSharpCode.NRefactory.CSharp string nextStatementIndent = null; - void FixStatementIndentation (AstLocation location) + void FixStatementIndentation (TextLocation location) { int offset = data.LocationToOffset (location.Line, location.Column); if (offset <= 0) { @@ -1562,12 +1562,12 @@ namespace ICSharpCode.NRefactory.CSharp AddChange (lineStart, offset - lineStart, indentString); } - void FixIndentation (AstLocation location) + void FixIndentation (TextLocation location) { FixIndentation (location, 0); } - void FixIndentation (AstLocation location, int relOffset) + void FixIndentation (TextLocation location, int relOffset) { if (location.Line < 1 || location.Line > data.LineCount) { Console.WriteLine ("Invalid location " + location); @@ -1582,7 +1582,7 @@ namespace ICSharpCode.NRefactory.CSharp } } - void FixIndentationForceNewLine (AstLocation location) + void FixIndentationForceNewLine (TextLocation location) { string lineIndent = data.GetIndentation (location.Line); string indentString = this.curIndent.IndentString; diff --git a/ICSharpCode.NRefactory/CSharp/Formatter/CSharpFormattingOptions.cs b/ICSharpCode.NRefactory.CSharp/Formatter/CSharpFormattingOptions.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Formatter/CSharpFormattingOptions.cs rename to ICSharpCode.NRefactory.CSharp/Formatter/CSharpFormattingOptions.cs diff --git a/ICSharpCode.NRefactory/CSharp/Formatter/ITextEditorAdapter.cs b/ICSharpCode.NRefactory.CSharp/Formatter/ITextEditorAdapter.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Formatter/ITextEditorAdapter.cs rename to ICSharpCode.NRefactory.CSharp/Formatter/ITextEditorAdapter.cs diff --git a/ICSharpCode.NRefactory/CSharp/Formatter/Indent.cs b/ICSharpCode.NRefactory.CSharp/Formatter/Indent.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Formatter/Indent.cs rename to ICSharpCode.NRefactory.CSharp/Formatter/Indent.cs diff --git a/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj b/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj new file mode 100644 index 0000000000..47cf572d96 --- /dev/null +++ b/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj @@ -0,0 +1,323 @@ + + + + {53DCA265-3C3C-42F9-B647-F72BA678122B} + Debug + x86 + Library + ICSharpCode.NRefactory.CSharp + ICSharpCode.NRefactory.CSharp + v4.0 + Client + Properties + False + False + 4 + false + + + x86 + False + Auto + 4194304 + 4096 + + + bin\Debug\ + true + Full + False + True + DEBUG;TRACE;FULL_AST + + + bin\Release\ + false + None + True + False + TRACE;FULL_AST + + + + + 3.5 + + + + 3.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} + ICSharpCode.NRefactory + + + + \ No newline at end of file diff --git a/ICSharpCode.NRefactory/CSharp/OutputVisitor/IOutputFormatter.cs b/ICSharpCode.NRefactory.CSharp/OutputVisitor/IOutputFormatter.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/OutputVisitor/IOutputFormatter.cs rename to ICSharpCode.NRefactory.CSharp/OutputVisitor/IOutputFormatter.cs diff --git a/ICSharpCode.NRefactory/CSharp/OutputVisitor/InsertParenthesesVisitor.cs b/ICSharpCode.NRefactory.CSharp/OutputVisitor/InsertParenthesesVisitor.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/OutputVisitor/InsertParenthesesVisitor.cs rename to ICSharpCode.NRefactory.CSharp/OutputVisitor/InsertParenthesesVisitor.cs diff --git a/ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs b/ICSharpCode.NRefactory.CSharp/OutputVisitor/OutputVisitor.cs similarity index 97% rename from ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs rename to ICSharpCode.NRefactory.CSharp/OutputVisitor/OutputVisitor.cs index cf5e9e2c84..123f053187 100644 --- a/ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs +++ b/ICSharpCode.NRefactory.CSharp/OutputVisitor/OutputVisitor.cs @@ -32,7 +32,7 @@ namespace ICSharpCode.NRefactory.CSharp /// /// Outputs the AST. /// - public class OutputVisitor : IAstVisitor, IPatternAstVisitor + public class OutputVisitor : IAstVisitor { readonly IOutputFormatter formatter; readonly CSharpFormattingOptions policy; @@ -258,7 +258,7 @@ namespace ICSharpCode.NRefactory.CSharp WriteToken ("[", AstNode.Roles.LBracket); if (list.Any ()) { Space (spaceWithin); - WriteCommaSeparatedList (list.SafeCast ()); + WriteCommaSeparatedList (list); Space (spaceWithin); } WriteToken ("]", AstNode.Roles.RBracket); @@ -269,7 +269,7 @@ namespace ICSharpCode.NRefactory.CSharp WriteToken ("[", AstNode.Roles.LBracket); if (list.Any ()) { Space (policy.SpacesWithinBrackets); - WriteCommaSeparatedList (list.SafeCast ()); + WriteCommaSeparatedList (list); Space (policy.SpacesWithinBrackets); } WriteToken ("]", AstNode.Roles.RBracket); @@ -437,7 +437,7 @@ namespace ICSharpCode.NRefactory.CSharp { if (typeParameters.Any ()) { WriteToken ("<", AstNode.Roles.LChevron); - WriteCommaSeparatedList (typeParameters.SafeCast ()); + WriteCommaSeparatedList (typeParameters); WriteToken (">", AstNode.Roles.RChevron); } } @@ -1237,7 +1237,7 @@ namespace ICSharpCode.NRefactory.CSharp StartNode (queryOrderClause); WriteKeyword ("orderby"); Space (); - WriteCommaSeparatedList (queryOrderClause.Orderings.SafeCast ()); + WriteCommaSeparatedList (queryOrderClause.Orderings); return EndNode (queryOrderClause); } @@ -1302,7 +1302,7 @@ namespace ICSharpCode.NRefactory.CSharp WriteToken (":", AttributeSection.Roles.Colon); Space (); } - WriteCommaSeparatedList (attributeSection.Attributes.SafeCast ()); + WriteCommaSeparatedList (attributeSection.Attributes); WriteToken ("]", AstNode.Roles.RBracket); if (attributeSection.Parent is ParameterDeclaration || attributeSection.Parent is TypeParameterDeclaration) Space (); @@ -1571,7 +1571,7 @@ namespace ICSharpCode.NRefactory.CSharp LPar (); Space (policy.SpacesWithinForParentheses); - WriteCommaSeparatedList (forStatement.Initializers.SafeCast ()); + WriteCommaSeparatedList (forStatement.Initializers); Space (policy.SpaceBeforeForSemicolon); WriteToken (";", AstNode.Roles.Semicolon); Space (policy.SpaceAfterForSemicolon); @@ -1581,7 +1581,7 @@ namespace ICSharpCode.NRefactory.CSharp WriteToken (";", AstNode.Roles.Semicolon); Space (policy.SpaceAfterForSemicolon); - WriteCommaSeparatedList (forStatement.Iterators.SafeCast ()); + WriteCommaSeparatedList (forStatement.Iterators); Space (policy.SpacesWithinForParentheses); RPar (); @@ -2300,39 +2300,35 @@ namespace ICSharpCode.NRefactory.CSharp public object VisitPatternPlaceholder (AstNode placeholder, PatternMatching.Pattern pattern, object data) { StartNode (placeholder); - pattern.AcceptVisitor (this, data); + VisitNodeInPattern(pattern, data); return EndNode (placeholder); } - object IPatternAstVisitor.VisitAnyNode (AnyNode anyNode, object data) + void VisitAnyNode (AnyNode anyNode, object data) { if (!string.IsNullOrEmpty (anyNode.GroupName)) { WriteIdentifier (anyNode.GroupName); WriteToken (":", AstNode.Roles.Colon); } - WriteKeyword ("anyNode"); - return null; } - object IPatternAstVisitor.VisitBackreference (Backreference backreference, object data) + void VisitBackreference (Backreference backreference, object data) { WriteKeyword ("backreference"); LPar (); WriteIdentifier (backreference.ReferencedGroupName); RPar (); - return null; } - object IPatternAstVisitor.VisitIdentifierExpressionBackreference (IdentifierExpressionBackreference identifierExpressionBackreference, object data) + void VisitIdentifierExpressionBackreference (IdentifierExpressionBackreference identifierExpressionBackreference, object data) { WriteKeyword ("identifierBackreference"); LPar (); WriteIdentifier (identifierExpressionBackreference.ReferencedGroupName); RPar (); - return null; } - object IPatternAstVisitor.VisitChoice (Choice choice, object data) + void VisitChoice (Choice choice, object data) { WriteKeyword ("choice"); Space (); @@ -2347,20 +2343,18 @@ namespace ICSharpCode.NRefactory.CSharp } formatter.Unindent (); RPar (); - return null; } - object IPatternAstVisitor.VisitNamedNode (NamedNode namedNode, object data) + void VisitNamedNode (NamedNode namedNode, object data) { if (!string.IsNullOrEmpty (namedNode.GroupName)) { WriteIdentifier (namedNode.GroupName); WriteToken (":", AstNode.Roles.Colon); } VisitNodeInPattern (namedNode.ChildNode, data); - return null; } - object IPatternAstVisitor.VisitRepeat (Repeat repeat, object data) + void VisitRepeat (Repeat repeat, object data) { WriteKeyword ("repeat"); LPar (); @@ -2372,30 +2366,34 @@ namespace ICSharpCode.NRefactory.CSharp } VisitNodeInPattern (repeat.ChildNode, data); RPar (); - return null; } - object IPatternAstVisitor.VisitOptionalNode (OptionalNode optionalNode, object data) + void VisitOptionalNode (OptionalNode optionalNode, object data) { WriteKeyword ("optional"); LPar (); VisitNodeInPattern (optionalNode.ChildNode, data); RPar (); - return null; } void VisitNodeInPattern (INode childNode, object data) { - AstNode astNode = childNode as AstNode; - if (astNode != null) { - astNode.AcceptVisitor (this, data); + if (childNode is AstNode) { + ((AstNode)childNode).AcceptVisitor(this, data); + } else if (childNode is IdentifierExpressionBackreference) { + VisitIdentifierExpressionBackreference((IdentifierExpressionBackreference)childNode, data); + } else if (childNode is Choice) { + VisitChoice((Choice)childNode, data); + } else if (childNode is AnyNode) { + VisitAnyNode((AnyNode)childNode, data); + } else if (childNode is Backreference) { + VisitBackreference((Backreference)childNode, data); + } else if (childNode is NamedNode) { + VisitNamedNode((NamedNode)childNode, data); + } else if (childNode is OptionalNode) { + VisitOptionalNode((OptionalNode)childNode, data); } else { - Pattern pattern = childNode as Pattern; - if (pattern != null) { - pattern.AcceptVisitor (this, data); - } else { - throw new InvalidOperationException ("Unknown node type in pattern"); - } + throw new InvalidOperationException ("Unknown node type in pattern"); } } #endregion diff --git a/ICSharpCode.NRefactory/CSharp/OutputVisitor/TextWriterOutputFormatter.cs b/ICSharpCode.NRefactory.CSharp/OutputVisitor/TextWriterOutputFormatter.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/OutputVisitor/TextWriterOutputFormatter.cs rename to ICSharpCode.NRefactory.CSharp/OutputVisitor/TextWriterOutputFormatter.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs rename to ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index 0d0ff8bd22..22bf05f09b 100644 --- a/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -61,9 +61,9 @@ namespace ICSharpCode.NRefactory.CSharp this.LocationsBag = locationsBag; } - public static AstLocation Convert (Mono.CSharp.Location loc) + public static TextLocation Convert (Mono.CSharp.Location loc) { - return new AstLocation (loc.Row, loc.Column); + return new TextLocation (loc.Row, loc.Column); } @@ -1824,7 +1824,7 @@ namespace ICSharpCode.NRefactory.CSharp result.Target = new SimpleType (qualifiedAliasMember.alias, Convert (qualifiedAliasMember.Location)); result.IsDoubleColon = true; var location = LocationsBag.GetLocations (qualifiedAliasMember); - result.AddChild (Identifier.Create (qualifiedAliasMember.Name, location != null ? Convert (location[0]) : AstLocation.Empty), MemberReferenceExpression.Roles.Identifier); + result.AddChild (Identifier.Create (qualifiedAliasMember.Name, location != null ? Convert (location[0]) : TextLocation.Empty), MemberReferenceExpression.Roles.Identifier); return new TypeReferenceExpression () { Type = result }; } @@ -3076,8 +3076,8 @@ namespace ICSharpCode.NRefactory.CSharp if (conversionVisitor.convertTypeSystemMode && (comment.CommentType != SpecialsBag.CommentType.Documentation)) continue; var type = (CommentType)comment.CommentType; - var start = new AstLocation (comment.Line, comment.Col); - var end = new AstLocation (comment.EndLine, comment.EndCol); + var start = new TextLocation (comment.Line, comment.Col); + var end = new TextLocation (comment.EndLine, comment.EndCol); var domComment = new Comment (type, start, end); domComment.StartsLine = comment.StartsLine; domComment.Content = comment.Content; @@ -3170,7 +3170,7 @@ namespace ICSharpCode.NRefactory.CSharp public static void AdjustLineLocations (AstNode node, int line) { if (node is IRelocatable) { - ((IRelocatable)node).SetStartLocation (new AstLocation (node.StartLocation.Line + line, node.StartLocation.Column)); + ((IRelocatable)node).SetStartLocation (new TextLocation (node.StartLocation.Line + line, node.StartLocation.Column)); } foreach (var child in node.Children) { AdjustLineLocations (child, line); diff --git a/ICSharpCode.NRefactory/CSharp/Parser/ParsedFile.cs b/ICSharpCode.NRefactory.CSharp/Parser/ParsedFile.cs similarity index 93% rename from ICSharpCode.NRefactory/CSharp/Parser/ParsedFile.cs rename to ICSharpCode.NRefactory.CSharp/Parser/ParsedFile.cs index 984edaa2a9..1483d73b67 100644 --- a/ICSharpCode.NRefactory/CSharp/Parser/ParsedFile.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/ParsedFile.cs @@ -101,7 +101,7 @@ namespace ICSharpCode.NRefactory.CSharp get { return moduleAttributes; } } - public UsingScope GetUsingScope(AstLocation location) + public UsingScope GetUsingScope(TextLocation location) { foreach (UsingScope scope in usingScopes) { if (scope.Region.IsInside(location.Line, location.Column)) @@ -110,12 +110,12 @@ namespace ICSharpCode.NRefactory.CSharp return rootUsingScope; } - public ITypeDefinition GetTopLevelTypeDefinition(AstLocation location) + public ITypeDefinition GetTopLevelTypeDefinition(TextLocation location) { return FindEntity(topLevelTypeDefinitions, location); } - public ITypeDefinition GetInnermostTypeDefinition(AstLocation location) + public ITypeDefinition GetInnermostTypeDefinition(TextLocation location) { ITypeDefinition parent = null; ITypeDefinition type = GetTopLevelTypeDefinition(location); @@ -126,7 +126,7 @@ namespace ICSharpCode.NRefactory.CSharp return parent; } - public IMember GetMember(AstLocation location) + public IMember GetMember(TextLocation location) { ITypeDefinition type = GetInnermostTypeDefinition(location); if (type == null) @@ -137,7 +137,7 @@ namespace ICSharpCode.NRefactory.CSharp ?? (IMember)FindEntity(type.Events, location); } - static T FindEntity(IList list, AstLocation location) where T : class, IEntity + static T FindEntity(IList list, TextLocation location) where T : class, IEntity { // This could be improved using a binary search foreach (T entity in list) { diff --git a/ICSharpCode.NRefactory/CSharp/Parser/TypeSystemConvertVisitor.cs b/ICSharpCode.NRefactory.CSharp/Parser/TypeSystemConvertVisitor.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Parser/TypeSystemConvertVisitor.cs rename to ICSharpCode.NRefactory.CSharp/Parser/TypeSystemConvertVisitor.cs index 06103ada65..259d14697b 100644 --- a/ICSharpCode.NRefactory/CSharp/Parser/TypeSystemConvertVisitor.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/TypeSystemConvertVisitor.cs @@ -90,7 +90,7 @@ namespace ICSharpCode.NRefactory.CSharp get { return parsedFile; } } - DomRegion MakeRegion(AstLocation start, AstLocation end) + DomRegion MakeRegion(TextLocation start, TextLocation end) { return new DomRegion(parsedFile.FileName, start.Line, start.Column, end.Line, end.Column); } @@ -172,7 +172,8 @@ namespace ICSharpCode.NRefactory.CSharp DefaultTypeDefinition newType; if (currentTypeDefinition != null) { newType = new DefaultTypeDefinition(currentTypeDefinition, name); - newType.TypeParameters.AddRange(currentTypeDefinition.TypeParameters); + foreach (var typeParameter in currentTypeDefinition.TypeParameters) + newType.TypeParameters.Add(typeParameter); currentTypeDefinition.NestedTypes.Add(newType); } else { newType = new DefaultTypeDefinition(parsedFile, usingScope.NamespaceName, name); @@ -287,7 +288,8 @@ namespace ICSharpCode.NRefactory.CSharp DefaultMethod invoke = new DefaultMethod(delegateType, "Invoke"); invoke.Accessibility = Accessibility.Public; invoke.IsSynthetic = true; - invoke.Parameters.AddRange(parameters); + foreach (var p in parameters) + invoke.Parameters.Add(p); invoke.ReturnType = returnType; invoke.Region = region; delegateType.Methods.Add(invoke); @@ -295,7 +297,8 @@ namespace ICSharpCode.NRefactory.CSharp DefaultMethod beginInvoke = new DefaultMethod(delegateType, "BeginInvoke"); beginInvoke.Accessibility = Accessibility.Public; beginInvoke.IsSynthetic = true; - beginInvoke.Parameters.AddRange(invoke.Parameters); + foreach (var p in parameters) + beginInvoke.Parameters.Add(p); beginInvoke.Parameters.Add(delegateAsyncCallbackParameter); beginInvoke.Parameters.Add(delegateObjectParameter); beginInvoke.ReturnType = delegateResultParameter.Type; diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/AssemblyInfo.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/AssemblyInfo.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/AssemblyInfo.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/AssemblyInfo.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/ChangeLog b/ICSharpCode.NRefactory.CSharp/Parser/mcs/ChangeLog similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/ChangeLog rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/ChangeLog diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/CryptoConvert.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/CryptoConvert.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/CryptoConvert.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/CryptoConvert.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/Makefile b/ICSharpCode.NRefactory.CSharp/Parser/mcs/Makefile similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/Makefile rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/Makefile diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/MonoSymbolFile.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolFile.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/MonoSymbolFile.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolFile.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/MonoSymbolTable.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolTable.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/MonoSymbolTable.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolTable.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/MonoSymbolWriter.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolWriter.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/MonoSymbolWriter.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolWriter.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/NOTES b/ICSharpCode.NRefactory.CSharp/Parser/mcs/NOTES similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/NOTES rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/NOTES diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/OPTIMIZE b/ICSharpCode.NRefactory.CSharp/Parser/mcs/OPTIMIZE similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/OPTIMIZE rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/OPTIMIZE diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/OTODO b/ICSharpCode.NRefactory.CSharp/Parser/mcs/OTODO similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/OTODO rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/OTODO diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/PLAN b/ICSharpCode.NRefactory.CSharp/Parser/mcs/PLAN similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/PLAN rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/PLAN diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/README b/ICSharpCode.NRefactory.CSharp/Parser/mcs/README similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/README rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/README diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/TODO b/ICSharpCode.NRefactory.CSharp/Parser/mcs/TODO similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/TODO rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/TODO diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/anonymous.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/anonymous.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/argument.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/argument.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/argument.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/argument.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/assembly.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/assembly.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/assembly.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/assembly.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/assign.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/assign.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/assign.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/assign.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/async.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/async.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/attribute.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/attribute.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/cfold.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cfold.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/cfold.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/cfold.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/class.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/class.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/class.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/class.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/codegen.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/codegen.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/codegen.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/codegen.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/compiler.doc b/ICSharpCode.NRefactory.CSharp/Parser/mcs/compiler.doc similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/compiler.doc rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/compiler.doc diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/complete.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/complete.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/complete.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/complete.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/const.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/const.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/const.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/const.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/constant.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/constant.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/constant.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/constant.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/context.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/context.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/context.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/context.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/convert.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/convert.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/convert.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/convert.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/cs-parser.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/cs-parser.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/cs-parser.jay b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/cs-parser.jay rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/cs-tokenizer.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/cs-tokenizer.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/decl.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/decl.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs index 0329cf6a50..0ad375d282 100644 --- a/ICSharpCode.NRefactory/CSharp/Parser/mcs/decl.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs @@ -27,7 +27,6 @@ using IKVM.Reflection.Emit; #else using System.Reflection; using System.Reflection.Emit; -using Mono.Collections.Generic; #endif namespace Mono.CSharp { diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/delegate.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/delegate.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/delegate.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/delegate.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/dmcs.csproj b/ICSharpCode.NRefactory.CSharp/Parser/mcs/dmcs.csproj similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/dmcs.csproj rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/dmcs.csproj diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/dmcs.exe.config b/ICSharpCode.NRefactory.CSharp/Parser/mcs/dmcs.exe.config similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/dmcs.exe.config rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/dmcs.exe.config diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/dmcs.exe.sources b/ICSharpCode.NRefactory.CSharp/Parser/mcs/dmcs.exe.sources similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/dmcs.exe.sources rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/dmcs.exe.sources diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/dmcs.sln b/ICSharpCode.NRefactory.CSharp/Parser/mcs/dmcs.sln similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/dmcs.sln rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/dmcs.sln diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/doc-bootstrap.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/doc-bootstrap.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/doc-bootstrap.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/doc-bootstrap.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/doc.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/doc.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/doc.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/doc.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/driver.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/driver.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/dynamic.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/dynamic.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/ecore.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/ecore.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/enum.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/enum.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/enum.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/enum.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/eval.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/eval.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/eval.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/eval.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/expression.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/expression.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/field.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/field.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/field.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/field.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/flowanalysis.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/flowanalysis.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/flowanalysis.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/flowanalysis.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/generic.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/generic.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/gmcs.csproj b/ICSharpCode.NRefactory.CSharp/Parser/mcs/gmcs.csproj similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/gmcs.csproj rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/gmcs.csproj diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/gmcs.exe.config b/ICSharpCode.NRefactory.CSharp/Parser/mcs/gmcs.exe.config similarity index 96% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/gmcs.exe.config rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/gmcs.exe.config index fe1df560aa..4b560e2f7a 100644 --- a/ICSharpCode.NRefactory/CSharp/Parser/mcs/gmcs.exe.config +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/gmcs.exe.config @@ -1,14 +1,14 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/gmcs.exe.sources b/ICSharpCode.NRefactory.CSharp/Parser/mcs/gmcs.exe.sources similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/gmcs.exe.sources rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/gmcs.exe.sources diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/gmcs.sln b/ICSharpCode.NRefactory.CSharp/Parser/mcs/gmcs.sln similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/gmcs.sln rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/gmcs.sln diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/gmcs.userprefs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/gmcs.userprefs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/gmcs.userprefs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/gmcs.userprefs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/gmcs2.csproj b/ICSharpCode.NRefactory.CSharp/Parser/mcs/gmcs2.csproj similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/gmcs2.csproj rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/gmcs2.csproj diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/hosting.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/hosting.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/hosting.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/hosting.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/import.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/import.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/iterators.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/iterators.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/iterators.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/iterators.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/lambda.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/lambda.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/lambda.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/lambda.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/lambda.todo b/ICSharpCode.NRefactory.CSharp/Parser/mcs/lambda.todo similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/lambda.todo rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/lambda.todo diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/linq.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/linq.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/linq.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/linq.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/literal.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/literal.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/literal.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/literal.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/location.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/location.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/membercache.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/membercache.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/method.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/method.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/modifiers.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/modifiers.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/modifiers.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/modifiers.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/namespace.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/namespace.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/nullable.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/nullable.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/outline.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/outline.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/outline.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/outline.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/parameter.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/parameter.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/parameter.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/parameter.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/pending.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/pending.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/pending.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/pending.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/property.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/property.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/property.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/property.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/reflection.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/reflection.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/reflection.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/reflection.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/repl.txt b/ICSharpCode.NRefactory.CSharp/Parser/mcs/repl.txt similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/repl.txt rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/repl.txt diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/report.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/report.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/report.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/report.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/rootcontext.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/rootcontext.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/rootcontext.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/rootcontext.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/roottypes.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/roottypes.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/roottypes.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/roottypes.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/smcs.exe.sources b/ICSharpCode.NRefactory.CSharp/Parser/mcs/smcs.exe.sources similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/smcs.exe.sources rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/smcs.exe.sources diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/smcs.exe.sources-xml b/ICSharpCode.NRefactory.CSharp/Parser/mcs/smcs.exe.sources-xml similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/smcs.exe.sources-xml rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/smcs.exe.sources-xml diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/statement.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/statement.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/support.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/support.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/support.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/support.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/symbolwriter.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/symbolwriter.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/symbolwriter.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/symbolwriter.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/typemanager.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/typemanager.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/typemanager.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/typemanager.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/typespec.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/typespec.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/typespec.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/typespec.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/visit.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/visit.cs rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs diff --git a/ICSharpCode.NRefactory/CSharp/Parser/mcs/y.output b/ICSharpCode.NRefactory.CSharp/Parser/mcs/y.output similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Parser/mcs/y.output rename to ICSharpCode.NRefactory.CSharp/Parser/mcs/y.output diff --git a/ICSharpCode.NRefactory.CSharp/Properties/AssemblyInfo.cs b/ICSharpCode.NRefactory.CSharp/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..0d277c77fa --- /dev/null +++ b/ICSharpCode.NRefactory.CSharp/Properties/AssemblyInfo.cs @@ -0,0 +1,31 @@ +#region Using directives + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +#endregion + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ICSharpCode.NRefactory.CSharp")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ICSharpCode.NRefactory.CSharp")] +[assembly: AssemblyCopyright("Copyright 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all the values or you can use the default the Revision and +// Build Numbers by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/Action.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/Action.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/Action.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/Action.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/AddAnotherAccessor.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/AddAnotherAccessor.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/AddAnotherAccessor.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/AddAnotherAccessor.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/CheckIfParameterIsNull.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/CheckIfParameterIsNull.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/CheckIfParameterIsNull.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/CheckIfParameterIsNull.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/ConvertDecToHex.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/ConvertDecToHex.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/ConvertDecToHex.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/ConvertDecToHex.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/ConvertForeachToFor.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/ConvertForeachToFor.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/ConvertForeachToFor.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/ConvertForeachToFor.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/ConvertHexToDec.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/ConvertHexToDec.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/ConvertHexToDec.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/ConvertHexToDec.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/CreateBackingStore.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/CreateBackingStore.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/CreateBackingStore.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/CreateBackingStore.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/CreateEventInvocator.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/CreateEventInvocator.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/CreateEventInvocator.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/CreateEventInvocator.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/CreateField.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/CreateField.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/CreateField.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/CreateField.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/CreateLocalVariable.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/CreateLocalVariable.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/CreateLocalVariable.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/CreateLocalVariable.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/CreateProperty.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/CreateProperty.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/CreateProperty.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/CreateProperty.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/FlipOperatorArguments.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/FlipOperatorArguments.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/FlipOperatorArguments.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/FlipOperatorArguments.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/GenerateGetter.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/GenerateGetter.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/GenerateGetter.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/GenerateGetter.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/GenerateSwitchLabels.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/GenerateSwitchLabels.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/GenerateSwitchLabels.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/GenerateSwitchLabels.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/InsertAnonymousMethodSignature.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/InsertAnonymousMethodSignature.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/InsertAnonymousMethodSignature.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/InsertAnonymousMethodSignature.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/IntroduceFormatItem.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/IntroduceFormatItem.cs similarity index 94% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/IntroduceFormatItem.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/IntroduceFormatItem.cs index d1530b90de..5a1ef70b22 100644 --- a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/IntroduceFormatItem.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/IntroduceFormatItem.cs @@ -1,4 +1,4 @@ -// +// // IntroduceFormatItem.cs // // Author: @@ -47,8 +47,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring if (pexpr == null || !(pexpr.Value is string)) return false; if (pexpr.LiteralValue.StartsWith ("@")) - return pexpr.StartLocation < new AstLocation (context.Location.Line, context.Location.Column - 1) && - new AstLocation (context.Location.Line, context.Location.Column + 1) < pexpr.EndLocation; + return pexpr.StartLocation < new TextLocation (context.Location.Line, context.Location.Column - 1) && + new TextLocation (context.Location.Line, context.Location.Column + 1) < pexpr.EndLocation; return pexpr.StartLocation < context.Location && context.Location < pexpr.EndLocation; } diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/InvertIf.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/InvertIf.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/InvertIf.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/InvertIf.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/RemoveBackingStore.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/RemoveBackingStore.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/RemoveBackingStore.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/RemoveBackingStore.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/RemoveBraces.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/RemoveBraces.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/RemoveBraces.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/RemoveBraces.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/ReplaceEmptyString.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/ReplaceEmptyString.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/ReplaceEmptyString.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/ReplaceEmptyString.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/SplitDeclarationAndAssignment.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/SplitDeclarationAndAssignment.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/SplitDeclarationAndAssignment.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/SplitDeclarationAndAssignment.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/SplitString.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/SplitString.cs similarity index 82% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/SplitString.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/SplitString.cs index 425f54ca32..c811f18ca0 100644 --- a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/SplitString.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/SplitString.cs @@ -1,4 +1,4 @@ -// +// // SplitString.cs // // Author: @@ -37,10 +37,10 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring if (pexpr == null || !(pexpr.Value is string)) return false; if (pexpr.LiteralValue.StartsWith ("@")) - return pexpr.StartLocation < new AstLocation (context.Location.Line, context.Location.Column - 2) && - new AstLocation (context.Location.Line, context.Location.Column + 2) < pexpr.EndLocation; - return pexpr.StartLocation < new AstLocation (context.Location.Line, context.Location.Column - 1) && - new AstLocation (context.Location.Line, context.Location.Column + 1) < pexpr.EndLocation; + return pexpr.StartLocation < new TextLocation (context.Location.Line, context.Location.Column - 2) && + new TextLocation (context.Location.Line, context.Location.Column + 2) < pexpr.EndLocation; + return pexpr.StartLocation < new TextLocation (context.Location.Line, context.Location.Column - 1) && + new TextLocation (context.Location.Line, context.Location.Column + 1) < pexpr.EndLocation; } public void Run (RefactoringContext context) diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/UseExplicitType.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/UseExplicitType.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/UseExplicitType.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/UseExplicitType.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/UseVarKeyword.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/UseVarKeyword.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/ContextAction/UseVarKeyword.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/ContextAction/UseVarKeyword.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/CreateLinkAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CreateLinkAction.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/CreateLinkAction.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/CreateLinkAction.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/FormatTextAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/FormatTextAction.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/FormatTextAction.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/FormatTextAction.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/IActionFactory.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/IActionFactory.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/IActionFactory.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/IActionFactory.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/IContextAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/IContextAction.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/IContextAction.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/IContextAction.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/NodeOutputAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/NodeOutputAction.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/NodeOutputAction.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/NodeOutputAction.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/NodeSelectionAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/NodeSelectionAction.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/NodeSelectionAction.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/NodeSelectionAction.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/RefactoringContext.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/RefactoringContext.cs similarity index 95% rename from ICSharpCode.NRefactory/CSharp/Refactoring/RefactoringContext.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/RefactoringContext.cs index 9bea623b4c..420b585f80 100644 --- a/ICSharpCode.NRefactory/CSharp/Refactoring/RefactoringContext.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/RefactoringContext.cs @@ -45,7 +45,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring } } - public AstLocation Location { + public TextLocation Location { get; protected set; } @@ -93,12 +93,12 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring public abstract int SelectionStart { get; } public abstract int SelectionEnd { get; } public abstract int SelectionLength { get; } - public abstract int GetOffset (AstLocation location); + public abstract int GetOffset (TextLocation location); public int GetOffset (int line, int col) { - return GetOffset (new AstLocation (line, col)); + return GetOffset (new TextLocation (line, col)); } - public abstract AstLocation GetLocation (int offset); + public abstract TextLocation GetLocation (int offset); public abstract string GetText (int offset, int length); #endregion diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/Script.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/Script.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/Script.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/Script.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/TextReplaceAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/TextReplaceAction.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/TextReplaceAction.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/TextReplaceAction.cs diff --git a/ICSharpCode.NRefactory/CSharp/Refactoring/TypeSystemAstBuilder.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/TypeSystemAstBuilder.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Refactoring/TypeSystemAstBuilder.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/TypeSystemAstBuilder.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/AliasNamespaceReference.cs b/ICSharpCode.NRefactory.CSharp/Resolver/AliasNamespaceReference.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/AliasNamespaceReference.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/AliasNamespaceReference.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/CSharpAttribute.cs b/ICSharpCode.NRefactory.CSharp/Resolver/CSharpAttribute.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/CSharpAttribute.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/CSharpAttribute.cs diff --git a/ICSharpCode.NRefactory.CSharp/Resolver/CSharpInvocationResolveResult.cs b/ICSharpCode.NRefactory.CSharp/Resolver/CSharpInvocationResolveResult.cs new file mode 100644 index 0000000000..5e5bd21579 --- /dev/null +++ b/ICSharpCode.NRefactory.CSharp/Resolver/CSharpInvocationResolveResult.cs @@ -0,0 +1,89 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// +// 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; +using System.Collections.Generic; +using ICSharpCode.NRefactory.Semantics; +using ICSharpCode.NRefactory.TypeSystem; + +namespace ICSharpCode.NRefactory.CSharp.Resolver +{ + /// + /// Represents the result of a method invocation. + /// + public class CSharpInvocationResolveResult : InvocationResolveResult + { + public readonly OverloadResolutionErrors OverloadResolutionErrors; + + /// + /// Gets whether this invocation is calling an extension method using extension method syntax. + /// + public readonly bool IsExtensionMethodInvocation; + + /// + /// Gets whether this invocation is calling a delegate (without explicitly calling ".Invoke()"). + /// + public readonly bool IsDelegateInvocation; + + /// + /// Gets whether a params-Array is being used in its expanded form. + /// + public readonly bool IsExpandedForm; + + /// + /// Gets whether this is a lifted operator invocation. + /// + public readonly bool IsLiftedOperatorInvocation; + + readonly IList argumentToParameterMap; + + public CSharpInvocationResolveResult( + ResolveResult targetResult, IParameterizedMember member, IType returnType, + IList arguments, + OverloadResolutionErrors overloadResolutionErrors = OverloadResolutionErrors.None, + bool isExtensionMethodInvocation = false, + bool isExpandedForm = false, + bool isLiftedOperatorInvocation = false, + bool isDelegateInvocation = false, + IList argumentToParameterMap = null) + : base(targetResult, member, returnType, arguments) + { + this.OverloadResolutionErrors = overloadResolutionErrors; + this.IsExtensionMethodInvocation = isExtensionMethodInvocation; + this.IsExpandedForm = isExpandedForm; + this.IsLiftedOperatorInvocation = isLiftedOperatorInvocation; + this.IsDelegateInvocation = isDelegateInvocation; + this.argumentToParameterMap = argumentToParameterMap; + } + + public override bool IsError { + get { return this.OverloadResolutionErrors != OverloadResolutionErrors.None; } + } + + /// + /// Gets an array that maps argument indices to parameter indices. + /// For arguments that could not be mapped to any parameter, the value will be -1. + /// + /// parameterIndex = ArgumentToParameterMap[argumentIndex] + /// + public IList GetArgumentToParameterMap() + { + return argumentToParameterMap; + } + } +} diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/CSharpResolver.cs b/ICSharpCode.NRefactory.CSharp/Resolver/CSharpResolver.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Resolver/CSharpResolver.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/CSharpResolver.cs index 451030a954..0eb276cf86 100644 --- a/ICSharpCode.NRefactory/CSharp/Resolver/CSharpResolver.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/CSharpResolver.cs @@ -1844,14 +1844,14 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver { LiftedUserDefinedOperator lifted = r.BestCandidate as LiftedUserDefinedOperator; if (lifted != null) { - return new InvocationResolveResult( + return new CSharpInvocationResolveResult( null, lifted.nonLiftedOperator, lifted.ReturnType.Resolve(context), r.GetArgumentsWithConversions(), r.BestCandidateErrors, isLiftedOperatorInvocation: true, argumentToParameterMap: r.GetArgumentToParameterMap() ); } else { - return new InvocationResolveResult(null, r, context); + return r.CreateResolveResult(null); } } #endregion @@ -2379,7 +2379,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver if (mgrr != null) { OverloadResolution or = mgrr.PerformOverloadResolution(context, arguments, argumentNames, conversions: conversions); if (or.BestCandidate != null) { - return new InvocationResolveResult(mgrr.TargetResult, or, context); + return or.CreateResolveResult(mgrr.TargetResult); } else { // No candidate found at all (not even an inapplicable one). // This can happen with empty method groups (as sometimes used with extension methods) @@ -2399,7 +2399,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver if (invokeMethod != null) { OverloadResolution or = new OverloadResolution(context, arguments, argumentNames, conversions: conversions); or.AddCandidate(invokeMethod); - return new InvocationResolveResult( + return new CSharpInvocationResolveResult( target, invokeMethod, invokeMethod.ReturnType.Resolve(context), or.GetArgumentsWithConversions(), or.BestCandidateErrors, isExpandedForm: or.BestCandidateIsExpandedForm, @@ -2528,7 +2528,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver var indexers = lookup.LookupIndexers(target.Type); or.AddMethodLists(indexers); if (or.BestCandidate != null) { - return new InvocationResolveResult(target, or, context); + return or.CreateResolveResult(target); } else { return ErrorResult; } @@ -2580,7 +2580,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver or.AddCandidate(ctor); } if (or.BestCandidate != null) { - return new InvocationResolveResult(null, or, context); + return or.CreateResolveResult(null); } else { return new ErrorResolveResult(type); } diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/CompositeResolveVisitorNavigator.cs b/ICSharpCode.NRefactory.CSharp/Resolver/CompositeResolveVisitorNavigator.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/CompositeResolveVisitorNavigator.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/CompositeResolveVisitorNavigator.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/ConstantValues.cs b/ICSharpCode.NRefactory.CSharp/Resolver/ConstantValues.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/ConstantValues.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/ConstantValues.cs diff --git a/ICSharpCode.NRefactory/Semantics/ConversionResolveResult.cs b/ICSharpCode.NRefactory.CSharp/Resolver/ConversionResolveResult.cs similarity index 95% rename from ICSharpCode.NRefactory/Semantics/ConversionResolveResult.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/ConversionResolveResult.cs index 225a76c8e3..13dd7b762f 100644 --- a/ICSharpCode.NRefactory/Semantics/ConversionResolveResult.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/ConversionResolveResult.cs @@ -18,10 +18,10 @@ using System; using System.Collections.Generic; -using ICSharpCode.NRefactory.CSharp.Resolver; +using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; -namespace ICSharpCode.NRefactory.Semantics +namespace ICSharpCode.NRefactory.CSharp.Resolver { public class ConversionResolveResult : ResolveResult { diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/Conversions.cs b/ICSharpCode.NRefactory.CSharp/Resolver/Conversions.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/Conversions.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/Conversions.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/DetectSkippableNodesNavigator.cs b/ICSharpCode.NRefactory.CSharp/Resolver/DetectSkippableNodesNavigator.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/DetectSkippableNodesNavigator.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/DetectSkippableNodesNavigator.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/ErrorResolveResult.cs b/ICSharpCode.NRefactory.CSharp/Resolver/ErrorResolveResult.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/ErrorResolveResult.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/ErrorResolveResult.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/FindReferenceSearchScope.cs b/ICSharpCode.NRefactory.CSharp/Resolver/FindReferenceSearchScope.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/FindReferenceSearchScope.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/FindReferenceSearchScope.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/FindReferencedEntities.cs b/ICSharpCode.NRefactory.CSharp/Resolver/FindReferencedEntities.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/FindReferencedEntities.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/FindReferencedEntities.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/FindReferences.cs b/ICSharpCode.NRefactory.CSharp/Resolver/FindReferences.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Resolver/FindReferences.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/FindReferences.cs index 2910bf427f..f35b56be97 100644 --- a/ICSharpCode.NRefactory/CSharp/Resolver/FindReferences.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/FindReferences.cs @@ -21,7 +21,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading; -using ICSharpCode.Editor; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.Utils; diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/IResolveVisitorNavigator.cs b/ICSharpCode.NRefactory.CSharp/Resolver/IResolveVisitorNavigator.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/IResolveVisitorNavigator.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/IResolveVisitorNavigator.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/ITypeOrNamespaceReference.cs b/ICSharpCode.NRefactory.CSharp/Resolver/ITypeOrNamespaceReference.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/ITypeOrNamespaceReference.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/ITypeOrNamespaceReference.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/LambdaResolveResult.cs b/ICSharpCode.NRefactory.CSharp/Resolver/LambdaResolveResult.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/LambdaResolveResult.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/LambdaResolveResult.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/Log.cs b/ICSharpCode.NRefactory.CSharp/Resolver/Log.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/Log.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/Log.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/MapTypeIntoNewContext.cs b/ICSharpCode.NRefactory.CSharp/Resolver/MapTypeIntoNewContext.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/MapTypeIntoNewContext.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/MapTypeIntoNewContext.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/MemberLookup.cs b/ICSharpCode.NRefactory.CSharp/Resolver/MemberLookup.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/MemberLookup.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/MemberLookup.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/MemberTypeOrNamespaceReference.cs b/ICSharpCode.NRefactory.CSharp/Resolver/MemberTypeOrNamespaceReference.cs similarity index 98% rename from ICSharpCode.NRefactory/CSharp/Resolver/MemberTypeOrNamespaceReference.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/MemberTypeOrNamespaceReference.cs index 7224459e70..6bc3ea87e3 100644 --- a/ICSharpCode.NRefactory/CSharp/Resolver/MemberTypeOrNamespaceReference.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/MemberTypeOrNamespaceReference.cs @@ -115,7 +115,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver if (typeArguments.Count == 0) return target.ToString() + "." + identifier; else - return target.ToString() + "." + identifier + "<" + DotNet35Compat.StringJoin(",", typeArguments) + ">"; + return target.ToString() + "." + identifier + "<" + string.Join(",", typeArguments) + ">"; } void ISupportsInterning.PrepareForInterning(IInterningProvider provider) diff --git a/ICSharpCode.NRefactory/Semantics/MethodGroupResolveResult.cs b/ICSharpCode.NRefactory.CSharp/Resolver/MethodGroupResolveResult.cs similarity index 98% rename from ICSharpCode.NRefactory/Semantics/MethodGroupResolveResult.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/MethodGroupResolveResult.cs index b90f086d06..5af732ddb1 100644 --- a/ICSharpCode.NRefactory/Semantics/MethodGroupResolveResult.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/MethodGroupResolveResult.cs @@ -23,10 +23,10 @@ using System.Diagnostics; using System.Linq; using System.Text; -using ICSharpCode.NRefactory.CSharp.Resolver; +using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; -namespace ICSharpCode.NRefactory.Semantics +namespace ICSharpCode.NRefactory.CSharp.Resolver { public class MethodListWithDeclaringType : List { diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/NodeListResolveVisitorNavigator.cs b/ICSharpCode.NRefactory.CSharp/Resolver/NodeListResolveVisitorNavigator.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/NodeListResolveVisitorNavigator.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/NodeListResolveVisitorNavigator.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/OperatorResolveResult.cs b/ICSharpCode.NRefactory.CSharp/Resolver/OperatorResolveResult.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/OperatorResolveResult.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/OperatorResolveResult.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/OverloadResolution.cs b/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolution.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Resolver/OverloadResolution.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolution.cs index 23a58c554c..80d47d5df3 100644 --- a/ICSharpCode.NRefactory/CSharp/Resolver/OverloadResolution.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolution.cs @@ -761,5 +761,10 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver return bestCandidate.Member; } } + + public CSharpInvocationResolveResult CreateResolveResult(ResolveResult targetResolveResult) + { + throw new NotImplementedException(); + } } } diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/OverloadResolutionErrors.cs b/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolutionErrors.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/OverloadResolutionErrors.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolutionErrors.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/ResolveAtLocation.cs b/ICSharpCode.NRefactory.CSharp/Resolver/ResolveAtLocation.cs similarity index 97% rename from ICSharpCode.NRefactory/CSharp/Resolver/ResolveAtLocation.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/ResolveAtLocation.cs index 3ceb4bd201..aa6bffb7bc 100644 --- a/ICSharpCode.NRefactory/CSharp/Resolver/ResolveAtLocation.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/ResolveAtLocation.cs @@ -29,7 +29,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver /// public static class ResolveAtLocation { - public static ResolveResult Resolve(ITypeResolveContext context, CSharpParsedFile parsedFile, CompilationUnit cu, AstLocation location, + public static ResolveResult Resolve(ITypeResolveContext context, CSharpParsedFile parsedFile, CompilationUnit cu, TextLocation location, CancellationToken cancellationToken = default(CancellationToken)) { AstNode node = cu.GetNodeAt(location); diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/ResolveVisitor.cs b/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Resolver/ResolveVisitor.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs index dffc6019b8..84f7dac237 100644 --- a/ICSharpCode.NRefactory/CSharp/Resolver/ResolveVisitor.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs @@ -339,7 +339,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver } } - void ProcessConversionsInInvocation(Expression target, IEnumerable arguments, InvocationResolveResult invocation) + void ProcessConversionsInInvocation(Expression target, IEnumerable arguments, CSharpInvocationResolveResult invocation) { if (invocation == null) return; @@ -1145,7 +1145,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver if (aarr != null) { ProcessConversionResults(indexerExpression.Arguments, aarr.Indices); } else { - ProcessConversionsInInvocation(target, indexerExpression.Arguments, rr as InvocationResolveResult); + ProcessConversionsInInvocation(target, indexerExpression.Arguments, rr as CSharpInvocationResolveResult); } return rr; } else { @@ -1218,7 +1218,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver ResolveResult[] arguments = GetArguments(objectCreateExpression.Arguments, out argumentNames); ResolveResult rr = resolver.ResolveObjectCreation(type, arguments, argumentNames); - ProcessConversionsInInvocation(null, objectCreateExpression.Arguments, rr as InvocationResolveResult); + ProcessConversionsInInvocation(null, objectCreateExpression.Arguments, rr as CSharpInvocationResolveResult); return rr; } else { foreach (AstNode node in objectCreateExpression.Arguments) { @@ -1255,7 +1255,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver var mgrr = addRR as MethodGroupResolveResult; if (mgrr != null) { OverloadResolution or = mgrr.PerformOverloadResolution(resolver.Context, addArguments, null, false, false, resolver.conversions); - var invocationRR = new InvocationResolveResult(targetResult, or, resolver.Context); + var invocationRR = or.CreateResolveResult(targetResult); StoreResult(aie, invocationRR); ProcessConversionsInInvocation(null, aie.Elements, invocationRR); } else { @@ -1603,7 +1603,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver string[] argumentNames; ResolveResult[] arguments = GetArguments(invocationExpression.Arguments, out argumentNames); ResolveResult rr = resolver.ResolveInvocation(target, arguments, argumentNames); - ProcessConversionsInInvocation(invocationExpression.Target, invocationExpression.Arguments, rr as InvocationResolveResult); + ProcessConversionsInInvocation(invocationExpression.Target, invocationExpression.Arguments, rr as CSharpInvocationResolveResult); return rr; } #endregion @@ -2654,7 +2654,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver string[] argumentNames; ResolveResult[] arguments = GetArguments(constructorArguments, out argumentNames); ResolveResult rr = resolver.ResolveObjectCreation(type, arguments, argumentNames); - ProcessConversionsInInvocation(null, constructorArguments, rr as InvocationResolveResult); + ProcessConversionsInInvocation(null, constructorArguments, rr as CSharpInvocationResolveResult); return rr; } else { foreach (var node in constructorArguments) @@ -3234,7 +3234,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver string[] argumentNames; ResolveResult[] arguments = GetArguments(constructorInitializer.Arguments, out argumentNames); ResolveResult rr = resolver.ResolveObjectCreation(target.Type, arguments, argumentNames); - ProcessConversionsInInvocation(null, constructorInitializer.Arguments, rr as InvocationResolveResult); + ProcessConversionsInInvocation(null, constructorInitializer.Arguments, rr as CSharpInvocationResolveResult); return rr; } #endregion diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/SimpleNameLookupMode.cs b/ICSharpCode.NRefactory.CSharp/Resolver/SimpleNameLookupMode.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/SimpleNameLookupMode.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/SimpleNameLookupMode.cs diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/SimpleTypeOrNamespaceReference.cs b/ICSharpCode.NRefactory.CSharp/Resolver/SimpleTypeOrNamespaceReference.cs similarity index 98% rename from ICSharpCode.NRefactory/CSharp/Resolver/SimpleTypeOrNamespaceReference.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/SimpleTypeOrNamespaceReference.cs index 27ecef40f1..4a0bddf101 100644 --- a/ICSharpCode.NRefactory/CSharp/Resolver/SimpleTypeOrNamespaceReference.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/SimpleTypeOrNamespaceReference.cs @@ -106,7 +106,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver if (typeArguments.Count == 0) return identifier; else - return identifier + "<" + DotNet35Compat.StringJoin(",", typeArguments) + ">"; + return identifier + "<" + string.Join(",", typeArguments) + ">"; } void ISupportsInterning.PrepareForInterning(IInterningProvider provider) diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/TypeInference.cs b/ICSharpCode.NRefactory.CSharp/Resolver/TypeInference.cs similarity index 99% rename from ICSharpCode.NRefactory/CSharp/Resolver/TypeInference.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/TypeInference.cs index da462565ed..66558056aa 100644 --- a/ICSharpCode.NRefactory/CSharp/Resolver/TypeInference.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/TypeInference.cs @@ -963,7 +963,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver bool success; IType[] result = InferTypeArgumentsFromBounds( candidateDef.TypeParameters, - new ParameterizedType(candidateDef, candidateDef.TypeParameters.SafeCast()), + new ParameterizedType(candidateDef, candidateDef.TypeParameters), lowerBounds, upperBounds, out success); if (success) { diff --git a/ICSharpCode.NRefactory/CSharp/Resolver/UsingScope.cs b/ICSharpCode.NRefactory.CSharp/Resolver/UsingScope.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Resolver/UsingScope.cs rename to ICSharpCode.NRefactory.CSharp/Resolver/UsingScope.cs diff --git a/ICSharpCode.NRefactory.Demo/CSDemo.cs b/ICSharpCode.NRefactory.Demo/CSDemo.cs index 6232abb601..bbbc856ac0 100644 --- a/ICSharpCode.NRefactory.Demo/CSDemo.cs +++ b/ICSharpCode.NRefactory.Demo/CSDemo.cs @@ -153,7 +153,7 @@ namespace ICSharpCode.NRefactory.Demo csharpCodeTextBox.Text = w.ToString(); } - int GetOffset(TextBox textBox, AstLocation location) + int GetOffset(TextBox textBox, TextLocation location) { return textBox.GetFirstCharIndexFromLine(location.Line - 1) + location.Column - 1; } diff --git a/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj b/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj index 2a24954bcb..d98289e5d4 100644 --- a/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj +++ b/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj @@ -61,6 +61,10 @@ + + {53DCA265-3C3C-42F9-B647-F72BA678122B} + ICSharpCode.NRefactory.CSharp + {7B82B671-419F-45F4-B778-D9286F996EFA} ICSharpCode.NRefactory.VB diff --git a/ICSharpCode.NRefactory.Demo/VBDemo.cs b/ICSharpCode.NRefactory.Demo/VBDemo.cs index 8a24737a77..287aa20aa1 100644 --- a/ICSharpCode.NRefactory.Demo/VBDemo.cs +++ b/ICSharpCode.NRefactory.Demo/VBDemo.cs @@ -137,7 +137,7 @@ namespace ICSharpCode.NRefactory.Demo codeView.Text = w.ToString(); } - int GetOffset(TextBox textBox, AstLocation location) + int GetOffset(TextBox textBox, TextLocation location) { return textBox.GetFirstCharIndexFromLine(location.Line - 1) + location.Column - 1; } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/InvocationExpressionTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/InvocationExpressionTests.cs index 42e9eb95a2..91983603e2 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/InvocationExpressionTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/InvocationExpressionTests.cs @@ -119,14 +119,14 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Expression public void NestedInvocationPositions() { InvocationExpression expr = ParseUtilCSharp.ParseExpression("a.B().C(args)"); - Assert.AreEqual(new AstLocation(1, 8), expr.StartLocation); - Assert.AreEqual(new AstLocation(1, 14), expr.EndLocation); + Assert.AreEqual(new TextLocation(1, 8), expr.StartLocation); + Assert.AreEqual(new TextLocation(1, 14), expr.EndLocation); MemberReferenceExpression mre = (MemberReferenceExpression)expr.Target; - Assert.AreEqual(new AstLocation(1, 6), mre.StartLocation); - Assert.AreEqual(new AstLocation(1, 8), mre.EndLocation); + Assert.AreEqual(new TextLocation(1, 6), mre.StartLocation); + Assert.AreEqual(new TextLocation(1, 8), mre.EndLocation); - Assert.AreEqual(new AstLocation(1, 4), mre.Target.StartLocation); - Assert.AreEqual(new AstLocation(1, 6), mre.Target.EndLocation); + Assert.AreEqual(new TextLocation(1, 4), mre.Target.StartLocation); + Assert.AreEqual(new TextLocation(1, 6), mre.Target.EndLocation); } [Test] diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/PrimitiveExpressionTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/PrimitiveExpressionTests.cs index f91d8ea49e..61cfa77fee 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/PrimitiveExpressionTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/PrimitiveExpressionTests.cs @@ -219,8 +219,8 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Expression public void TestPositionOfIntegerAtEndOfLine() { var pe = ParseUtilCSharp.ParseExpression("0\r\n"); - Assert.AreEqual(new AstLocation(1, 1), pe.StartLocation); - Assert.AreEqual(new AstLocation(1, 2), pe.EndLocation); + Assert.AreEqual(new TextLocation(1, 1), pe.StartLocation); + Assert.AreEqual(new TextLocation(1, 2), pe.EndLocation); } } } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/AttributeSectionTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/AttributeSectionTests.cs index 213238dc56..17def861ad 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/AttributeSectionTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/AttributeSectionTests.cs @@ -49,7 +49,7 @@ public class Form1 { { string program = @"[assembly: System.Attribute()]"; AttributeSection decl = ParseUtilCSharp.ParseGlobal(program); - Assert.AreEqual(new AstLocation(1, 1), decl.StartLocation); + Assert.AreEqual(new TextLocation(1, 1), decl.StartLocation); Assert.AreEqual("assembly", decl.AttributeTarget); } @@ -58,7 +58,7 @@ public class Form1 { { string program = @"[module: System.Attribute()]"; AttributeSection decl = ParseUtilCSharp.ParseGlobal(program); - Assert.AreEqual(new AstLocation(1, 1), decl.StartLocation); + Assert.AreEqual(new TextLocation(1, 1), decl.StartLocation); Assert.AreEqual("module", decl.AttributeTarget); } @@ -68,7 +68,7 @@ public class Form1 { string program = @"[type: System.Attribute()] class Test {}"; TypeDeclaration type = ParseUtilCSharp.ParseGlobal(program); AttributeSection decl = type.Attributes.Single(); - Assert.AreEqual(new AstLocation(1, 1), decl.StartLocation); + Assert.AreEqual(new TextLocation(1, 1), decl.StartLocation); Assert.AreEqual("type", decl.AttributeTarget); } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/TypeDeclarationTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/TypeDeclarationTests.cs index 5a2a340546..9893f9ef85 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/TypeDeclarationTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/TypeDeclarationTests.cs @@ -44,7 +44,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope TypeDeclaration td = ParseUtilCSharp.ParseGlobal(program); Assert.AreEqual(1, td.StartLocation.Line, "StartLocation.Y"); Assert.AreEqual(1, td.StartLocation.Column, "StartLocation.X"); - AstLocation bodyStartLocation = td.GetChildByRole(AstNode.Roles.LBrace).PrevSibling.EndLocation; + TextLocation bodyStartLocation = td.GetChildByRole(AstNode.Roles.LBrace).PrevSibling.EndLocation; Assert.AreEqual(1, bodyStartLocation.Line, "BodyStartLocation.Y"); Assert.AreEqual(14, bodyStartLocation.Column, "BodyStartLocation.X"); Assert.AreEqual(3, td.EndLocation.Line, "EndLocation.Y"); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseSelfTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseSelfTests.cs index 5cf5f61c01..7d9ccd7ccf 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseSelfTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseSelfTests.cs @@ -104,7 +104,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser } } - void CheckWhitespace(AstLocation whitespaceStart, AstLocation whitespaceEnd) + void CheckWhitespace(TextLocation whitespaceStart, TextLocation whitespaceEnd) { if (whitespaceStart == whitespaceEnd) return; diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/MethodDeclarationTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/MethodDeclarationTests.cs index e68efd3c12..f0f9b86f67 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/MethodDeclarationTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/MethodDeclarationTests.cs @@ -328,8 +328,8 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.TypeMembers "}", true // expect errors ); Assert.AreEqual("A", md.Name); - Assert.AreEqual(new AstLocation(2, 1), md.Body.StartLocation); - Assert.AreEqual(new AstLocation(5, 2), md.Body.EndLocation); + Assert.AreEqual(new TextLocation(2, 1), md.Body.StartLocation); + Assert.AreEqual(new TextLocation(5, 2), md.Body.EndLocation); } [Test] diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/PropertyDeclarationTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/PropertyDeclarationTests.cs index 9ed260b889..bb9ce196b4 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/PropertyDeclarationTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/PropertyDeclarationTests.cs @@ -74,12 +74,12 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.TypeMembers CSharpParser parser = new CSharpParser(); CompilationUnit cu = parser.Parse(new StringReader(code)); PropertyDeclaration pd = (PropertyDeclaration)cu.Children.Single().GetChildByRole(TypeDeclaration.MemberRole); - Assert.AreEqual(new AstLocation(2, code.IndexOf("{\n\t\tget") - line2Pos + 1), pd.GetChildByRole(AstNode.Roles.LBrace).StartLocation); - Assert.AreEqual(new AstLocation(5, 3), pd.EndLocation); - Assert.AreEqual(new AstLocation(3, code.IndexOf("{ return") - line3Pos + 1), pd.Getter.Body.StartLocation); - Assert.AreEqual(new AstLocation(3, code.IndexOf("}\n\t\tset") + 1 - line3Pos + 1), pd.Getter.Body.EndLocation); - Assert.AreEqual(new AstLocation(4, code.IndexOf("{ f =") - line4Pos + 1), pd.Setter.Body.StartLocation); - Assert.AreEqual(new AstLocation(4, code.IndexOf("}\n\t}") + 1 - line4Pos + 1), pd.Setter.Body.EndLocation); + Assert.AreEqual(new TextLocation(2, code.IndexOf("{\n\t\tget") - line2Pos + 1), pd.GetChildByRole(AstNode.Roles.LBrace).StartLocation); + Assert.AreEqual(new TextLocation(5, 3), pd.EndLocation); + Assert.AreEqual(new TextLocation(3, code.IndexOf("{ return") - line3Pos + 1), pd.Getter.Body.StartLocation); + Assert.AreEqual(new TextLocation(3, code.IndexOf("}\n\t\tset") + 1 - line3Pos + 1), pd.Getter.Body.EndLocation); + Assert.AreEqual(new TextLocation(4, code.IndexOf("{ f =") - line4Pos + 1), pd.Setter.Body.StartLocation); + Assert.AreEqual(new TextLocation(4, code.IndexOf("}\n\t}") + 1 - line4Pos + 1), pd.Setter.Body.EndLocation); } [Test] diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Resolver/BinaryOperatorTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Resolver/BinaryOperatorTests.cs index 842e81ae53..740cf46081 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Resolver/BinaryOperatorTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Resolver/BinaryOperatorTests.cs @@ -504,7 +504,7 @@ class Test { } } "; - InvocationResolveResult irr = Resolve(program); + var irr = Resolve(program); Assert.IsFalse(irr.IsError); Assert.IsTrue(irr.IsLiftedOperatorInvocation); Assert.AreEqual("A.op_Addition", irr.Member.FullName); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Resolver/InvocationTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Resolver/InvocationTests.cs index beef31ae0e..cbf3790f42 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Resolver/InvocationTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Resolver/InvocationTests.cs @@ -349,7 +349,7 @@ interface IBoth : ILeft, IRight {} class A { void Test(IBoth x) { $x.Method()$; } }"; - var rr = Resolve(program); + var rr = Resolve(program); Assert.IsTrue(rr.IsError); Assert.AreEqual(OverloadResolutionErrors.AmbiguousMatch, rr.OverloadResolutionErrors); } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolverTestBase.cs b/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolverTestBase.cs index 17280cdebb..2585e70ba1 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolverTestBase.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolverTestBase.cs @@ -171,13 +171,13 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver } } - IEnumerable FindDollarSigns(string code) + IEnumerable FindDollarSigns(string code) { int line = 1; int col = 1; foreach (char c in code) { if (c == '$') { - yield return new AstLocation(line, col); + yield return new TextLocation(line, col); } else if (c == '\n') { line++; col = 1; @@ -191,7 +191,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver { CompilationUnit cu = new CSharpParser().Parse(new StringReader(code.Replace("$", ""))); - AstLocation[] dollars = FindDollarSigns(code).ToArray(); + TextLocation[] dollars = FindDollarSigns(code).ToArray(); Assert.AreEqual(2, dollars.Length, "Expected 2 dollar signs marking start+end of desired node"); SetUp(); @@ -230,11 +230,11 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver sealed class FindNodeVisitor : DepthFirstAstVisitor { - readonly AstLocation start; - readonly AstLocation end; + readonly TextLocation start; + readonly TextLocation end; public AstNode ResultNode; - public FindNodeVisitor(AstLocation start, AstLocation end) + public FindNodeVisitor(TextLocation start, TextLocation end) { this.start = start; this.end = end; @@ -256,7 +256,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver { CompilationUnit cu = new CSharpParser().Parse(new StringReader(code.Replace("$", ""))); - AstLocation[] dollars = FindDollarSigns(code).ToArray(); + TextLocation[] dollars = FindDollarSigns(code).ToArray(); Assert.AreEqual(1, dollars.Length, "Expected 1 dollar signs marking the location"); SetUp(); diff --git a/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj b/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj index 5d951a4b2a..6b0e18aca4 100644 --- a/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj +++ b/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj @@ -189,6 +189,10 @@ {F054A788-B591-4561-A8BA-AE745BBEB817} ICSharpCode.Editor + + {53DCA265-3C3C-42F9-B647-F72BA678122B} + ICSharpCode.NRefactory.CSharp + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} ICSharpCode.NRefactory diff --git a/ICSharpCode.NRefactory.VB/Ast/AstLocation.cs b/ICSharpCode.NRefactory.VB/Ast/AstLocation.cs deleted file mode 100644 index 4a3a1bc688..0000000000 --- a/ICSharpCode.NRefactory.VB/Ast/AstLocation.cs +++ /dev/null @@ -1,137 +0,0 @@ -// -// DomLocation.cs -// -// Author: -// Mike Krüger -// -// Copyright (C) 2008 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.VB -{ - [Serializable] - public struct AstLocation : IComparable, IEquatable - { - public static readonly AstLocation Empty = new AstLocation(0, 0); - - readonly int line, column; - - public AstLocation (int line, int column) - { - this.line = line; - this.column = column; - } - - public bool IsEmpty { - get { - return line <= 0; - } - } - - public int Line { - get { return line; } - } - - public int Column { - get { return column; } - } - - public override bool Equals (object obj) - { - if (!(obj is AstLocation)) - return false; - return (AstLocation)obj == this; - } - - public override int GetHashCode () - { - unchecked { - return line + column * 5000; - } - } - - public bool Equals (AstLocation other) - { - return other == this; - } - - public int CompareTo (AstLocation other) - { - if (this == other) - return 0; - if (this < other) - return -1; - return 1; - } - - public override string ToString () - { - return String.Format ("(Line {0}, Column {1})", Line, Column); - } - - public static AstLocation FromInvariantString (string invariantString) - { - if (string.Equals(invariantString, "EMPTY", StringComparison.OrdinalIgnoreCase)) - return AstLocation.Empty; - string[] splits = invariantString.Split (',', '/'); - if (splits.Length == 2) - return new AstLocation (Int32.Parse (splits[0]), Int32.Parse (splits[1])); - return AstLocation.Empty; - } - - public string ToInvariantString () - { - if (IsEmpty) - return "Empty"; - return String.Format ("{0}/{1}", line, column); - } - - public static bool operator==(AstLocation left, AstLocation right) - { - return left.line == right.line && left.column == right.column; - } - - public static bool operator!=(AstLocation left, AstLocation right) - { - return left.line != right.line || left.column != right.column; - } - - public static bool operator<(AstLocation left, AstLocation right) - { - return left.line < right.line || left.line == right.line && left.column < right.column; - } - public static bool operator>(AstLocation left, AstLocation right) - { - return left.line > right.line || left.line == right.line && left.column > right.column; - } - public static bool operator<=(AstLocation left, AstLocation right) - { - return !(left > right); - } - public static bool operator>=(AstLocation left, AstLocation right) - { - return !(left < right); - } - } -} diff --git a/ICSharpCode.NRefactory.VB/Ast/AstNode.cs b/ICSharpCode.NRefactory.VB/Ast/AstNode.cs index 57c6498768..448ae471b8 100644 --- a/ICSharpCode.NRefactory.VB/Ast/AstNode.cs +++ b/ICSharpCode.NRefactory.VB/Ast/AstNode.cs @@ -82,20 +82,20 @@ namespace ICSharpCode.NRefactory.VB } } - public virtual AstLocation StartLocation { + public virtual TextLocation StartLocation { get { var child = firstChild; if (child == null) - return AstLocation.Empty; + return TextLocation.Empty; return child.StartLocation; } } - public virtual AstLocation EndLocation { + public virtual TextLocation EndLocation { get { var child = lastChild; if (child == null) - return AstLocation.Empty; + return TextLocation.Empty; return child.EndLocation; } } diff --git a/ICSharpCode.NRefactory.VB/Ast/Comment.cs b/ICSharpCode.NRefactory.VB/Ast/Comment.cs index ee8f6b3853..fc3a600d87 100644 --- a/ICSharpCode.NRefactory.VB/Ast/Comment.cs +++ b/ICSharpCode.NRefactory.VB/Ast/Comment.cs @@ -26,15 +26,15 @@ namespace ICSharpCode.NRefactory.VB set; } - AstLocation startLocation; - public override AstLocation StartLocation { + TextLocation startLocation; + public override TextLocation StartLocation { get { return startLocation; } } - AstLocation endLocation; - public override AstLocation EndLocation { + TextLocation endLocation; + public override TextLocation EndLocation { get { return endLocation; } @@ -46,7 +46,7 @@ namespace ICSharpCode.NRefactory.VB this.Content = content; } - public Comment (bool isDocumentation, AstLocation startLocation, AstLocation endLocation) + public Comment (bool isDocumentation, TextLocation startLocation, TextLocation endLocation) { this.IsDocumentationComment = isDocumentation; this.startLocation = startLocation; diff --git a/ICSharpCode.NRefactory.VB/Ast/Expressions/EmptyExpression.cs b/ICSharpCode.NRefactory.VB/Ast/Expressions/EmptyExpression.cs index c475a2b515..01b2f140e9 100644 --- a/ICSharpCode.NRefactory.VB/Ast/Expressions/EmptyExpression.cs +++ b/ICSharpCode.NRefactory.VB/Ast/Expressions/EmptyExpression.cs @@ -22,15 +22,15 @@ namespace ICSharpCode.NRefactory.VB.Ast { public class EmptyExpression : Expression { - AstLocation location; + TextLocation location; - public override AstLocation StartLocation { + public override TextLocation StartLocation { get { return location; } } - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { return location; } @@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.VB.Ast { } - public EmptyExpression(AstLocation location) + public EmptyExpression(TextLocation location) { this.location = location; } diff --git a/ICSharpCode.NRefactory.VB/Ast/Expressions/InstanceExpression.cs b/ICSharpCode.NRefactory.VB/Ast/Expressions/InstanceExpression.cs index d51972cb1d..321d387e93 100644 --- a/ICSharpCode.NRefactory.VB/Ast/Expressions/InstanceExpression.cs +++ b/ICSharpCode.NRefactory.VB/Ast/Expressions/InstanceExpression.cs @@ -10,27 +10,27 @@ namespace ICSharpCode.NRefactory.VB.Ast /// public class InstanceExpression : Expression { - AstLocation location; + TextLocation location; - public InstanceExpression(InstanceExpressionType type, AstLocation location) + public InstanceExpression(InstanceExpressionType type, TextLocation location) { this.Type = type; this.location = location; } - public override AstLocation StartLocation { + public override TextLocation StartLocation { get { return location; } } - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { switch (Type) { case InstanceExpressionType.Me: - return new AstLocation(location.Line, location.Column + "Me".Length); + return new TextLocation(location.Line, location.Column + "Me".Length); case InstanceExpressionType.MyBase: - return new AstLocation(location.Line, location.Column + "MyBase".Length); + return new TextLocation(location.Line, location.Column + "MyBase".Length); case InstanceExpressionType.MyClass: - return new AstLocation(location.Line, location.Column + "MyClass".Length); + return new TextLocation(location.Line, location.Column + "MyClass".Length); default: throw new Exception("Invalid value for InstanceExpressionType"); } diff --git a/ICSharpCode.NRefactory.VB/Ast/Expressions/LambdaExpression.cs b/ICSharpCode.NRefactory.VB/Ast/Expressions/LambdaExpression.cs index 75863cbfc3..fe238367b5 100644 --- a/ICSharpCode.NRefactory.VB/Ast/Expressions/LambdaExpression.cs +++ b/ICSharpCode.NRefactory.VB/Ast/Expressions/LambdaExpression.cs @@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.VB.Ast if ((m & (Modifiers)newValue) != 0) { if ((m & (Modifiers)oldValue) == 0) { // Modifier was added - var newToken = new VBModifierToken(AstLocation.Empty, m); + var newToken = new VBModifierToken(TextLocation.Empty, m); node.InsertChildAfter(insertionPos, newToken, ModifierRole); insertionPos = newToken; } else { diff --git a/ICSharpCode.NRefactory.VB/Ast/Expressions/PrimitiveExpression.cs b/ICSharpCode.NRefactory.VB/Ast/Expressions/PrimitiveExpression.cs index 39eeabc07b..d1d5f2d1f1 100644 --- a/ICSharpCode.NRefactory.VB/Ast/Expressions/PrimitiveExpression.cs +++ b/ICSharpCode.NRefactory.VB/Ast/Expressions/PrimitiveExpression.cs @@ -13,17 +13,17 @@ namespace ICSharpCode.NRefactory.VB.Ast { public static readonly object AnyValue = new object(); - AstLocation startLocation; - public override AstLocation StartLocation { + TextLocation startLocation; + public override TextLocation StartLocation { get { return startLocation; } } int length; - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { - return new AstLocation(StartLocation.Line, StartLocation.Column + length); + return new TextLocation(StartLocation.Line, StartLocation.Column + length); } } @@ -46,14 +46,14 @@ namespace ICSharpCode.NRefactory.VB.Ast this.stringValue = stringValue; } - public PrimitiveExpression(object value, AstLocation startLocation, int length) + public PrimitiveExpression(object value, TextLocation startLocation, int length) { this.Value = value; this.startLocation = startLocation; this.length = length; } - public PrimitiveExpression(object value, string stringValue, AstLocation startLocation, int length) + public PrimitiveExpression(object value, string stringValue, TextLocation startLocation, int length) { this.Value = value; this.stringValue = stringValue; diff --git a/ICSharpCode.NRefactory.VB/Ast/Expressions/XmlIdentifier.cs b/ICSharpCode.NRefactory.VB/Ast/Expressions/XmlIdentifier.cs index 97860526fb..3b45d5a606 100644 --- a/ICSharpCode.NRefactory.VB/Ast/Expressions/XmlIdentifier.cs +++ b/ICSharpCode.NRefactory.VB/Ast/Expressions/XmlIdentifier.cs @@ -33,13 +33,13 @@ namespace ICSharpCode.NRefactory.VB.Ast public string Name { get; set; } - AstLocation startLocation; - public override AstLocation StartLocation { + TextLocation startLocation; + public override TextLocation StartLocation { get { return startLocation; } } - AstLocation endLocation; - public override AstLocation EndLocation { + TextLocation endLocation; + public override TextLocation EndLocation { get { return endLocation; } } @@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.VB.Ast this.Name = string.Empty; } - public XmlIdentifier(string name, AstLocation startLocation, AstLocation endLocation) + public XmlIdentifier(string name, TextLocation startLocation, TextLocation endLocation) { this.Name = name; this.startLocation = startLocation; diff --git a/ICSharpCode.NRefactory.VB/Ast/Expressions/XmlLiteralString.cs b/ICSharpCode.NRefactory.VB/Ast/Expressions/XmlLiteralString.cs index 90845e0fb7..d2f89e8050 100644 --- a/ICSharpCode.NRefactory.VB/Ast/Expressions/XmlLiteralString.cs +++ b/ICSharpCode.NRefactory.VB/Ast/Expressions/XmlLiteralString.cs @@ -30,13 +30,13 @@ namespace ICSharpCode.NRefactory.VB.Ast public string Value { get; set; } - AstLocation startLocation; - public override AstLocation StartLocation { + TextLocation startLocation; + public override TextLocation StartLocation { get { return startLocation; } } - AstLocation endLocation; - public override AstLocation EndLocation { + TextLocation endLocation; + public override TextLocation EndLocation { get { return endLocation; } } @@ -45,7 +45,7 @@ namespace ICSharpCode.NRefactory.VB.Ast this.Value = string.Empty; } - public XmlLiteralString(string value, AstLocation startLocation, AstLocation endLocation) + public XmlLiteralString(string value, TextLocation startLocation, TextLocation endLocation) { this.Value = value; this.startLocation = startLocation; diff --git a/ICSharpCode.NRefactory.VB/Ast/General/AttributedNode.cs b/ICSharpCode.NRefactory.VB/Ast/General/AttributedNode.cs index f7330195f9..de1ccd2546 100644 --- a/ICSharpCode.NRefactory.VB/Ast/General/AttributedNode.cs +++ b/ICSharpCode.NRefactory.VB/Ast/General/AttributedNode.cs @@ -41,7 +41,7 @@ namespace ICSharpCode.NRefactory.VB.Ast if ((m & newValue) != 0) { if ((m & oldValue) == 0) { // Modifier was added - var newToken = new VBModifierToken(AstLocation.Empty, m); + var newToken = new VBModifierToken(TextLocation.Empty, m); node.InsertChildAfter(insertionPos, newToken, ModifierRole); insertionPos = newToken; } else { diff --git a/ICSharpCode.NRefactory.VB/Ast/General/CompilationUnit.cs b/ICSharpCode.NRefactory.VB/Ast/General/CompilationUnit.cs index fcc2f2b1bb..558872c7d5 100644 --- a/ICSharpCode.NRefactory.VB/Ast/General/CompilationUnit.cs +++ b/ICSharpCode.NRefactory.VB/Ast/General/CompilationUnit.cs @@ -22,10 +22,10 @@ namespace ICSharpCode.NRefactory.VB.Ast public AstNode GetNodeAt (int line, int column) { - return GetNodeAt (new AstLocation (line, column)); + return GetNodeAt (new TextLocation (line, column)); } - public AstNode GetNodeAt (AstLocation location) + public AstNode GetNodeAt (TextLocation location) { AstNode node = this; while (node.FirstChild != null) { @@ -46,10 +46,10 @@ namespace ICSharpCode.NRefactory.VB.Ast public IEnumerable GetNodesBetween (int startLine, int startColumn, int endLine, int endColumn) { - return GetNodesBetween (new AstLocation (startLine, startColumn), new AstLocation (endLine, endColumn)); + return GetNodesBetween (new TextLocation (startLine, startColumn), new TextLocation (endLine, endColumn)); } - public IEnumerable GetNodesBetween (AstLocation start, AstLocation end) + public IEnumerable GetNodesBetween (TextLocation start, TextLocation end) { AstNode node = this; while (node != null) { diff --git a/ICSharpCode.NRefactory.VB/Ast/General/InterfaceMemberSpecifier.cs b/ICSharpCode.NRefactory.VB/Ast/General/InterfaceMemberSpecifier.cs index 84cc23da6b..d4e0090f24 100644 --- a/ICSharpCode.NRefactory.VB/Ast/General/InterfaceMemberSpecifier.cs +++ b/ICSharpCode.NRefactory.VB/Ast/General/InterfaceMemberSpecifier.cs @@ -18,7 +18,7 @@ namespace ICSharpCode.NRefactory.VB.Ast public InterfaceMemberSpecifier(AstType target, string member) { Target = new TypeReferenceExpression(target); - Member = new Identifier(member, AstLocation.Empty); + Member = new Identifier(member, TextLocation.Empty); } public Expression Target { diff --git a/ICSharpCode.NRefactory.VB/Ast/General/TypeParameterDeclaration.cs b/ICSharpCode.NRefactory.VB/Ast/General/TypeParameterDeclaration.cs index cfce070566..29396a9d94 100644 --- a/ICSharpCode.NRefactory.VB/Ast/General/TypeParameterDeclaration.cs +++ b/ICSharpCode.NRefactory.VB/Ast/General/TypeParameterDeclaration.cs @@ -23,7 +23,7 @@ namespace ICSharpCode.NRefactory.VB.Ast public string Name { get { return GetChildByRole (Roles.Identifier).Name; } - set { SetChildByRole(Roles.Identifier, new Identifier (value, AstLocation.Empty)); } + set { SetChildByRole(Roles.Identifier, new Identifier (value, TextLocation.Empty)); } } public AstNodeCollection Constraints { diff --git a/ICSharpCode.NRefactory.VB/Ast/GlobalScope/NamespaceDeclaration.cs b/ICSharpCode.NRefactory.VB/Ast/GlobalScope/NamespaceDeclaration.cs index 5859cc40a9..84016b45af 100644 --- a/ICSharpCode.NRefactory.VB/Ast/GlobalScope/NamespaceDeclaration.cs +++ b/ICSharpCode.NRefactory.VB/Ast/GlobalScope/NamespaceDeclaration.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.NRefactory.VB.Ast return builder.ToString (); } set { - GetChildrenByRole(Roles.Identifier).ReplaceWith(value.Split('.').Select(ident => new Identifier (ident, AstLocation.Empty))); + GetChildrenByRole(Roles.Identifier).ReplaceWith(value.Split('.').Select(ident => new Identifier (ident, TextLocation.Empty))); } } diff --git a/ICSharpCode.NRefactory.VB/Ast/Identifier.cs b/ICSharpCode.NRefactory.VB/Ast/Identifier.cs index 0ffa568c96..e7cd4424a1 100644 --- a/ICSharpCode.NRefactory.VB/Ast/Identifier.cs +++ b/ICSharpCode.NRefactory.VB/Ast/Identifier.cs @@ -43,16 +43,16 @@ namespace ICSharpCode.NRefactory.VB.Ast public TypeCode TypeCharacter { get; set; } - AstLocation startLocation; - public override AstLocation StartLocation { + TextLocation startLocation; + public override TextLocation StartLocation { get { return startLocation; } } - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { - return new AstLocation (StartLocation.Line, StartLocation.Column + Name.Length); + return new TextLocation (StartLocation.Line, StartLocation.Column + Name.Length); } } @@ -61,7 +61,7 @@ namespace ICSharpCode.NRefactory.VB.Ast this.name = string.Empty; } - public Identifier (string name, AstLocation location) + public Identifier (string name, TextLocation location) { if (name == null) throw new ArgumentNullException("name"); @@ -71,7 +71,7 @@ namespace ICSharpCode.NRefactory.VB.Ast public static implicit operator Identifier(string name) { - return new Identifier(name, AstLocation.Empty); + return new Identifier(name, TextLocation.Empty); } protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match) diff --git a/ICSharpCode.NRefactory.VB/Ast/TypeName/ComposedType.cs b/ICSharpCode.NRefactory.VB/Ast/TypeName/ComposedType.cs index 4b688366c9..3f23d791c0 100644 --- a/ICSharpCode.NRefactory.VB/Ast/TypeName/ComposedType.cs +++ b/ICSharpCode.NRefactory.VB/Ast/TypeName/ComposedType.cs @@ -22,7 +22,7 @@ namespace ICSharpCode.NRefactory.VB.Ast return !GetChildByRole(NullableRole).IsNull; } set { - SetChildByRole(NullableRole, value ? new VBTokenNode(AstLocation.Empty, 1) : null); + SetChildByRole(NullableRole, value ? new VBTokenNode(TextLocation.Empty, 1) : null); } } @@ -89,7 +89,7 @@ namespace ICSharpCode.NRefactory.VB.Ast d--; } while (d < value) { - InsertChildBefore(GetChildByRole(Roles.Comma), new VBTokenNode(AstLocation.Empty, 1), Roles.Comma); + InsertChildBefore(GetChildByRole(Roles.Comma), new VBTokenNode(TextLocation.Empty, 1), Roles.Comma); d++; } } diff --git a/ICSharpCode.NRefactory.VB/Ast/TypeName/PrimitiveType.cs b/ICSharpCode.NRefactory.VB/Ast/TypeName/PrimitiveType.cs index d7dc0c2451..092705d532 100644 --- a/ICSharpCode.NRefactory.VB/Ast/TypeName/PrimitiveType.cs +++ b/ICSharpCode.NRefactory.VB/Ast/TypeName/PrimitiveType.cs @@ -9,7 +9,7 @@ namespace ICSharpCode.NRefactory.VB.Ast public class PrimitiveType : AstType { public string Keyword { get; set; } - public AstLocation Location { get; set; } + public TextLocation Location { get; set; } public PrimitiveType() { @@ -20,20 +20,20 @@ namespace ICSharpCode.NRefactory.VB.Ast this.Keyword = keyword; } - public PrimitiveType(string keyword, AstLocation location) + public PrimitiveType(string keyword, TextLocation location) { this.Keyword = keyword; this.Location = location; } - public override AstLocation StartLocation { + public override TextLocation StartLocation { get { return Location; } } - public override AstLocation EndLocation { + public override TextLocation EndLocation { get { - return new AstLocation (Location.Line, Location.Column + (Keyword != null ? Keyword.Length : 0)); + return new TextLocation (Location.Line, Location.Column + (Keyword != null ? Keyword.Length : 0)); } } diff --git a/ICSharpCode.NRefactory.VB/Ast/TypeName/QualifiedType.cs b/ICSharpCode.NRefactory.VB/Ast/TypeName/QualifiedType.cs index 4c3d93cd36..3ee783d63e 100644 --- a/ICSharpCode.NRefactory.VB/Ast/TypeName/QualifiedType.cs +++ b/ICSharpCode.NRefactory.VB/Ast/TypeName/QualifiedType.cs @@ -24,7 +24,7 @@ namespace ICSharpCode.NRefactory.VB.Ast return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole (Roles.Identifier, new Identifier (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, new Identifier (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory.VB/Ast/TypeName/SimpleType.cs b/ICSharpCode.NRefactory.VB/Ast/TypeName/SimpleType.cs index 590671b9c7..5f86fa871d 100644 --- a/ICSharpCode.NRefactory.VB/Ast/TypeName/SimpleType.cs +++ b/ICSharpCode.NRefactory.VB/Ast/TypeName/SimpleType.cs @@ -42,7 +42,7 @@ namespace ICSharpCode.NRefactory.VB.Ast this.Identifier = identifier; } - public SimpleType(string identifier, AstLocation location) + public SimpleType(string identifier, TextLocation location) { SetChildByRole (Roles.Identifier, new Identifier (identifier, location)); } @@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.VB.Ast return GetChildByRole (Roles.Identifier).Name; } set { - SetChildByRole (Roles.Identifier, new Identifier (value, AstLocation.Empty)); + SetChildByRole (Roles.Identifier, new Identifier (value, TextLocation.Empty)); } } diff --git a/ICSharpCode.NRefactory.VB/Ast/VBModifierToken.cs b/ICSharpCode.NRefactory.VB/Ast/VBModifierToken.cs index 2039901e47..d6a23ebcd6 100644 --- a/ICSharpCode.NRefactory.VB/Ast/VBModifierToken.cs +++ b/ICSharpCode.NRefactory.VB/Ast/VBModifierToken.cs @@ -77,7 +77,7 @@ namespace ICSharpCode.NRefactory.VB.Ast get { return lengthTable.Select(p => p.Key); } } - public VBModifierToken(AstLocation location, Modifiers modifier) : base (location, 0) + public VBModifierToken(TextLocation location, Modifiers modifier) : base (location, 0) { this.Modifier = modifier; } diff --git a/ICSharpCode.NRefactory.VB/Ast/VBTokenNode.cs b/ICSharpCode.NRefactory.VB/Ast/VBTokenNode.cs index 225484e670..d98a820af9 100644 --- a/ICSharpCode.NRefactory.VB/Ast/VBTokenNode.cs +++ b/ICSharpCode.NRefactory.VB/Ast/VBTokenNode.cs @@ -25,7 +25,7 @@ namespace ICSharpCode.NRefactory.VB.Ast } } - public NullVBTokenNode() : base (AstLocation.Empty, 0) + public NullVBTokenNode() : base (TextLocation.Empty, 0) { } @@ -40,8 +40,8 @@ namespace ICSharpCode.NRefactory.VB.Ast } } - AstLocation startLocation; - public override AstLocation StartLocation { + TextLocation startLocation; + public override TextLocation StartLocation { get { return startLocation; } @@ -49,20 +49,20 @@ namespace ICSharpCode.NRefactory.VB.Ast protected int tokenLength = -1; - AstLocation endLocation; - public override AstLocation EndLocation { + TextLocation endLocation; + public override TextLocation EndLocation { get { - return tokenLength < 0 ? endLocation : new AstLocation(startLocation.Line, startLocation.Column + tokenLength); + return tokenLength < 0 ? endLocation : new TextLocation(startLocation.Line, startLocation.Column + tokenLength); } } - public VBTokenNode(AstLocation location, int tokenLength) + public VBTokenNode(TextLocation location, int tokenLength) { this.startLocation = location; this.tokenLength = tokenLength; } - public VBTokenNode(AstLocation startLocation, AstLocation endLocation) + public VBTokenNode(TextLocation startLocation, TextLocation endLocation) { this.startLocation = startLocation; this.endLocation = endLocation; diff --git a/ICSharpCode.NRefactory.VB/ICSharpCode.NRefactory.VB.csproj b/ICSharpCode.NRefactory.VB/ICSharpCode.NRefactory.VB.csproj index c100ed7176..81fc417937 100644 --- a/ICSharpCode.NRefactory.VB/ICSharpCode.NRefactory.VB.csproj +++ b/ICSharpCode.NRefactory.VB/ICSharpCode.NRefactory.VB.csproj @@ -47,7 +47,6 @@ - @@ -222,6 +221,10 @@ + + {53DCA265-3C3C-42F9-B647-F72BA678122B} + ICSharpCode.NRefactory.CSharp + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} ICSharpCode.NRefactory diff --git a/ICSharpCode.NRefactory.VB/Lexer/Block.cs b/ICSharpCode.NRefactory.VB/Lexer/Block.cs index b568e0440d..6b4218e7c0 100644 --- a/ICSharpCode.NRefactory.VB/Lexer/Block.cs +++ b/ICSharpCode.NRefactory.VB/Lexer/Block.cs @@ -33,11 +33,11 @@ namespace ICSharpCode.NRefactory.VB.Parser { public static readonly Block Default = new Block() { context = Context.Global, - lastExpressionStart = AstLocation.Empty + lastExpressionStart = TextLocation.Empty }; public Context context; - public AstLocation lastExpressionStart; + public TextLocation lastExpressionStart; public bool isClosed; public override string ToString() diff --git a/ICSharpCode.NRefactory.VB/Lexer/ExpressionFinder.cs b/ICSharpCode.NRefactory.VB/Lexer/ExpressionFinder.cs index cb6f236158..42b6e05c43 100644 --- a/ICSharpCode.NRefactory.VB/Lexer/ExpressionFinder.cs +++ b/ICSharpCode.NRefactory.VB/Lexer/ExpressionFinder.cs @@ -28,7 +28,7 @@ namespace ICSharpCode.NRefactory.VB.Parser void PushContext(Context context, Token la, Token t) { string indent = new string('\t', stack.Count); - AstLocation l = la == null ? (t == null ? AstLocation.Empty : t.EndLocation) : la.Location; + TextLocation l = la == null ? (t == null ? TextLocation.Empty : t.EndLocation) : la.Location; stack.Push(new Block() { context = context, lastExpressionStart = l }); Print(indent + "enter " + context); diff --git a/ICSharpCode.NRefactory.VB/Lexer/SavepointEventArgs.cs b/ICSharpCode.NRefactory.VB/Lexer/SavepointEventArgs.cs index 651ecb71b7..c599ca7f55 100644 --- a/ICSharpCode.NRefactory.VB/Lexer/SavepointEventArgs.cs +++ b/ICSharpCode.NRefactory.VB/Lexer/SavepointEventArgs.cs @@ -8,10 +8,10 @@ namespace ICSharpCode.NRefactory.VB.Parser { public class SavepointEventArgs : EventArgs { - public AstLocation SavepointLocation { get; private set; } + public TextLocation SavepointLocation { get; private set; } public VBLexerMemento State { get; private set; } - public SavepointEventArgs(AstLocation savepointLocation, VBLexerMemento state) + public SavepointEventArgs(TextLocation savepointLocation, VBLexerMemento state) { this.SavepointLocation = savepointLocation; this.State = state; diff --git a/ICSharpCode.NRefactory.VB/Lexer/Token.cs b/ICSharpCode.NRefactory.VB/Lexer/Token.cs index 54df5cab67..423c56a935 100644 --- a/ICSharpCode.NRefactory.VB/Lexer/Token.cs +++ b/ICSharpCode.NRefactory.VB/Lexer/Token.cs @@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Parser internal readonly object literalValue; internal readonly string val; internal Token next; - readonly AstLocation endLocation; + readonly TextLocation endLocation; public int Kind { get { return kind; } @@ -29,13 +29,13 @@ namespace ICSharpCode.NRefactory.VB.Parser get { return val; } } - public AstLocation EndLocation { + public TextLocation EndLocation { get { return endLocation; } } - public AstLocation Location { + public TextLocation Location { get { - return new AstLocation(line, col); + return new TextLocation(line, col); } } @@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.VB.Parser { } - public Token(int kind, AstLocation startLocation, AstLocation endLocation) : this(kind, startLocation, endLocation, "", null) + public Token(int kind, TextLocation startLocation, TextLocation endLocation) : this(kind, startLocation, endLocation, "", null) { } @@ -58,15 +58,15 @@ namespace ICSharpCode.NRefactory.VB.Parser this.col = col; this.line = line; this.val = val; - this.endLocation = new AstLocation(line, col + (val == null ? 1 : val.Length)); + this.endLocation = new TextLocation(line, col + (val == null ? 1 : val.Length)); } internal Token(int kind, int x, int y, string val, object literalValue) - : this(kind, new AstLocation(y, x), new AstLocation(y, x + val.Length), val, literalValue) + : this(kind, new TextLocation(y, x), new TextLocation(y, x + val.Length), val, literalValue) { } - public Token(int kind, AstLocation startLocation, AstLocation endLocation, string val, object literalValue) + public Token(int kind, TextLocation startLocation, TextLocation endLocation, string val, object literalValue) { this.kind = kind; this.col = startLocation.Column; diff --git a/ICSharpCode.NRefactory.VB/Lexer/VBLexer.cs b/ICSharpCode.NRefactory.VB/Lexer/VBLexer.cs index ea2dc116ee..a8e3163099 100644 --- a/ICSharpCode.NRefactory.VB/Lexer/VBLexer.cs +++ b/ICSharpCode.NRefactory.VB/Lexer/VBLexer.cs @@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.VB.Parser public VBLexer(TextReader reader, VBLexerMemento state) : this(reader) { - SetInitialLocation(new AstLocation(state.Line, state.Column)); + SetInitialLocation(new TextLocation(state.Line, state.Column)); lastToken = new Token(state.PrevTokenKind, 0, 0); ef = new ExpressionFinder(state.ExpressionFinder); lineEnd = state.LineEnd; @@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.VB.Parser unchecked { while (true) { - AstLocation startLocation = new AstLocation(Line, Col); + TextLocation startLocation = new TextLocation(Line, Col); int nextChar = ReaderRead(); if (nextChar == -1) return new Token(Tokens.EOF, Col, Line, string.Empty); @@ -96,12 +96,12 @@ namespace ICSharpCode.NRefactory.VB.Parser if (ReaderPeek() == '/') { ReaderRead(); info.inXmlCloseTag = true; - return new Token(Tokens.XmlOpenEndTag, new AstLocation(y, x), new AstLocation(Line, Col)); + return new Token(Tokens.XmlOpenEndTag, new TextLocation(y, x), new TextLocation(Line, Col)); } if (ReaderPeek() == '%' && ReaderPeek(1) == '=') { inXmlMode = false; ReaderRead(); ReaderRead(); - return new Token(Tokens.XmlStartInlineVB, new AstLocation(y, x), new AstLocation(Line, Col)); + return new Token(Tokens.XmlStartInlineVB, new TextLocation(y, x), new TextLocation(Line, Col)); } if (ReaderPeek() == '?') { ReaderRead(); @@ -122,7 +122,7 @@ namespace ICSharpCode.NRefactory.VB.Parser ReaderRead(); info.inXmlTag = false; info.level--; - return new Token(Tokens.XmlCloseTagEmptyElement, new AstLocation(y, x), new AstLocation(Line, Col)); + return new Token(Tokens.XmlCloseTagEmptyElement, new TextLocation(y, x), new TextLocation(Line, Col)); } break; case '>': @@ -143,7 +143,7 @@ namespace ICSharpCode.NRefactory.VB.Parser return new Token(Tokens.Identifier, x, y, ReadXmlIdent(ch)); } else { string content = ReadXmlContent(ch); - return new Token(Tokens.XmlContent, startLocation, new AstLocation(Line, Col), content, null); + return new Token(Tokens.XmlContent, startLocation, new TextLocation(Line, Col), content, null); } } #endregion @@ -157,7 +157,7 @@ namespace ICSharpCode.NRefactory.VB.Parser // specialTracker.AddEndOfLine(startLocation); } else { lineEnd = true; - return new Token(Tokens.EOL, startLocation, new AstLocation(Line, Col), null, null); + return new Token(Tokens.EOL, startLocation, new TextLocation(Line, Col), null, null); } } continue; @@ -314,7 +314,7 @@ namespace ICSharpCode.NRefactory.VB.Parser int y = Line; inXmlMode = true; ReaderRead(); - return new Token(Tokens.XmlEndInlineVB, new AstLocation(y, x), new AstLocation(Line, Col)); + return new Token(Tokens.XmlEndInlineVB, new TextLocation(y, x), new TextLocation(Line, Col)); } #endregion if (ch == '<' && (ef.NextTokenIsPotentialStartOfExpression || ef.NextTokenIsStartOfImportsOrAccessExpression)) { @@ -326,13 +326,13 @@ namespace ICSharpCode.NRefactory.VB.Parser if (ReaderPeek() == '/') { ReaderRead(); info.inXmlCloseTag = true; - return new Token(Tokens.XmlOpenEndTag, new AstLocation(y, x), new AstLocation(Line, Col)); + return new Token(Tokens.XmlOpenEndTag, new TextLocation(y, x), new TextLocation(Line, Col)); } // should we allow <%= at start of an expression? not valid with vbc ... if (ReaderPeek() == '%' && ReaderPeek(1) == '=') { inXmlMode = false; ReaderRead(); ReaderRead(); - return new Token(Tokens.XmlStartInlineVB, new AstLocation(y, x), new AstLocation(Line, Col)); + return new Token(Tokens.XmlStartInlineVB, new TextLocation(y, x), new TextLocation(Line, Col)); } if (ReaderPeek() == '!') { ReaderRead(); @@ -361,7 +361,7 @@ namespace ICSharpCode.NRefactory.VB.Parser } } - void CheckXMLState(AstLocation startLocation) + void CheckXMLState(TextLocation startLocation) { if (inXmlMode && !xmlModeStack.Any()) throw new InvalidOperationException("invalid XML stack state at " + startLocation); @@ -776,7 +776,7 @@ namespace ICSharpCode.NRefactory.VB.Parser void ReadPreprocessorDirective() { - AstLocation start = new AstLocation(Line, Col - 1); + TextLocation start = new TextLocation(Line, Col - 1); string directive = ReadIdent('#'); // TODO : expression parser for PP directives // needed for proper conversion to e. g. C# @@ -833,7 +833,7 @@ namespace ICSharpCode.NRefactory.VB.Parser void ReadComment() { - AstLocation startPos = new AstLocation(Line, Col); + TextLocation startPos = new TextLocation(Line, Col); sb.Length = 0; StringBuilder curWord = specialCommentHash != null ? new StringBuilder() : null; int missingApostrophes = 2; // no. of ' missing until it is a documentation comment @@ -866,7 +866,7 @@ namespace ICSharpCode.NRefactory.VB.Parser string tag = curWord.ToString(); curWord.Length = 0; if (specialCommentHash.ContainsKey(tag)) { - AstLocation p = new AstLocation(Line, Col); + TextLocation p = new TextLocation(Line, Col); string comment = ch + ReadToEndOfLine(); // this.TagComments.Add(new TagComment(tag, comment, isAtLineBegin, p, new Location(Col, Line))); sb.Append(comment); @@ -1046,7 +1046,7 @@ namespace ICSharpCode.NRefactory.VB.Parser ReaderSkip("?>".Length); - return new Token(Tokens.XmlProcessingInstruction, new AstLocation(y, x), new AstLocation(Line, Col), sb.ToString(), null); + return new Token(Tokens.XmlProcessingInstruction, new TextLocation(y, x), new TextLocation(Line, Col), sb.ToString(), null); } Token ReadXmlCommentOrCData(int x, int y) @@ -1060,7 +1060,7 @@ namespace ICSharpCode.NRefactory.VB.Parser sb.Append((char)nextChar); if (string.CompareOrdinal(ReaderPeekString("-->".Length), "-->") == 0) { ReaderSkip("-->".Length); - return new Token(Tokens.XmlComment, new AstLocation(y, x), new AstLocation(Line, Col), sb.ToString(), null); + return new Token(Tokens.XmlComment, new TextLocation(y, x), new TextLocation(Line, Col), sb.ToString(), null); } } } @@ -1071,12 +1071,12 @@ namespace ICSharpCode.NRefactory.VB.Parser sb.Append((char)nextChar); if (string.CompareOrdinal(ReaderPeekString("]]>".Length), "]]>") == 0) { ReaderSkip("]]>".Length); - return new Token(Tokens.XmlCData, new AstLocation(y, x), new AstLocation(Line, Col), sb.ToString(), null); + return new Token(Tokens.XmlCData, new TextLocation(y, x), new TextLocation(Line, Col), sb.ToString(), null); } } } - return new Token(Tokens.XmlComment, new AstLocation(y, x), new AstLocation(Line, Col), sb.ToString(), null); + return new Token(Tokens.XmlComment, new TextLocation(y, x), new TextLocation(Line, Col), sb.ToString(), null); } string ReadXmlContent(char ch) @@ -1276,7 +1276,7 @@ namespace ICSharpCode.NRefactory.VB.Parser return builder.ToString(); } - public void SetInitialLocation(AstLocation location) + public void SetInitialLocation(TextLocation location) { if (lastToken != null || curToken != null || peekToken != null) throw new InvalidOperationException(); @@ -1404,12 +1404,12 @@ namespace ICSharpCode.NRefactory.VB.Parser errors.Error(line, col, String.Format("Invalid hex number '" + digit + "'")); return 0; } - protected AstLocation lastLineEnd = new AstLocation(1, 1); - protected AstLocation curLineEnd = new AstLocation(1, 1); + protected TextLocation lastLineEnd = new TextLocation(1, 1); + protected TextLocation curLineEnd = new TextLocation(1, 1); protected void LineBreak () { lastLineEnd = curLineEnd; - curLineEnd = new AstLocation (line, col - 1); + curLineEnd = new TextLocation (line, col - 1); } protected bool HandleLineEnd(char ch) { diff --git a/ICSharpCode.NRefactory.VB/OutputVisitor/OutputVisitor.cs b/ICSharpCode.NRefactory.VB/OutputVisitor/OutputVisitor.cs index b3e5dd53f5..eacb30db42 100644 --- a/ICSharpCode.NRefactory.VB/OutputVisitor/OutputVisitor.cs +++ b/ICSharpCode.NRefactory.VB/OutputVisitor/OutputVisitor.cs @@ -17,7 +17,7 @@ namespace ICSharpCode.NRefactory.VB /// /// Description of OutputVisitor. /// - public class OutputVisitor : IAstVisitor, IPatternAstVisitor + public class OutputVisitor : IAstVisitor { readonly IOutputFormatter formatter; readonly VBFormattingOptions policy; @@ -682,43 +682,6 @@ namespace ICSharpCode.NRefactory.VB } #endregion - #region Pattern Matching - public object VisitAnyNode(AnyNode anyNode, object data) - { - throw new NotImplementedException(); - } - - public object VisitBackreference(Backreference backreference, object data) - { - throw new NotImplementedException(); - } - - public object VisitChoice(Choice choice, object data) - { - throw new NotImplementedException(); - } - - public object VisitNamedNode(NamedNode namedNode, object data) - { - throw new NotImplementedException(); - } - - public object VisitRepeat(Repeat repeat, object data) - { - throw new NotImplementedException(); - } - - public object VisitOptionalNode(OptionalNode optionalNode, object data) - { - throw new NotImplementedException(); - } - - public object VisitIdentifierExpressionBackreference(IdentifierExpressionBackreference identifierExpressionBackreference, object data) - { - throw new NotImplementedException(); - } - #endregion - #region StartNode/EndNode void StartNode(AstNode node) { diff --git a/ICSharpCode.NRefactory.VB/Visitors/CSharpToVBConverterVisitor.cs b/ICSharpCode.NRefactory.VB/Visitors/CSharpToVBConverterVisitor.cs index 60ebaa9fd7..92ee8ae5bc 100644 --- a/ICSharpCode.NRefactory.VB/Visitors/CSharpToVBConverterVisitor.cs +++ b/ICSharpCode.NRefactory.VB/Visitors/CSharpToVBConverterVisitor.cs @@ -357,7 +357,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors public AstNode VisitIdentifierExpression(CSharp.IdentifierExpression identifierExpression, object data) { var expr = new IdentifierExpression(); - expr.Identifier = new Identifier(identifierExpression.Identifier, AstLocation.Empty); + expr.Identifier = new Identifier(identifierExpression.Identifier, TextLocation.Empty); ConvertNodes(identifierExpression.TypeArguments, expr.TypeArguments); return EndNode(identifierExpression, expr); @@ -410,7 +410,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors var memberAccessExpression = new MemberAccessExpression(); memberAccessExpression.Target = (Expression)memberReferenceExpression.Target.AcceptVisitor(this, data); - memberAccessExpression.MemberName = new Identifier(memberReferenceExpression.MemberName, AstLocation.Empty); + memberAccessExpression.MemberName = new Identifier(memberReferenceExpression.MemberName, TextLocation.Empty); ConvertNodes(memberReferenceExpression.TypeArguments, memberAccessExpression.TypeArguments); return EndNode(memberReferenceExpression, memberAccessExpression); @@ -798,7 +798,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors ConvertNodes(delegateDeclaration.Attributes.Where(section => section.AttributeTarget != "return"), result.Attributes); ConvertNodes(delegateDeclaration.ModifierTokens, result.ModifierTokens); - result.Name = new Identifier(delegateDeclaration.Name, AstLocation.Empty); + result.Name = new Identifier(delegateDeclaration.Name, TextLocation.Empty); result.IsSub = IsSub(delegateDeclaration.ReturnType); ConvertNodes(delegateDeclaration.Parameters, result.Parameters); ConvertNodes(delegateDeclaration.TypeParameters, result.TypeParameters); @@ -835,7 +835,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors type.UnderlyingType = (AstType)first.AcceptVisitor(this, data); } - type.Name = new Identifier(typeDeclaration.Name, AstLocation.Empty); + type.Name = new Identifier(typeDeclaration.Name, TextLocation.Empty); ConvertNodes(typeDeclaration.Members, type.Members); @@ -903,7 +903,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors var imports = new ImportsStatement(); var clause = new AliasImportsClause() { - Name = new Identifier(usingAliasDeclaration.Alias, AstLocation.Empty), + Name = new Identifier(usingAliasDeclaration.Alias, TextLocation.Empty), Alias = (AstType)usingAliasDeclaration.Import.AcceptVisitor(this, data) }; @@ -1405,8 +1405,8 @@ namespace ICSharpCode.NRefactory.VB.Visitors { var result = new InvocationExpression( new MemberAccessExpression() { - Target = new InstanceExpression(constructorInitializer.ConstructorInitializerType == CSharp.ConstructorInitializerType.This ? InstanceExpressionType.Me : InstanceExpressionType.MyBase, AstLocation.Empty), - MemberName = new Identifier("New", AstLocation.Empty) + Target = new InstanceExpression(constructorInitializer.ConstructorInitializerType == CSharp.ConstructorInitializerType.This ? InstanceExpressionType.Me : InstanceExpressionType.MyBase, TextLocation.Empty), + MemberName = new Identifier("New", TextLocation.Empty) } ); ConvertNodes(constructorInitializer.Arguments, result.Arguments); @@ -1430,7 +1430,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors var result = new EnumMemberDeclaration(); ConvertNodes(enumMemberDeclaration.Attributes, result.Attributes); - result.Name = new Identifier(enumMemberDeclaration.Name, AstLocation.Empty); + result.Name = new Identifier(enumMemberDeclaration.Name, TextLocation.Empty); result.Value = (Expression)enumMemberDeclaration.Initializer.AcceptVisitor(this, data); return EndNode(enumMemberDeclaration, result); @@ -1471,7 +1471,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors customEventDeclaration.Modifiers &= ~CSharp.Modifiers.Static; result.Modifiers = ConvertModifiers(customEventDeclaration.Modifiers, customEventDeclaration); result.IsCustom = true; - result.Name = new Identifier(customEventDeclaration.Name, AstLocation.Empty); + result.Name = new Identifier(customEventDeclaration.Name, TextLocation.Empty); result.ReturnType = (AstType)customEventDeclaration.ReturnType.AcceptVisitor(this, data); if (!customEventDeclaration.PrivateImplementationType.IsNull) result.ImplementsClause.Add( @@ -1514,7 +1514,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors if (types.Any() && types.Peek().ClassType == ClassType.Module) indexerDeclaration.Modifiers &= ~CSharp.Modifiers.Static; decl.Modifiers = ConvertModifiers(indexerDeclaration.Modifiers, indexerDeclaration); - decl.Name = new Identifier(indexerDeclaration.Name, AstLocation.Empty); + decl.Name = new Identifier(indexerDeclaration.Name, TextLocation.Empty); ConvertNodes(indexerDeclaration.Parameters, decl.Parameters); ConvertNodes(indexerDeclaration.Attributes.Where(section => section.AttributeTarget == "return"), decl.ReturnTypeAttributes); if (!indexerDeclaration.PrivateImplementationType.IsNull) @@ -1526,7 +1526,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors if (!decl.Setter.IsNull) { decl.Setter.Parameters.Add(new ParameterDeclaration() { - Name = new Identifier("value", AstLocation.Empty), + Name = new Identifier("value", TextLocation.Empty), Type = (AstType)indexerDeclaration.ReturnType.AcceptVisitor(this, data), }); } @@ -1561,7 +1561,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors ConvertNodes(methodDeclaration.Attributes.Where(section => section.AttributeTarget != "return"), result.Attributes); ConvertNodes(methodDeclaration.ModifierTokens, result.ModifierTokens); - result.Name = new Identifier(methodDeclaration.Name, AstLocation.Empty); + result.Name = new Identifier(methodDeclaration.Name, TextLocation.Empty); result.IsSub = IsSub(methodDeclaration.ReturnType); ConvertNodes(methodDeclaration.Parameters, result.Parameters); ConvertNodes(methodDeclaration.Attributes.Where(section => section.AttributeTarget == "return"), result.ReturnTypeAttributes); @@ -1580,7 +1580,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors ConvertNodes(methodDeclaration.Attributes.Where(section => section.AttributeTarget != "return"), result.Attributes); ConvertNodes(methodDeclaration.ModifierTokens, result.ModifierTokens); - result.Name = new Identifier(methodDeclaration.Name, AstLocation.Empty); + result.Name = new Identifier(methodDeclaration.Name, TextLocation.Empty); result.IsSub = IsSub(methodDeclaration.ReturnType); ConvertNodes(methodDeclaration.Parameters, result.Parameters); ConvertNodes(methodDeclaration.TypeParameters, result.TypeParameters); @@ -1829,7 +1829,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors block.Attributes.Add(new Ast.Attribute() { Type = new SimpleType("System.Runtime.InteropServices.OutAttribute") }); param.Attributes.Add(block); } - param.Name = new Identifier(parameterDeclaration.Name, AstLocation.Empty); + param.Name = new Identifier(parameterDeclaration.Name, TextLocation.Empty); param.Type = (AstType)parameterDeclaration.Type.AcceptVisitor(this, data); param.OptionalValue = (Expression)parameterDeclaration.DefaultExpression.AcceptVisitor(this, data); if (!param.OptionalValue.IsNull) @@ -1867,7 +1867,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors ConvertNodes(propertyDeclaration.Attributes.Where(section => section.AttributeTarget != "return"), decl.Attributes); decl.Getter = (Accessor)propertyDeclaration.Getter.AcceptVisitor(this, data); decl.Modifiers = ConvertModifiers(propertyDeclaration.Modifiers, propertyDeclaration); - decl.Name = new Identifier(propertyDeclaration.Name, AstLocation.Empty); + decl.Name = new Identifier(propertyDeclaration.Name, TextLocation.Empty); ConvertNodes(propertyDeclaration.Attributes.Where(section => section.AttributeTarget == "return"), decl.ReturnTypeAttributes); if (!propertyDeclaration.PrivateImplementationType.IsNull) decl.ImplementsClause.Add( @@ -1878,7 +1878,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors if (!decl.Setter.IsNull) { decl.Setter.Parameters.Add(new ParameterDeclaration() { - Name = new Identifier("value", AstLocation.Empty), + Name = new Identifier("value", TextLocation.Empty), Type = (AstType)propertyDeclaration.ReturnType.AcceptVisitor(this, data), }); } @@ -1941,7 +1941,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors else target = (AstType)memberType.Target.AcceptVisitor(this, data); - var type = new QualifiedType(target, new Identifier(memberType.MemberName, AstLocation.Empty)); + var type = new QualifiedType(target, new Identifier(memberType.MemberName, TextLocation.Empty)); ConvertNodes(memberType.TypeArguments, type.TypeArguments); return EndNode(memberType, type); @@ -2082,7 +2082,7 @@ namespace ICSharpCode.NRefactory.VB.Visitors var convertedModifiers = ConvertModifiers(mod.Modifier, mod.Parent); VBModifierToken token = null; if (convertedModifiers != Modifiers.None) { - token = new VBModifierToken(AstLocation.Empty, convertedModifiers); + token = new VBModifierToken(TextLocation.Empty, convertedModifiers); return EndNode(cSharpTokenNode, token); } return EndNode(cSharpTokenNode, token); @@ -2181,9 +2181,10 @@ namespace ICSharpCode.NRefactory.VB.Visitors } } - AstLocation ConvertLocation(CSharp.AstLocation location) + [Obsolete] + TextLocation ConvertLocation(TextLocation location) { - return new AstLocation(location.Line, location.Column); + return location; } T EndNode(CSharp.AstNode node, T result) where T : VB.AstNode diff --git a/ICSharpCode.NRefactory/CSharp/Ast/AstLocation.cs b/ICSharpCode.NRefactory/CSharp/Ast/AstLocation.cs deleted file mode 100644 index 624eb9bf31..0000000000 --- a/ICSharpCode.NRefactory/CSharp/Ast/AstLocation.cs +++ /dev/null @@ -1,147 +0,0 @@ -// -// DomLocation.cs -// -// Author: -// Mike Krüger -// -// Copyright (C) 2008 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 -{ - [Serializable] - public struct AstLocation : IComparable, IEquatable - { - public static readonly AstLocation Empty = new AstLocation(0, 0); - - readonly int line, column; - - public AstLocation (int line, int column) - { - this.line = line; - this.column = column; - } - - public bool IsEmpty { - get { - return line <= 0; - } - } - - public int Line { - get { return line; } - } - - public int Column { - get { return column; } - } - - public override bool Equals (object obj) - { - if (!(obj is AstLocation)) - return false; - return (AstLocation)obj == this; - } - - public override int GetHashCode () - { - unchecked { - return line + column * 5000; - } - } - - public bool Equals (AstLocation other) - { - return other == this; - } - - public int CompareTo (AstLocation other) - { - if (this == other) - return 0; - if (this < other) - return -1; - return 1; - } - - public override string ToString () - { - return String.Format ("(Line {0}, Column {1})", Line, Column); - } - - public static AstLocation FromInvariantString (string invariantString) - { - if (string.Equals(invariantString, "EMPTY", StringComparison.OrdinalIgnoreCase)) - return AstLocation.Empty; - string[] splits = invariantString.Split (',', '/'); - if (splits.Length == 2) - return new AstLocation (Int32.Parse (splits[0]), Int32.Parse (splits[1])); - return AstLocation.Empty; - } - - public string ToInvariantString () - { - if (IsEmpty) - return "Empty"; - return String.Format ("{0}/{1}", line, column); - } - - public static bool operator==(AstLocation left, AstLocation right) - { - return left.line == right.line && left.column == right.column; - } - - public static bool operator!=(AstLocation left, AstLocation right) - { - return left.line != right.line || left.column != right.column; - } - - public static bool operator<(AstLocation left, AstLocation right) - { - return left.line < right.line || left.line == right.line && left.column < right.column; - } - public static bool operator>(AstLocation left, AstLocation right) - { - return left.line > right.line || left.line == right.line && left.column > right.column; - } - public static bool operator<=(AstLocation left, AstLocation right) - { - return !(left > right); - } - public static bool operator>=(AstLocation left, AstLocation right) - { - return !(left < right); - } - - public static implicit operator AstLocation(ICSharpCode.Editor.TextLocation location) - { - return new AstLocation(location.Line, location.Column); - } - - public static implicit operator ICSharpCode.Editor.TextLocation(AstLocation location) - { - return new ICSharpCode.Editor.TextLocation(location.Line, location.Column); - } - } -} diff --git a/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj b/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj index 31fbee8d7e..7c4198ae73 100644 --- a/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj +++ b/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj @@ -34,7 +34,7 @@ bin\Debug\ Full False - DEBUG;TRACE;FULL_AST + DEBUG;TRACE False true @@ -42,8 +42,9 @@ bin\Release\ None True - TRACE;FULL_AST + TRACE False + false 4 @@ -58,168 +59,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + @@ -298,60 +165,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -359,73 +177,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -433,10 +188,6 @@ {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil - - {F054A788-B591-4561-A8BA-AE745BBEB817} - ICSharpCode.Editor - \ No newline at end of file diff --git a/ICSharpCode.NRefactory/PatternMatching/AnyNode.cs b/ICSharpCode.NRefactory/PatternMatching/AnyNode.cs index 8a78931cfb..ba142b14c3 100644 --- a/ICSharpCode.NRefactory/PatternMatching/AnyNode.cs +++ b/ICSharpCode.NRefactory/PatternMatching/AnyNode.cs @@ -42,10 +42,5 @@ namespace ICSharpCode.NRefactory.PatternMatching match.Add(this.groupName, other); return other != null && !other.IsNull; } - - public override S AcceptVisitor(IPatternAstVisitor visitor, T data) - { - return visitor.VisitAnyNode(this, data); - } } } diff --git a/ICSharpCode.NRefactory/PatternMatching/Backreference.cs b/ICSharpCode.NRefactory/PatternMatching/Backreference.cs index ac55e6f90d..0f0e0f96ac 100644 --- a/ICSharpCode.NRefactory/PatternMatching/Backreference.cs +++ b/ICSharpCode.NRefactory/PatternMatching/Backreference.cs @@ -43,45 +43,5 @@ namespace ICSharpCode.NRefactory.PatternMatching { return match.Get(referencedGroupName).Last().IsMatch(other); } - - public override S AcceptVisitor(IPatternAstVisitor visitor, T data) - { - return visitor.VisitBackreference(this, data); - } - } - - /// - /// Matches identifier expressions that have the same identifier as the referenced variable/type definition/method definition. - /// - public class IdentifierExpressionBackreference : Pattern - { - readonly string referencedGroupName; - - public string ReferencedGroupName { - get { return referencedGroupName; } - } - - public IdentifierExpressionBackreference(string referencedGroupName) - { - if (referencedGroupName == null) - throw new ArgumentNullException("referencedGroupName"); - this.referencedGroupName = referencedGroupName; - } - - public override bool DoMatch(INode other, Match match) - { - CSharp.IdentifierExpression ident = other as CSharp.IdentifierExpression; - if (ident == null || ident.TypeArguments.Any()) - return false; - CSharp.AstNode referenced = (CSharp.AstNode)match.Get(referencedGroupName).Last(); - if (referenced == null) - return false; - return ident.Identifier == referenced.GetChildByRole(CSharp.AstNode.Roles.Identifier).Name; - } - - public override S AcceptVisitor(IPatternAstVisitor visitor, T data) - { - return visitor.VisitIdentifierExpressionBackreference(this, data); - } } } diff --git a/ICSharpCode.NRefactory/PatternMatching/Choice.cs b/ICSharpCode.NRefactory/PatternMatching/Choice.cs index 9394d2d501..45e408bbf5 100644 --- a/ICSharpCode.NRefactory/PatternMatching/Choice.cs +++ b/ICSharpCode.NRefactory/PatternMatching/Choice.cs @@ -64,10 +64,5 @@ namespace ICSharpCode.NRefactory.PatternMatching { return alternatives.GetEnumerator(); } - - public override S AcceptVisitor(IPatternAstVisitor visitor, T data) - { - return visitor.VisitChoice(this, data); - } } } diff --git a/ICSharpCode.NRefactory/PatternMatching/IPatternAstVisitor.cs b/ICSharpCode.NRefactory/PatternMatching/IPatternAstVisitor.cs deleted file mode 100644 index 8bd0b32445..0000000000 --- a/ICSharpCode.NRefactory/PatternMatching/IPatternAstVisitor.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team -// -// 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.PatternMatching -{ - /// - /// AST visitor that works for patterns. - /// - public interface IPatternAstVisitor - { - S VisitAnyNode(AnyNode anyNode, T data); - S VisitBackreference(Backreference backreference, T data); - S VisitChoice(Choice choice, T data); - S VisitNamedNode(NamedNode namedNode, T data); - S VisitRepeat(Repeat repeat, T data); - S VisitOptionalNode(OptionalNode optionalNode, T data); - S VisitIdentifierExpressionBackreference(IdentifierExpressionBackreference identifierExpressionBackreference, T data); - } -} diff --git a/ICSharpCode.NRefactory/PatternMatching/NamedNode.cs b/ICSharpCode.NRefactory/PatternMatching/NamedNode.cs index 5bc36710d7..07f2138a6e 100644 --- a/ICSharpCode.NRefactory/PatternMatching/NamedNode.cs +++ b/ICSharpCode.NRefactory/PatternMatching/NamedNode.cs @@ -49,10 +49,5 @@ namespace ICSharpCode.NRefactory.PatternMatching match.Add(this.groupName, other); return childNode.DoMatch(other, match); } - - public override S AcceptVisitor(IPatternAstVisitor visitor, T data) - { - return visitor.VisitNamedNode(this, data); - } } } diff --git a/ICSharpCode.NRefactory/PatternMatching/OptionalNode.cs b/ICSharpCode.NRefactory/PatternMatching/OptionalNode.cs index b3fa1e3af1..c3c8a5529d 100644 --- a/ICSharpCode.NRefactory/PatternMatching/OptionalNode.cs +++ b/ICSharpCode.NRefactory/PatternMatching/OptionalNode.cs @@ -54,10 +54,5 @@ namespace ICSharpCode.NRefactory.PatternMatching else return childNode.DoMatch(other, match); } - - public override S AcceptVisitor(IPatternAstVisitor visitor, T data) - { - return visitor.VisitOptionalNode(this, data); - } } } diff --git a/ICSharpCode.NRefactory/PatternMatching/Pattern.cs b/ICSharpCode.NRefactory/PatternMatching/Pattern.cs index b53c72c701..d39b5713df 100644 --- a/ICSharpCode.NRefactory/PatternMatching/Pattern.cs +++ b/ICSharpCode.NRefactory/PatternMatching/Pattern.cs @@ -63,18 +63,6 @@ namespace ICSharpCode.NRefactory.PatternMatching return DoMatch (pos, match); } - public abstract S AcceptVisitor (IPatternAstVisitor visitor, T data); - - // Make debugging easier by giving Patterns a ToString() implementation - public override string ToString() - { - // TODO: what if this pattern contains a VB-AST? - // either remove ToString() here, or add some magic to figure out the correct output visitor - StringWriter w = new StringWriter(); - AcceptVisitor(new CSharp.OutputVisitor(w, new CSharp.CSharpFormattingOptions()), null); - return w.ToString(); - } - public static bool DoMatchCollection(Role role, INode firstPatternChild, INode firstOtherChild, Match match) { BacktrackingInfo backtrackingInfo = new BacktrackingInfo(); diff --git a/ICSharpCode.NRefactory/PatternMatching/Repeat.cs b/ICSharpCode.NRefactory/PatternMatching/Repeat.cs index 9311041d92..c0118238bd 100644 --- a/ICSharpCode.NRefactory/PatternMatching/Repeat.cs +++ b/ICSharpCode.NRefactory/PatternMatching/Repeat.cs @@ -70,10 +70,5 @@ namespace ICSharpCode.NRefactory.PatternMatching else return this.MaxCount >= 1 && childNode.DoMatch(other, match); } - - public override S AcceptVisitor(IPatternAstVisitor visitor, T data) - { - return visitor.VisitRepeat(this, data); - } } } diff --git a/ICSharpCode.NRefactory/CSharp/Ast/Role.cs b/ICSharpCode.NRefactory/Role.cs similarity index 100% rename from ICSharpCode.NRefactory/CSharp/Ast/Role.cs rename to ICSharpCode.NRefactory/Role.cs diff --git a/ICSharpCode.NRefactory/Semantics/InvocationResolveResult.cs b/ICSharpCode.NRefactory/Semantics/InvocationResolveResult.cs index 2d9a679452..9ea5416924 100644 --- a/ICSharpCode.NRefactory/Semantics/InvocationResolveResult.cs +++ b/ICSharpCode.NRefactory/Semantics/InvocationResolveResult.cs @@ -20,7 +20,6 @@ using System; using System.Collections.Generic; using System.Linq; -using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem.Implementation; @@ -29,82 +28,19 @@ namespace ICSharpCode.NRefactory.Semantics /// /// Represents the result of a method invocation. /// - public class InvocationResolveResult : MemberResolveResult + public abstract class InvocationResolveResult : MemberResolveResult { - public readonly OverloadResolutionErrors OverloadResolutionErrors; - - public readonly IList Arguments; - - /// - /// Gets whether this invocation is calling an extension method using extension method syntax. - /// - public readonly bool IsExtensionMethodInvocation; - - /// - /// Gets whether this invocation is calling a delegate (without explicitly calling ".Invoke()"). - /// - public readonly bool IsDelegateInvocation; - - /// - /// Gets whether a params-Array is being used in its expanded form. - /// - public readonly bool IsExpandedForm; - /// - /// Gets whether this is a lifted operator invocation. + /// Gets the arguments that are being passed to the method. /// - public readonly bool IsLiftedOperatorInvocation; - - readonly IList argumentToParameterMap; - - public InvocationResolveResult(ResolveResult targetResult, OverloadResolution or, ITypeResolveContext context) - : base( - or.IsExtensionMethodInvocation ? null : targetResult, - or.GetBestCandidateWithSubstitutedTypeArguments(), - context) - { - this.OverloadResolutionErrors = or.BestCandidateErrors; - this.argumentToParameterMap = or.GetArgumentToParameterMap(); - this.Arguments = or.GetArgumentsWithConversions(); - - this.IsExtensionMethodInvocation = or.IsExtensionMethodInvocation; - this.IsExpandedForm = or.BestCandidateIsExpandedForm; - this.IsLiftedOperatorInvocation = or.BestCandidate is OverloadResolution.ILiftedOperator; - } + public readonly IList Arguments; public InvocationResolveResult( ResolveResult targetResult, IParameterizedMember member, IType returnType, - IList arguments, - OverloadResolutionErrors overloadResolutionErrors = OverloadResolutionErrors.None, - bool isExtensionMethodInvocation = false, - bool isExpandedForm = false, - bool isLiftedOperatorInvocation = false, - bool isDelegateInvocation = false, - IList argumentToParameterMap = null) + IList arguments) : base(targetResult, member, returnType) { - this.OverloadResolutionErrors = overloadResolutionErrors; this.Arguments = arguments ?? EmptyList.Instance; - this.IsExtensionMethodInvocation = isExtensionMethodInvocation; - this.IsExpandedForm = isExpandedForm; - this.IsLiftedOperatorInvocation = isLiftedOperatorInvocation; - this.IsDelegateInvocation = isDelegateInvocation; - this.argumentToParameterMap = argumentToParameterMap; - } - - public override bool IsError { - get { return this.OverloadResolutionErrors != OverloadResolutionErrors.None; } - } - - /// - /// Gets an array that maps argument indices to parameter indices. - /// For arguments that could not be mapped to any parameter, the value will be -1. - /// - /// parameterIndex = ArgumentToParameterMap[argumentIndex] - /// - public IList GetArgumentToParameterMap() - { - return argumentToParameterMap; } public new IParameterizedMember Member { diff --git a/ICSharpCode.NRefactory/TextLocation.cs b/ICSharpCode.NRefactory/TextLocation.cs new file mode 100644 index 0000000000..4bc7a81e00 --- /dev/null +++ b/ICSharpCode.NRefactory/TextLocation.cs @@ -0,0 +1,188 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// +// 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; +using System.Globalization; + +namespace ICSharpCode.NRefactory +{ + /// + /// A line/column position. + /// Text editor lines/columns are counted started from one. + /// + /// + /// The document provides the methods and + /// to convert between offsets and TextLocations. + /// + [Serializable] + public struct TextLocation : IComparable, IEquatable + { + /// + /// Represents no text location (0, 0). + /// + public static readonly TextLocation Empty = new TextLocation(0, 0); + + /// + /// Constant of the minimum line. + /// + public const int MinLine = 1; + + /// + /// Constant of the minimum column. + /// + public const int MinColumn = 1; + + /// + /// Creates a TextLocation instance. + /// + public TextLocation(int line, int column) + { + this.line = line; + this.column = column; + } + + int column, line; + + /// + /// Gets the line number. + /// + public int Line { + get { return line; } + } + + /// + /// Gets the column number. + /// + public int Column { + get { return column; } + } + + /// + /// Gets whether the TextLocation instance is empty. + /// + public bool IsEmpty { + get { + return column < MinLine && line < MinColumn; + } + } + + /// + /// Gets a string representation for debugging purposes. + /// + public override string ToString() + { + return string.Format(CultureInfo.InvariantCulture, "(Line {1}, Col {0})", this.column, this.line); + } + + /// + /// Gets a hash code. + /// + public override int GetHashCode() + { + return unchecked (191 * column.GetHashCode() ^ line.GetHashCode()); + } + + /// + /// Equality test. + /// + public override bool Equals(object obj) + { + if (!(obj is TextLocation)) return false; + return (TextLocation)obj == this; + } + + /// + /// Equality test. + /// + public bool Equals(TextLocation other) + { + return this == other; + } + + /// + /// Equality test. + /// + public static bool operator ==(TextLocation left, TextLocation right) + { + return left.column == right.column && left.line == right.line; + } + + /// + /// Inequality test. + /// + public static bool operator !=(TextLocation left, TextLocation right) + { + return left.column != right.column || left.line != right.line; + } + + /// + /// Compares two text locations. + /// + public static bool operator <(TextLocation left, TextLocation right) + { + if (left.line < right.line) + return true; + else if (left.line == right.line) + return left.column < right.column; + else + return false; + } + + /// + /// Compares two text locations. + /// + public static bool operator >(TextLocation left, TextLocation right) + { + if (left.line > right.line) + return true; + else if (left.line == right.line) + return left.column > right.column; + else + return false; + } + + /// + /// Compares two text locations. + /// + public static bool operator <=(TextLocation left, TextLocation right) + { + return !(left > right); + } + + /// + /// Compares two text locations. + /// + public static bool operator >=(TextLocation left, TextLocation right) + { + return !(left < right); + } + + /// + /// Compares two text locations. + /// + public int CompareTo(TextLocation other) + { + if (this == other) + return 0; + if (this < other) + return -1; + else + return 1; + } + } +} diff --git a/ICSharpCode.NRefactory/TypeSystem/DomRegion.cs b/ICSharpCode.NRefactory/TypeSystem/DomRegion.cs index b8d9493433..523b60ed94 100644 --- a/ICSharpCode.NRefactory/TypeSystem/DomRegion.cs +++ b/ICSharpCode.NRefactory/TypeSystem/DomRegion.cs @@ -18,7 +18,6 @@ using System; using System.Globalization; -using ICSharpCode.NRefactory.CSharp; namespace ICSharpCode.NRefactory.TypeSystem { @@ -75,15 +74,15 @@ namespace ICSharpCode.NRefactory.TypeSystem } } - public AstLocation Begin { + public TextLocation Begin { get { - return new AstLocation (beginLine, beginColumn); + return new TextLocation (beginLine, beginColumn); } } - public AstLocation End { + public TextLocation End { get { - return new AstLocation (endLine, endColumn); + return new TextLocation (endLine, endColumn); } } @@ -113,11 +112,11 @@ namespace ICSharpCode.NRefactory.TypeSystem this.endColumn = -1; } - public DomRegion (AstLocation begin, AstLocation end) : this (null, begin, end) + public DomRegion (TextLocation begin, TextLocation end) : this (null, begin, end) { } - public DomRegion (string fileName, AstLocation begin, AstLocation end) + public DomRegion (string fileName, TextLocation begin, TextLocation end) { this.fileName = fileName; this.beginLine = begin.Line; @@ -126,11 +125,11 @@ namespace ICSharpCode.NRefactory.TypeSystem this.endColumn = end.Column; } - public DomRegion (AstLocation begin) : this (null, begin) + public DomRegion (TextLocation begin) : this (null, begin) { } - public DomRegion (string fileName, AstLocation begin) + public DomRegion (string fileName, TextLocation begin) { this.fileName = fileName; this.beginLine = begin.Line; @@ -153,7 +152,7 @@ namespace ICSharpCode.NRefactory.TypeSystem (line != EndLine || column <= EndColumn); } - public bool IsInside(AstLocation location) + public bool IsInside(TextLocation location) { return IsInside(location.Line, location.Column); } diff --git a/ICSharpCode.NRefactory/TypeSystem/Error.cs b/ICSharpCode.NRefactory/TypeSystem/Error.cs index 7487f12fc5..ade3d45c88 100644 --- a/ICSharpCode.NRefactory/TypeSystem/Error.cs +++ b/ICSharpCode.NRefactory/TypeSystem/Error.cs @@ -25,7 +25,6 @@ // THE SOFTWARE. using System; -using ICSharpCode.NRefactory.CSharp; namespace ICSharpCode.NRefactory.TypeSystem { @@ -95,7 +94,7 @@ namespace ICSharpCode.NRefactory.TypeSystem /// /// The location of the error. /// - public Error (ErrorType errorType, string message, AstLocation location) + public Error (ErrorType errorType, string message, TextLocation location) { this.errorType = errorType; this.message = message; @@ -117,7 +116,7 @@ namespace ICSharpCode.NRefactory.TypeSystem /// /// The column of the error. /// - public Error (ErrorType errorType, string message, int line, int col) : this (errorType, message, new AstLocation (line, col)) + public Error (ErrorType errorType, string message, int line, int col) : this (errorType, message, new TextLocation (line, col)) { } diff --git a/ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs b/ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs index 8398024774..f1ed305f7a 100644 --- a/ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs +++ b/ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs @@ -21,8 +21,6 @@ using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.TypeSystem.Implementation; using ICSharpCode.NRefactory.Utils; -using ICSharpCode.NRefactory.CSharp.Refactoring; -using ICSharpCode.NRefactory.CSharp; namespace ICSharpCode.NRefactory.TypeSystem { @@ -255,7 +253,7 @@ namespace ICSharpCode.NRefactory.TypeSystem /// public static ITypeDefinition GetInnermostTypeDefinition (this IParsedFile file, int line, int column) { - return file.GetInnermostTypeDefinition (new AstLocation (line, column)); + return file.GetInnermostTypeDefinition (new TextLocation (line, column)); } /// @@ -264,7 +262,7 @@ namespace ICSharpCode.NRefactory.TypeSystem /// public static IMember GetMember (this IParsedFile file, int line, int column) { - return file.GetMember (new AstLocation (line, column)); + return file.GetMember (new TextLocation (line, column)); } #endregion diff --git a/ICSharpCode.NRefactory/TypeSystem/IAttribute.cs b/ICSharpCode.NRefactory/TypeSystem/IAttribute.cs index c6d5aa3695..5743278bd3 100644 --- a/ICSharpCode.NRefactory/TypeSystem/IAttribute.cs +++ b/ICSharpCode.NRefactory/TypeSystem/IAttribute.cs @@ -20,7 +20,6 @@ using System; using System.Collections.Generic; using System.Diagnostics.Contracts; -using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; namespace ICSharpCode.NRefactory.TypeSystem diff --git a/ICSharpCode.NRefactory/TypeSystem/IConstantValue.cs b/ICSharpCode.NRefactory/TypeSystem/IConstantValue.cs index 2af4f80bc6..342ec2c4da 100644 --- a/ICSharpCode.NRefactory/TypeSystem/IConstantValue.cs +++ b/ICSharpCode.NRefactory/TypeSystem/IConstantValue.cs @@ -18,7 +18,6 @@ using System; using System.Diagnostics.Contracts; -using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; namespace ICSharpCode.NRefactory.TypeSystem diff --git a/ICSharpCode.NRefactory/TypeSystem/IParsedFile.cs b/ICSharpCode.NRefactory/TypeSystem/IParsedFile.cs index e39ea7ac81..625d769448 100644 --- a/ICSharpCode.NRefactory/TypeSystem/IParsedFile.cs +++ b/ICSharpCode.NRefactory/TypeSystem/IParsedFile.cs @@ -18,7 +18,6 @@ using System; using System.Collections.Generic; -using ICSharpCode.NRefactory.CSharp; namespace ICSharpCode.NRefactory.TypeSystem { @@ -61,19 +60,19 @@ namespace ICSharpCode.NRefactory.TypeSystem /// Gets the top-level type defined at the specified location. /// Returns null if no type is defined at that location. /// - ITypeDefinition GetTopLevelTypeDefinition(AstLocation location); + ITypeDefinition GetTopLevelTypeDefinition(TextLocation location); /// /// Gets the type (potentially a nested type) defined at the specified location. /// Returns null if no type is defined at that location. /// - ITypeDefinition GetInnermostTypeDefinition(AstLocation location); + ITypeDefinition GetInnermostTypeDefinition(TextLocation location); /// /// Gets the member defined at the specified location. /// Returns null if no member is defined at that location. /// - IMember GetMember(AstLocation location); + IMember GetMember(TextLocation location); /// /// Gets the parser errors. diff --git a/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractType.cs b/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractType.cs index d070a81471..d05baba10a 100644 --- a/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractType.cs +++ b/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractType.cs @@ -120,10 +120,11 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation public virtual IEnumerable GetMembers(ITypeResolveContext context, Predicate filter = null, GetMemberOptions options = GetMemberOptions.None) { - return GetMethods(context, filter, options).SafeCast() - .Concat(GetProperties(context, filter, options).SafeCast()) - .Concat(GetFields(context, filter, options).SafeCast()) - .Concat(GetEvents(context, filter, options).SafeCast()); + IEnumerable members = GetMethods(context, filter, options); + return members + .Concat(GetProperties(context, filter, options)) + .Concat(GetFields(context, filter, options)) + .Concat(GetEvents(context, filter, options)); } public override bool Equals(object obj) diff --git a/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultAttribute.cs b/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultAttribute.cs index 825e0d3563..a779f314f6 100644 --- a/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultAttribute.cs +++ b/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultAttribute.cs @@ -22,7 +22,6 @@ using System.Collections.ObjectModel; using System.Linq; using System.Text; -using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; namespace ICSharpCode.NRefactory.TypeSystem.Implementation diff --git a/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultTypeDefinition.cs b/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultTypeDefinition.cs index 6f16e383db..e05d7f079c 100644 --- a/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultTypeDefinition.cs +++ b/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultTypeDefinition.cs @@ -208,10 +208,11 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation public IEnumerable Members { get { - return this.Fields.SafeCast() - .Concat(this.Properties.SafeCast()) - .Concat(this.Methods.SafeCast()) - .Concat(this.Events.SafeCast()); + IEnumerable members = this.Fields; + return members + .Concat(this.Properties) + .Concat(this.Methods) + .Concat(this.Events); } } diff --git a/ICSharpCode.NRefactory/TypeSystem/Implementation/GetClassTypeReference.cs b/ICSharpCode.NRefactory/TypeSystem/Implementation/GetClassTypeReference.cs index b2632d0193..72510f8d26 100644 --- a/ICSharpCode.NRefactory/TypeSystem/Implementation/GetClassTypeReference.cs +++ b/ICSharpCode.NRefactory/TypeSystem/Implementation/GetClassTypeReference.cs @@ -17,7 +17,6 @@ // DEALINGS IN THE SOFTWARE. using System; -using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.Utils; namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -97,9 +96,18 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation public override string ToString() { if (typeParameterCount == 0) - return NamespaceDeclaration.BuildQualifiedName(nameSpace, name); + return BuildQualifiedName(nameSpace, name); else - return NamespaceDeclaration.BuildQualifiedName(nameSpace, name) + "`" + typeParameterCount; + return BuildQualifiedName(nameSpace, name) + "`" + typeParameterCount; + } + + static string BuildQualifiedName (string name1, string name2) + { + if (string.IsNullOrEmpty (name1)) + return name2; + if (string.IsNullOrEmpty (name2)) + return name1; + return name1 + "." + name2; } void ISupportsInterning.PrepareForInterning(IInterningProvider provider) diff --git a/ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleConstantValue.cs b/ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleConstantValue.cs index 784c186439..05c37c21a0 100644 --- a/ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleConstantValue.cs +++ b/ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleConstantValue.cs @@ -17,7 +17,6 @@ // DEALINGS IN THE SOFTWARE. using System; -using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; namespace ICSharpCode.NRefactory.TypeSystem.Implementation diff --git a/ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs b/ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs index a3e2a227dd..4aa387059c 100644 --- a/ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs +++ b/ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs @@ -140,7 +140,7 @@ namespace ICSharpCode.NRefactory.TypeSystem /// /// Same as 'parameterizedType.TypeArguments[index]', but is a bit more efficient. /// - internal IType GetTypeArgument(int index) + public IType GetTypeArgument(int index) { return typeArguments[index]; } diff --git a/ICSharpCode.NRefactory/TypeSystem/ReflectionHelper.cs b/ICSharpCode.NRefactory/TypeSystem/ReflectionHelper.cs index cb6f4c235c..809f820c6c 100644 --- a/ICSharpCode.NRefactory/TypeSystem/ReflectionHelper.cs +++ b/ICSharpCode.NRefactory/TypeSystem/ReflectionHelper.cs @@ -236,12 +236,12 @@ namespace ICSharpCode.NRefactory.TypeSystem get { return typeNamesByTypeCode.Length; } } - internal static string GetShortNameByTypeCode(TypeCode typeCode) + public static string GetShortNameByTypeCode(TypeCode typeCode) { return typeNamesByTypeCode[(int)typeCode]; } - internal static string GetCSharpNameByTypeCode(TypeCode typeCode) + public static string GetCSharpNameByTypeCode(TypeCode typeCode) { return csharpTypeNamesByTypeCode[(int)typeCode]; } diff --git a/ICSharpCode.NRefactory/Utils/DotNet35Compat.cs b/ICSharpCode.NRefactory/Utils/DotNet35Compat.cs deleted file mode 100644 index b5fa230864..0000000000 --- a/ICSharpCode.NRefactory/Utils/DotNet35Compat.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team -// -// 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; -using System.Collections.Generic; -using System.Linq; - -internal static class DotNet35Compat -{ - public static string StringJoin(string separator, IEnumerable elements) - { - #if DOTNET35 - return string.Join(separator, elements.Select(e => e != null ? e.ToString() : null).ToArray()); - #else - return string.Join(separator, elements); - #endif - } - - public static IEnumerable SafeCast(this IEnumerable elements) where T : class, U where U : class - { - #if DOTNET35 - foreach (T item in elements) - yield return item; - #else - return elements; - #endif - } - - public static Predicate SafeCast(this Predicate predicate) where U : class, T where T : class - { - #if DOTNET35 - return e => predicate(e); - #else - return predicate; - #endif - } - - #if DOTNET35 - public static IEnumerable Zip(this IEnumerable input1, IEnumerable input2, Func f) - { - using (var e1 = input1.GetEnumerator()) - using (var e2 = input2.GetEnumerator()) - while (e1.MoveNext() && e2.MoveNext()) - yield return f(e1.Current, e2.Current); - } - #endif -} - -#if DOTNET35 -namespace System.Diagnostics.Contracts { } -namespace System.Threading -{ - internal struct CancellationToken - { - public void ThrowIfCancellationRequested() {} - } -} -#endif diff --git a/ICSharpCode.NRefactory/Utils/EmptyList.cs b/ICSharpCode.NRefactory/Utils/EmptyList.cs index f39e6f2916..ed566005b9 100644 --- a/ICSharpCode.NRefactory/Utils/EmptyList.cs +++ b/ICSharpCode.NRefactory/Utils/EmptyList.cs @@ -24,7 +24,7 @@ using System.Collections.ObjectModel; namespace ICSharpCode.NRefactory { [Serializable] - sealed class EmptyList : IList, IEnumerator + public sealed class EmptyList : IList, IEnumerator { public static readonly IList Instance = new EmptyList(); diff --git a/ICSharpCode.NRefactory/Utils/Platform.cs b/ICSharpCode.NRefactory/Utils/Platform.cs index 6adfa89ce3..ff6a5f2a2d 100644 --- a/ICSharpCode.NRefactory/Utils/Platform.cs +++ b/ICSharpCode.NRefactory/Utils/Platform.cs @@ -23,7 +23,7 @@ namespace ICSharpCode.NRefactory.Utils /// /// Platform-specific code. /// - static class Platform + public static class Platform { public static StringComparer FileNameComparer { get { diff --git a/NRefactory.sln b/NRefactory.sln index 5b81c02160..392cb6e65d 100644 --- a/NRefactory.sln +++ b/NRefactory.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -# SharpDevelop 4.1.0.7854-beta +# SharpDevelop 4.1.0.7887-beta Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DC98210E-1646-483B-819A-2BB8272461E4}" ProjectSection(SolutionItems) = preProject README = README