Browse Source

Merge in the latest NRefactory (8db1fe252f6539e9cde8c9fb5f59aa60e4089d8f)

pull/10/head
Daniel Grunwald 15 years ago
parent
commit
25c17f1e22
  1. 2
      ICSharpCode.Decompiler/Ast/CommentStatement.cs
  2. 21
      NRefactory/ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs
  3. 9
      NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/GotoStatementTests.cs
  4. 4
      NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/WhileStatementTests.cs
  5. 3
      NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/CecilLoaderTests.cs
  6. 6
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs
  7. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/AstType.cs
  8. 6
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/CSharpTokenNode.cs
  9. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/CompilationUnit.cs
  10. 12
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/ComposedType.cs
  11. 26
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/DepthFirstAstVisitor.cs
  12. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/AnonymousMethodExpression.cs
  13. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ArgListExpression.cs
  14. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ArrayCreateExpression.cs
  15. 6
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ArrayInitializerExpression.cs
  16. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/AsExpression.cs
  17. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/AssignmentExpression.cs
  18. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/BaseReferenceExpression.cs
  19. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/BinaryOperatorExpression.cs
  20. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/CastExpression.cs
  21. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/CheckedExpression.cs
  22. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ConditionalExpression.cs
  23. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/DefaultValueExpression.cs
  24. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/DirectionExpression.cs
  25. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/Expression.cs
  26. 9
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/IdentifierExpression.cs
  27. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/IndexerExpression.cs
  28. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/InvocationExpression.cs
  29. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/IsExpression.cs
  30. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/LambdaExpression.cs
  31. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/MemberReferenceExpression.cs
  32. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/NamedArgumentExpression.cs
  33. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/NullReferenceExpression.cs
  34. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ObjectCreateExpression.cs
  35. 7
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ParenthesizedExpression.cs
  36. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/PointerReferenceExpression.cs
  37. 7
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/PrimitiveExpression.cs
  38. 24
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/QueryExpression.cs
  39. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/SizeOfExpression.cs
  40. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/StackAllocExpression.cs
  41. 7
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ThisReferenceExpression.cs
  42. 7
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/TypeOfExpression.cs
  43. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/TypeReferenceExpression.cs
  44. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/UnaryOperatorExpression.cs
  45. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/UncheckedExpression.cs
  46. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Attribute.cs
  47. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/AttributeSection.cs
  48. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Comment.cs
  49. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Constraint.cs
  50. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/DelegateDeclaration.cs
  51. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/NamespaceDeclaration.cs
  52. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/TypeDeclaration.cs
  53. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/TypeParameterDeclaration.cs
  54. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/UsingAliasDeclaration.cs
  55. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/UsingDeclaration.cs
  56. 6
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/IAstVisitor.cs
  57. 6
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Identifier.cs
  58. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/MemberType.cs
  59. 12
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PrimitiveType.cs
  60. 9
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/SimpleType.cs
  61. 6
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/BlockStatement.cs
  62. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/BreakStatement.cs
  63. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/CheckedStatement.cs
  64. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/ContinueStatement.cs
  65. 73
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/DoWhileStatement.cs
  66. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/EmptyStatement.cs
  67. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/ExpressionStatement.cs
  68. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/FixedStatement.cs
  69. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/ForStatement.cs
  70. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/ForeachStatement.cs
  71. 86
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/GotoStatement.cs
  72. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/IfElseStatement.cs
  73. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/LabelStatement.cs
  74. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/LockStatement.cs
  75. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/ReturnStatement.cs
  76. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/Statement.cs
  77. 8
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/SwitchStatement.cs
  78. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/ThrowStatement.cs
  79. 28
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/TryCatchStatement.cs
  80. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/UncheckedStatement.cs
  81. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/UnsafeStatement.cs
  82. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/UsingStatement.cs
  83. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/VariableDeclarationStatement.cs
  84. 25
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/WhileStatement.cs
  85. 54
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/YieldBreakStatement.cs
  86. 12
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/YieldStatement.cs
  87. 6
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/Accessor.cs
  88. 8
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/ConstructorDeclaration.cs
  89. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/DestructorDeclaration.cs
  90. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/EnumMemberDeclaration.cs
  91. 14
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/EventDeclaration.cs
  92. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/FieldDeclaration.cs
  93. 12
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/IndexerDeclaration.cs
  94. 5
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/MethodDeclaration.cs
  95. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/OperatorDeclaration.cs
  96. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/ParameterDeclaration.cs
  97. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/PropertyDeclaration.cs
  98. 5
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/VariableInitializer.cs
  99. 95
      NRefactory/ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs
  100. 243
      NRefactory/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs
  101. Some files were not shown because too many files have changed in this diff Show More

2
ICSharpCode.Decompiler/Ast/CommentStatement.cs

@ -22,7 +22,7 @@ namespace Decompiler @@ -22,7 +22,7 @@ namespace Decompiler
this.comment = comment;
}
public override S AcceptVisitor<T, S>(AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return default(S);
}

21
NRefactory/ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs

@ -108,6 +108,27 @@ namespace ICSharpCode.NRefactory.CSharp @@ -108,6 +108,27 @@ namespace ICSharpCode.NRefactory.CSharp
Assert.AreEqual("-(-a)", InsertReadable(expr));
}
[Test]
public void AdditionWithConditional()
{
Expression expr = new BinaryOperatorExpression {
Left = new IdentifierExpression("a"),
Operator = BinaryOperatorType.Add,
Right = new ConditionalExpression {
Condition = new BinaryOperatorExpression {
Left = new IdentifierExpression("b"),
Operator = BinaryOperatorType.Equality,
Right = new PrimitiveExpression(null)
},
TrueExpression = new IdentifierExpression("c"),
FalseExpression = new IdentifierExpression("d")
}
};
Assert.AreEqual("a + (b == null ? c : d)", InsertRequired(expr));
Assert.AreEqual("a + ((b == null) ? c : d)", InsertReadable(expr));
}
[Test]
public void TypeTestInConditional()
{

9
NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/GotoStatementTests.cs

@ -13,23 +13,20 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements @@ -13,23 +13,20 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements
[Test, Ignore("regular goto statement is broken")]
public void GotoStatementTest()
{
GotoStatement gotoStmt = ParseUtilCSharp.ParseStatement<GotoStatement>("goto myLabel;");
Assert.AreEqual(GotoType.Label, gotoStmt.GotoType);
var gotoStmt = ParseUtilCSharp.ParseStatement<GotoStatement>("goto myLabel;");
Assert.AreEqual("myLabel", gotoStmt.Label);
}
[Test]
public void GotoDefaultStatementTest()
{
GotoStatement gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoStatement>("goto default;");
Assert.AreEqual(GotoType.CaseDefault, gotoCaseStmt.GotoType);
var gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoDefaultStatement>("goto default;");
}
[Test]
public void GotoCaseStatementTest()
{
GotoStatement gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoStatement>("goto case 6;");
Assert.AreEqual(GotoType.Case, gotoCaseStmt.GotoType);
var gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoCaseStatement>("goto case 6;");
Assert.IsTrue(gotoCaseStmt.LabelExpression is PrimitiveExpression);
}

4
NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/WhileStatementTests.cs

@ -13,7 +13,6 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements @@ -13,7 +13,6 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements
public void WhileStatementTest()
{
WhileStatement loopStmt = ParseUtilCSharp.ParseStatement<WhileStatement>("while (true) { }");
Assert.AreEqual(WhilePosition.Begin, loopStmt.WhilePosition);
Assert.IsTrue(loopStmt.Condition is PrimitiveExpression);
Assert.IsTrue(loopStmt.EmbeddedStatement is BlockStatement);
}
@ -21,8 +20,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements @@ -21,8 +20,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements
[Test]
public void DoWhileStatementTest()
{
WhileStatement loopStmt = ParseUtilCSharp.ParseStatement<WhileStatement>("do { } while (true);");
Assert.AreEqual(WhilePosition.End, loopStmt.WhilePosition);
DoWhileStatement loopStmt = ParseUtilCSharp.ParseStatement<DoWhileStatement>("do { } while (true);");
Assert.IsTrue(loopStmt.Condition is PrimitiveExpression);
Assert.IsTrue(loopStmt.EmbeddedStatement is BlockStatement);
}

3
NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/CecilLoaderTests.cs

@ -153,7 +153,8 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -153,7 +153,8 @@ namespace ICSharpCode.NRefactory.TypeSystem
IProperty count = valueCollection.Properties.Single(p => p.Name == "Count");
Assert.AreEqual(Accessibility.Public, count.Accessibility);
Assert.IsTrue(count.IsSealed);
// It's sealed on the IL level; but in C# it's just a normal non-virtual method that happens to implement an interface
Assert.IsFalse(count.IsSealed);
Assert.IsFalse(count.IsVirtual);
Assert.IsFalse(count.IsAbstract);
}

6
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// AstNode.cs
//
// Author:
@ -51,7 +51,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -51,7 +51,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}
@ -592,7 +592,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -592,7 +592,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
#endregion
public abstract S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data);
public abstract S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data);
// the Root role must be available when creating the null nodes, so we can't put it in the Roles class
static readonly Role<AstNode> RootRole = new Role<AstNode>("Root");

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

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
using System;
using System;
namespace ICSharpCode.NRefactory.CSharp
{
@ -18,7 +18,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -18,7 +18,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}

6
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/CSharpTokenNode.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// TokenNode.cs
//
// Author:
@ -42,7 +42,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -42,7 +42,7 @@ namespace ICSharpCode.NRefactory.CSharp
{
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}
@ -75,7 +75,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -75,7 +75,7 @@ namespace ICSharpCode.NRefactory.CSharp
this.tokenLength = tokenLength;
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitCSharpTokenNode (this, data);
}

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

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// CompilationUnit.cs
//
// Author:
@ -95,7 +95,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -95,7 +95,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitCompilationUnit (this, data);
}

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

@ -72,7 +72,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -72,7 +72,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (ArraySpecifierRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitComposedType (this, data);
}
@ -129,6 +129,10 @@ namespace ICSharpCode.NRefactory.CSharp @@ -129,6 +129,10 @@ namespace ICSharpCode.NRefactory.CSharp
this.Dimensions = dimensions;
}
public CSharpTokenNode LBracketToken {
get { return GetChildByRole (Roles.LBracket); }
}
public int Dimensions {
get { return 1 + GetChildrenByRole(Roles.Comma).Count(); }
set {
@ -144,7 +148,11 @@ namespace ICSharpCode.NRefactory.CSharp @@ -144,7 +148,11 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public CSharpTokenNode RBracketToken {
get { return GetChildByRole (Roles.RBracket); }
}
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitArraySpecifier(this, data);
}

26
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/DepthFirstAstVisitor.cs

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
//
// AstVisitor.cs
//
// IAstVisitor.cs
//
// Author:
// Mike Krüger <mkrueger@novell.com>
@ -31,7 +31,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -31,7 +31,7 @@ namespace ICSharpCode.NRefactory.CSharp
/// <summary>
/// AST visitor with a default implementation that visits all node depth-first.
/// </summary>
public abstract class DepthFirstAstVisitor<T, S> : AstVisitor<T, S>
public abstract class DepthFirstAstVisitor<T, S> : IAstVisitor<T, S>
{
protected virtual S VisitChildren (AstNode node, T data)
{
@ -225,6 +225,11 @@ namespace ICSharpCode.NRefactory.CSharp @@ -225,6 +225,11 @@ namespace ICSharpCode.NRefactory.CSharp
return VisitChildren (continueStatement, data);
}
public virtual S VisitDoWhileStatement (DoWhileStatement doWhileStatement, T data)
{
return VisitChildren (doWhileStatement, data);
}
public virtual S VisitEmptyStatement (EmptyStatement emptyStatement, T data)
{
return VisitChildren (emptyStatement, data);
@ -245,6 +250,16 @@ namespace ICSharpCode.NRefactory.CSharp @@ -245,6 +250,16 @@ namespace ICSharpCode.NRefactory.CSharp
return VisitChildren (forStatement, data);
}
public virtual S VisitGotoCaseStatement (GotoCaseStatement gotoCaseStatement, T data)
{
return VisitChildren (gotoCaseStatement, data);
}
public virtual S VisitGotoDefaultStatement (GotoDefaultStatement gotoDefaultStatement, T data)
{
return VisitChildren (gotoDefaultStatement, data);
}
public virtual S VisitGotoStatement (GotoStatement gotoStatement, T data)
{
return VisitChildren (gotoStatement, data);
@ -325,6 +340,11 @@ namespace ICSharpCode.NRefactory.CSharp @@ -325,6 +340,11 @@ namespace ICSharpCode.NRefactory.CSharp
return VisitChildren (whileStatement, data);
}
public virtual S VisitYieldBreakStatement (YieldBreakStatement yieldBreakStatement, T data)
{
return VisitChildren (yieldBreakStatement, data);
}
public virtual S VisitYieldStatement (YieldStatement yieldStatement, T data)
{
return VisitChildren (yieldStatement, data);

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/AnonymousMethodExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// AnonymousMethodExpression.cs
//
// Author:
@ -61,7 +61,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -61,7 +61,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Body, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitAnonymousMethodExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ArgListExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ArgListExpression.cs
//
// Author:
@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RPar); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitArgListExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ArrayCreateExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
namespace ICSharpCode.NRefactory.CSharp
@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (InitializerRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitArrayCreateExpression (this, data);
}

6
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ArrayInitializerExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ArrayInitializerExpression.cs
//
// Author:
@ -44,7 +44,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -44,7 +44,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}
@ -64,7 +64,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -64,7 +64,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RBrace); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitArrayInitializerExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/AsExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// AsExpression.cs
//
// Author:
@ -45,7 +45,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -45,7 +45,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole(Roles.Type, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitAsExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/AssignmentExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// AssignmentExpression.cs
//
// Author:
@ -67,7 +67,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -67,7 +67,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole(RightRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitAssignmentExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/BaseReferenceExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// BaseReferenceExpression.cs
//
// Author:
@ -47,7 +47,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -47,7 +47,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitBaseReferenceExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/BinaryOperatorExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// BinaryOperatorExpression.cs
//
// Author:
@ -67,7 +67,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -67,7 +67,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole(RightRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitBinaryOperatorExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/CastExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// CastExpression.cs
//
// Author:
@ -49,7 +49,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -49,7 +49,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Expression, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitCastExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/CheckedExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// CheckedExpression.cs
//
// Author:
@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RPar); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitCheckedExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ConditionalExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ConditionalExpression.cs
//
// Author:
@ -60,7 +60,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -60,7 +60,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole(FalseRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitConditionalExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/DefaultValueExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// DefaultValueExpression.cs
//
// Author:
@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RPar); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitDefaultValueExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/DirectionExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// DirectionExpression.cs
//
// Author:
@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Expression, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitDirectionExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/Expression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System;
@ -27,7 +27,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -27,7 +27,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}

9
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/IdentifierExpression.cs

@ -1,4 +1,3 @@ @@ -1,4 +1,3 @@
using System.Collections.Generic;
//
// IdentifierExpression.cs
//
@ -24,6 +23,7 @@ @@ -24,6 +23,7 @@
// 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.Collections.Generic;
namespace ICSharpCode.NRefactory.CSharp
{
@ -38,6 +38,11 @@ namespace ICSharpCode.NRefactory.CSharp @@ -38,6 +38,11 @@ namespace ICSharpCode.NRefactory.CSharp
this.Identifier = identifier;
}
public IdentifierExpression(string identifier, AstLocation location)
{
SetChildByRole(Roles.Identifier, new Identifier(identifier, location));
}
// public Identifier IdentifierToken {
// get { return GetChildByRole (Roles.Identifier); }
// }
@ -56,7 +61,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -56,7 +61,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (Roles.TypeArgument, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitIdentifierExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/IndexerExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// IndexerExpression.cs
//
// Author:
@ -51,7 +51,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -51,7 +51,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RBracket); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitIndexerExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/InvocationExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// InvocationExpression.cs
//
// Author:
@ -51,7 +51,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -51,7 +51,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RPar); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitInvocationExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/IsExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// TypeOfIsExpression.cs
//
// Author:
@ -45,7 +45,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -45,7 +45,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole(Roles.Type, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitIsExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/LambdaExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// LambdaExpression.cs
//
// Author:
@ -50,7 +50,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -50,7 +50,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (BodyRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitLambdaExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/MemberReferenceExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// MemberReferenceExpression.cs
//
// Author:
@ -60,7 +60,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -60,7 +60,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RChevron); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitMemberReferenceExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/NamedArgumentExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System;
@ -24,7 +24,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -24,7 +24,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Expression, value); }
}
public override S AcceptVisitor<T, S>(AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitNamedArgumentExpression(this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/NullReferenceExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// NullReferenceExpression.cs
//
// Author:
@ -31,7 +31,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -31,7 +31,7 @@ namespace ICSharpCode.NRefactory.CSharp
/// </summary>
public class NullReferenceExpression : Expression
{
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitNullReferenceExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ObjectCreateExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ObjectCreateExpression.cs
//
// Author:
@ -62,7 +62,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -62,7 +62,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (InitializerRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitObjectCreateExpression (this, data);
}

7
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ParenthesizedExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ParenthesizedExpression.cs
//
// Author:
@ -26,6 +26,9 @@ @@ -26,6 +26,9 @@
namespace ICSharpCode.NRefactory.CSharp
{
/// <summary>
/// ( Expression )
/// </summary>
public class ParenthesizedExpression : Expression
{
public CSharpTokenNode LParToken {
@ -41,7 +44,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -41,7 +44,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RPar); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitParenthesizedExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/PointerReferenceExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// PointerReferenceExpression.cs
//
// Author:
@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (Roles.TypeArgument, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitPointerReferenceExpression (this, data);
}

7
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/PrimitiveExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// PrimitiveExpression.cs
//
// Author:
@ -26,6 +26,9 @@ @@ -26,6 +26,9 @@
namespace ICSharpCode.NRefactory.CSharp
{
/// <summary>
/// Represents a literal value.
/// </summary>
public class PrimitiveExpression : Expression
{
AstLocation startLocation;
@ -59,7 +62,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -59,7 +62,7 @@ namespace ICSharpCode.NRefactory.CSharp
this.length = length;
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitPrimitiveExpression (this, data);
}

24
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/QueryExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System;
@ -21,7 +21,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -21,7 +21,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}
@ -33,7 +33,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -33,7 +33,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole(ClauseRole, value); }
}
public override S AcceptVisitor<T, S>(AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitQueryExpression (this, data);
}
@ -83,7 +83,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -83,7 +83,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitQueryContinuationClause (this, data);
}
@ -113,7 +113,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -113,7 +113,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Expression, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitQueryFromClause (this, data);
}
@ -143,7 +143,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -143,7 +143,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole(Roles.Expression, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitQueryLetClause (this, data);
}
@ -161,7 +161,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -161,7 +161,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Condition, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitQueryWhereClause (this, data);
}
@ -246,7 +246,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -246,7 +246,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitQueryJoinClause (this, data);
}
@ -265,7 +265,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -265,7 +265,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (OrderingRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitQueryOrderClause (this, data);
}
@ -291,7 +291,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -291,7 +291,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.Keyword); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitQueryOrdering (this, data);
}
@ -315,7 +315,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -315,7 +315,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Expression, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitQuerySelectClause (this, data);
}
@ -346,7 +346,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -346,7 +346,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (KeyRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitQueryGroupClause (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/SizeOfExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// SizeOfExpression.cs
//
// Author:
@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RPar); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitSizeOfExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/StackAllocExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// StackAllocExpression.cs
//
// Author:
@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RBracket); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitStackAllocExpression (this, data);
}

7
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/ThisReferenceExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ThisReferenceExpression.cs
//
// Author:
@ -26,6 +26,9 @@ @@ -26,6 +26,9 @@
namespace ICSharpCode.NRefactory.CSharp
{
/// <summary>
/// this
/// </summary>
public class ThisReferenceExpression : Expression
{
public AstLocation Location {
@ -44,7 +47,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -44,7 +47,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitThisReferenceExpression (this, data);
}

7
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/TypeOfExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// TypeOfExpression.cs
//
// Author:
@ -27,6 +27,9 @@ @@ -27,6 +27,9 @@
namespace ICSharpCode.NRefactory.CSharp
{
/// <summary>
/// typeof(Type)
/// </summary>
public class TypeOfExpression : Expression
{
public CSharpTokenNode TypeOfToken {
@ -46,7 +49,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -46,7 +49,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RPar); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitTypeOfExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/TypeReferenceExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System;
@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole(Roles.Type, value); }
}
public override S AcceptVisitor<T, S>(AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitTypeReferenceExpression(this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/UnaryOperatorExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// UnaryOperatorExpression.cs
//
// Author:
@ -59,7 +59,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -59,7 +59,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Expression, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitUnaryOperatorExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/UncheckedExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// UncheckedExpression.cs
//
// Author:
@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RPar); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitUncheckedExpression (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Attribute.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// Attribute.cs
//
// Author:
@ -49,7 +49,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -49,7 +49,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (Roles.Argument, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitAttribute (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/AttributeSection.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// AttributeSection.cs
//
// Author:
@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (AttributeRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitAttributeSection (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Comment.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// Comment.cs
//
// Author:
@ -82,7 +82,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -82,7 +82,7 @@ namespace ICSharpCode.NRefactory.CSharp
this.endLocation = endLocation;
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitComment (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Constraint.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// Constraint.cs
//
// Author:
@ -58,7 +58,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -58,7 +58,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (BaseTypeRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitConstraint (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/DelegateDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// DelegateDeclaration.cs
//
// Author:
@ -77,7 +77,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -77,7 +77,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (Roles.Constraint, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitDelegateDeclaration (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/NamespaceDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// NamespaceDeclaration.cs
//
// Author:
@ -98,7 +98,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -98,7 +98,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitNamespaceDeclaration (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/TypeDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// TypeDeclaration.cs
//
// Author:
@ -87,7 +87,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -87,7 +87,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RBrace); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitTypeDeclaration (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/TypeParameterDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System;
@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S>(AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitTypeParameterDeclaration(this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/UsingAliasDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// UsingAliasDeclaration.cs
//
// Author:
@ -66,7 +66,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -66,7 +66,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitUsingAliasDeclaration (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/UsingDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// UsingDeclaration.cs
//
// Author:
@ -60,7 +60,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -60,7 +60,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitUsingDeclaration (this, data);
}

6
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/IAstVisitor.cs

@ -8,7 +8,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -8,7 +8,7 @@ namespace ICSharpCode.NRefactory.CSharp
/// <summary>
/// AST visitor.
/// </summary>
public interface AstVisitor<in T, out S>
public interface IAstVisitor<in T, out S>
{
S VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, T data);
S VisitArgListExpression(ArgListExpression argListExpression, T data);
@ -66,11 +66,14 @@ namespace ICSharpCode.NRefactory.CSharp @@ -66,11 +66,14 @@ namespace ICSharpCode.NRefactory.CSharp
S VisitBreakStatement(BreakStatement breakStatement, T data);
S VisitCheckedStatement(CheckedStatement checkedStatement, T data);
S VisitContinueStatement(ContinueStatement continueStatement, T data);
S VisitDoWhileStatement(DoWhileStatement doWhileStatement, T data);
S VisitEmptyStatement(EmptyStatement emptyStatement, T data);
S VisitExpressionStatement(ExpressionStatement expressionStatement, T data);
S VisitFixedStatement(FixedStatement fixedStatement, T data);
S VisitForeachStatement(ForeachStatement foreachStatement, T data);
S VisitForStatement(ForStatement forStatement, T data);
S VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, T data);
S VisitGotoDefaultStatement(GotoDefaultStatement gotoDefaultStatement, T data);
S VisitGotoStatement(GotoStatement gotoStatement, T data);
S VisitIfElseStatement(IfElseStatement ifElseStatement, T data);
S VisitLabelStatement(LabelStatement labelStatement, T data);
@ -87,6 +90,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -87,6 +90,7 @@ namespace ICSharpCode.NRefactory.CSharp
S VisitUsingStatement(UsingStatement usingStatement, T data);
S VisitVariableDeclarationStatement(VariableDeclarationStatement variableDeclarationStatement, T data);
S VisitWhileStatement(WhileStatement whileStatement, T data);
S VisitYieldBreakStatement(YieldBreakStatement yieldBreakStatement, T data);
S VisitYieldStatement(YieldStatement yieldStatement, T data);
S VisitAccessor(Accessor accessor, T data);

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

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// Identifier.cs
//
// Author:
@ -39,7 +39,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -39,7 +39,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}
@ -87,7 +87,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -87,7 +87,7 @@ namespace ICSharpCode.NRefactory.CSharp
this.startLocation = location;
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitIdentifier (this, data);
}

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

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// FullTypeName.cs
//
// Author:
@ -56,7 +56,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -56,7 +56,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (Roles.TypeArgument, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitMemberType (this, data);
}

12
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PrimitiveType.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// FullTypeName.cs
//
// Author:
@ -43,6 +43,12 @@ namespace ICSharpCode.NRefactory.CSharp @@ -43,6 +43,12 @@ namespace ICSharpCode.NRefactory.CSharp
this.Keyword = keyword;
}
public PrimitiveType(string keyword, AstLocation location)
{
this.Keyword = keyword;
this.Location = location;
}
public override AstLocation StartLocation {
get {
return Location;
@ -50,11 +56,11 @@ namespace ICSharpCode.NRefactory.CSharp @@ -50,11 +56,11 @@ namespace ICSharpCode.NRefactory.CSharp
}
public override AstLocation EndLocation {
get {
return new AstLocation (Location.Line, Location.Column + Keyword != null ? Keyword.Length : 0);
return new AstLocation (Location.Line, Location.Column + (Keyword != null ? Keyword.Length : 0));
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitPrimitiveType (this, data);
}

9
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/SimpleType.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// FullTypeName.cs
//
// Author:
@ -42,6 +42,11 @@ namespace ICSharpCode.NRefactory.CSharp @@ -42,6 +42,11 @@ namespace ICSharpCode.NRefactory.CSharp
this.Identifier = identifier;
}
public SimpleType(string identifier, AstLocation location)
{
SetChildByRole (Roles.Identifier, new Identifier(identifier, location));
}
public string Identifier {
get {
return GetChildByRole (Roles.Identifier).Name;
@ -56,7 +61,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -56,7 +61,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (Roles.TypeArgument, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitSimpleType (this, data);
}

6
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/BlockStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// BlockStatement.cs
//
// Author:
@ -45,7 +45,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -45,7 +45,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}
@ -65,7 +65,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -65,7 +65,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RBrace); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitBlockStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/BreakStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// BreakStatement.cs
//
// Author:
@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitBreakStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/CheckedStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// CheckedStatement.cs
//
// Author:
@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Body, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitCheckedStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/ContinueStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ContinueStatement.cs
//
// Author:
@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitContinueStatement (this, data);
}

73
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/DoWhileStatement.cs

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
//
// DoWhileStatement.cs
//
// Author:
// Mike Krüger <mkrueger@novell.com>
//
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.using System;
namespace ICSharpCode.NRefactory.CSharp
{
/// <summary>
/// "do EmbeddedStatement while(Condition);"
/// </summary>
public class DoWhileStatement : Statement
{
public static readonly Role<CSharpTokenNode> DoKeywordRole = new Role<CSharpTokenNode>("DoKeyword", CSharpTokenNode.Null);
public static readonly Role<CSharpTokenNode> WhileKeywordRole = new Role<CSharpTokenNode>("WhileKeyword", CSharpTokenNode.Null);
public CSharpTokenNode DoToken {
get { return GetChildByRole (DoKeywordRole); }
}
public Statement EmbeddedStatement {
get { return GetChildByRole (Roles.EmbeddedStatement); }
set { SetChildByRole (Roles.EmbeddedStatement, value); }
}
public CSharpTokenNode WhileToken {
get { return GetChildByRole (WhileKeywordRole); }
}
public CSharpTokenNode LParToken {
get { return GetChildByRole (Roles.LPar); }
}
public Expression Condition {
get { return GetChildByRole (Roles.Condition); }
set { SetChildByRole (Roles.Condition, value); }
}
public CSharpTokenNode RParToken {
get { return GetChildByRole (Roles.RPar); }
}
public CSharpTokenNode SemicolonToken {
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitDoWhileStatement (this, data);
}
}
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/EmptyStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// EmptyStatement.cs
//
// Author:
@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitEmptyStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/ExpressionStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ExpressionStatement.cs
//
// Author:
@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitExpressionStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/FixedStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// FixedStatement.cs
//
// Author:
@ -60,7 +60,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -60,7 +60,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.EmbeddedStatement, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitFixedStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/ForStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ForStatement.cs
//
// Author:
@ -73,7 +73,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -73,7 +73,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.EmbeddedStatement, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitForStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/ForeachStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ForeachStatement.cs
//
// Author:
@ -71,7 +71,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -71,7 +71,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.EmbeddedStatement, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitForeachStatement (this, data);
}

86
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/GotoStatement.cs

@ -28,17 +28,16 @@ namespace ICSharpCode.NRefactory.CSharp @@ -28,17 +28,16 @@ namespace ICSharpCode.NRefactory.CSharp
{
/// <summary>
/// "goto Label;"
/// or "goto case LabelExpression;"
/// or "goto default;"
/// </summary>
public class GotoStatement : Statement
{
public static readonly Role<CSharpTokenNode> DefaultKeywordRole = new Role<CSharpTokenNode>("DefaultKeyword", CSharpTokenNode.Null);
public static readonly Role<CSharpTokenNode> CaseKeywordRole = new Role<CSharpTokenNode>("CaseKeyword", CSharpTokenNode.Null);
public GotoStatement ()
{
}
public GotoType GotoType {
get;
set;
public GotoStatement (string label)
{
this.Label = label;
}
public CSharpTokenNode GotoToken {
@ -69,24 +68,79 @@ namespace ICSharpCode.NRefactory.CSharp @@ -69,24 +68,79 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitGotoStatement (this, data);
}
}
/// <summary>
/// or "goto case LabelExpression;"
/// </summary>
public class GotoCaseStatement : Statement
{
public static readonly Role<CSharpTokenNode> CaseKeywordRole = new Role<CSharpTokenNode>("CaseKeyword", CSharpTokenNode.Null);
public CSharpTokenNode GotoToken {
get { return GetChildByRole (Roles.Keyword); }
}
public GotoStatement ()
{
public CSharpTokenNode CaseToken {
get { return GetChildByRole (CaseKeywordRole); }
}
public GotoStatement (string label)
public string Label {
get {
return GetChildByRole (Roles.Identifier).Name;
}
set {
if (string.IsNullOrEmpty(value))
SetChildByRole(Roles.Identifier, null);
else
SetChildByRole(Roles.Identifier, new Identifier(value, AstLocation.Empty));
}
}
/// <summary>
/// Used for "goto case LabelExpression;"
/// </summary>
public Expression LabelExpression {
get { return GetChildByRole (Roles.Expression); }
set { SetChildByRole (Roles.Expression, value); }
}
public CSharpTokenNode SemicolonToken {
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
this.Label = label;
return visitor.VisitGotoCaseStatement (this, data);
}
}
public enum GotoType {
Label,
Case,
CaseDefault
/// <summary>
/// or "goto default;"
/// </summary>
public class GotoDefaultStatement : Statement
{
public static readonly Role<CSharpTokenNode> DefaultKeywordRole = new Role<CSharpTokenNode>("DefaultKeyword", CSharpTokenNode.Null);
public CSharpTokenNode GotoToken {
get { return GetChildByRole (Roles.Keyword); }
}
public CSharpTokenNode DefaultToken {
get { return GetChildByRole (DefaultKeywordRole); }
}
public CSharpTokenNode SemicolonToken {
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitGotoDefaultStatement (this, data);
}
}
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/IfElseStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// IfElseStatement.cs
//
// Author:
@ -69,7 +69,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -69,7 +69,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (FalseRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitIfElseStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/LabelStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// LabelStatement.cs
//
// Author:
@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitLabelStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/LockStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// LockStatement.cs
//
// Author:
@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.EmbeddedStatement, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitLockStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/ReturnStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ReturnStatement.cs
//
// Author:
@ -44,7 +44,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -44,7 +44,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitReturnStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/Statement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System;
@ -25,7 +25,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -25,7 +25,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}

8
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/SwitchStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// SwitchStatement.cs
//
// Author:
@ -66,7 +66,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -66,7 +66,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RBrace); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitSwitchStatement (this, data);
}
@ -92,7 +92,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -92,7 +92,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (Roles.EmbeddedStatement, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitSwitchSection (this, data);
}
@ -111,7 +111,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -111,7 +111,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Expression, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitCaseLabel (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/ThrowStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ThrowStatement.cs
//
// Author:
@ -44,7 +44,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -44,7 +44,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitThrowStatement (this, data);
}

28
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/TryCatchStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// TryCatchStatement.cs
//
// Author:
@ -30,7 +30,7 @@ using System.Linq; @@ -30,7 +30,7 @@ using System.Linq;
namespace ICSharpCode.NRefactory.CSharp
{
/// <summary>
/// try { TryBlock } CatchClauses finally { FinallyBlock }
/// try TryBlock CatchClauses finally FinallyBlock
/// </summary>
public class TryCatchStatement : Statement
{
@ -40,6 +40,10 @@ namespace ICSharpCode.NRefactory.CSharp @@ -40,6 +40,10 @@ namespace ICSharpCode.NRefactory.CSharp
public static readonly Role<CSharpTokenNode> FinallyKeywordRole = new Role<CSharpTokenNode>("FinallyKeyword", CSharpTokenNode.Null);
public static readonly Role<BlockStatement> FinallyBlockRole = new Role<BlockStatement>("FinallyBlock", BlockStatement.Null);
public CSharpTokenNode TryToken {
get { return GetChildByRole (TryKeywordRole); }
}
public BlockStatement TryBlock {
get { return GetChildByRole (TryBlockRole); }
set { SetChildByRole (TryBlockRole, value); }
@ -50,12 +54,16 @@ namespace ICSharpCode.NRefactory.CSharp @@ -50,12 +54,16 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (CatchClauseRole, value); }
}
public CSharpTokenNode FinallyToken {
get { return GetChildByRole (FinallyKeywordRole); }
}
public BlockStatement FinallyBlock {
get { return GetChildByRole (FinallyBlockRole); }
set { SetChildByRole (FinallyBlockRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitTryCatchStatement (this, data);
}
@ -72,6 +80,14 @@ namespace ICSharpCode.NRefactory.CSharp @@ -72,6 +80,14 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public CSharpTokenNode CatchToken {
get { return GetChildByRole (Roles.Keyword); }
}
public CSharpTokenNode LParToken {
get { return GetChildByRole (Roles.LPar); }
}
public AstType Type {
get { return GetChildByRole (Roles.Type); }
set { SetChildByRole (Roles.Type, value); }
@ -87,12 +103,16 @@ namespace ICSharpCode.NRefactory.CSharp @@ -87,12 +103,16 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public CSharpTokenNode RParToken {
get { return GetChildByRole (Roles.RPar); }
}
public BlockStatement Body {
get { return GetChildByRole (Roles.Body); }
set { SetChildByRole (Roles.Body, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitCatchClause (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/UncheckedStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// UncheckedStatement.cs
//
// Author:
@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Body, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitUncheckedStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/UnsafeStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// UnsafeStatement.cs
//
// Author:
@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Body, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitUnsafeStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/UsingStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// UsingStatement.cs
//
// Author:
@ -58,7 +58,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -58,7 +58,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.EmbeddedStatement, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitUsingStatement (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/VariableDeclarationStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// VariableDeclarationStatement.cs
//
// Author:
@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitVariableDeclarationStatement (this, data);
}

25
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/WhileStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// WhileStatement.cs
//
// Author:
@ -28,22 +28,11 @@ namespace ICSharpCode.NRefactory.CSharp @@ -28,22 +28,11 @@ namespace ICSharpCode.NRefactory.CSharp
{
/// <summary>
/// "while (Condition) EmbeddedStatement"
/// or "do EmbeddedStatement while(Condition);"
/// </summary>
public class WhileStatement : Statement
{
public static readonly Role<CSharpTokenNode> DoKeywordRole = new Role<CSharpTokenNode>("DoKeyword", CSharpTokenNode.Null);
public static readonly Role<CSharpTokenNode> WhileKeywordRole = new Role<CSharpTokenNode>("WhileKeyword", CSharpTokenNode.Null);
public WhilePosition WhilePosition {
get;
set;
}
public CSharpTokenNode DoToken {
get { return GetChildByRole (DoKeywordRole); }
}
public CSharpTokenNode WhileToken {
get { return GetChildByRole (WhileKeywordRole); }
}
@ -66,19 +55,9 @@ namespace ICSharpCode.NRefactory.CSharp @@ -66,19 +55,9 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.EmbeddedStatement, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitWhileStatement (this, data);
}
public WhileStatement (WhilePosition whilePosition)
{
this.WhilePosition = whilePosition;
}
}
public enum WhilePosition {
Begin,
End
}
}

54
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/YieldBreakStatement.cs

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
//
// YieldBreakStatement.cs
//
// Author:
// Mike Krüger <mkrueger@novell.com>
//
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
namespace ICSharpCode.NRefactory.CSharp
{
/// <summary>
/// yield break;
/// </summary>
public class YieldBreakStatement : Statement
{
public static readonly Role<CSharpTokenNode> YieldKeywordRole = new Role<CSharpTokenNode>("YieldKeyword", CSharpTokenNode.Null);
public static readonly Role<CSharpTokenNode> BreakKeywordRole = new Role<CSharpTokenNode>("BreakKeyword", CSharpTokenNode.Null);
public CSharpTokenNode YieldToken {
get { return GetChildByRole (YieldKeywordRole); }
}
public CSharpTokenNode BreakToken {
get { return GetChildByRole (BreakKeywordRole); }
}
public CSharpTokenNode SemicolonToken {
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitYieldBreakStatement (this, data);
}
}
}

12
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Statements/YieldStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// YieldStatement.cs
//
// Author:
@ -26,11 +26,13 @@ @@ -26,11 +26,13 @@
namespace ICSharpCode.NRefactory.CSharp
{
/// <summary>
/// yield return Expression;
/// </summary>
public class YieldStatement : Statement
{
public static readonly Role<CSharpTokenNode> YieldKeywordRole = new Role<CSharpTokenNode>("YieldKeyword", CSharpTokenNode.Null);
public static readonly Role<CSharpTokenNode> ReturnKeywordRole = new Role<CSharpTokenNode>("ReturnKeyword", CSharpTokenNode.Null);
public static readonly Role<CSharpTokenNode> BreakKeywordRole = new Role<CSharpTokenNode>("BreakKeyword", CSharpTokenNode.Null);
public CSharpTokenNode YieldToken {
get { return GetChildByRole (YieldKeywordRole); }
@ -40,10 +42,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -40,10 +42,6 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (ReturnKeywordRole); }
}
public CSharpTokenNode BreakToken {
get { return GetChildByRole (BreakKeywordRole); }
}
public Expression Expression {
get { return GetChildByRole (Roles.Expression); }
set { SetChildByRole (Roles.Expression, value); }
@ -53,7 +51,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -53,7 +51,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.Semicolon); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitYieldStatement (this, data);
}

6
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/Accessor.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// PropertyDeclaration.cs
//
// Author:
@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}
@ -55,7 +55,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -55,7 +55,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Body, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitAccessor (this, data);
}

8
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/ConstructorDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ConstructorDeclaration.cs
//
// Author:
@ -60,7 +60,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -60,7 +60,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return NodeType.Member; }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitConstructorDeclaration (this, data);
}
@ -88,7 +88,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -88,7 +88,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}
@ -110,7 +110,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -110,7 +110,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (Roles.Argument, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitConstructorInitializer (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/DestructorDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// DestructorDeclaration.cs
//
// Author:
@ -50,7 +50,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -50,7 +50,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return NodeType.Member; }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitDestructorDeclaration (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/EnumMemberDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// EnumMemberDeclaration.cs
//
// Author:
@ -49,7 +49,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -49,7 +49,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return NodeType.Member; }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitEnumMemberDeclaration (this, data);
}

14
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/EventDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// EventDeclaration.cs
//
// Author:
@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (Roles.Variable, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitEventDeclaration (this, data);
}
@ -46,6 +46,10 @@ namespace ICSharpCode.NRefactory.CSharp @@ -46,6 +46,10 @@ namespace ICSharpCode.NRefactory.CSharp
public static readonly Role<Accessor> AddAccessorRole = new Role<Accessor>("AddAccessor", Accessor.Null);
public static readonly Role<Accessor> RemoveAccessorRole = new Role<Accessor>("RemoveAccessor", Accessor.Null);
public CSharpTokenNode LBraceToken {
get { return GetChildByRole (Roles.LBrace); }
}
public Accessor AddAccessor {
get { return GetChildByRole (AddAccessorRole); }
set { SetChildByRole (AddAccessorRole, value); }
@ -56,7 +60,11 @@ namespace ICSharpCode.NRefactory.CSharp @@ -56,7 +60,11 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (RemoveAccessorRole, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public CSharpTokenNode RBraceToken {
get { return GetChildByRole (Roles.RBrace); }
}
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitCustomEventDeclaration (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/FieldDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// FieldDeclaration.cs
//
// Author:
@ -36,7 +36,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -36,7 +36,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildrenByRole (Roles.Variable, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitFieldDeclaration (this, data);
}

12
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/IndexerDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// IndexerDeclaration.cs
//
// Author:
@ -31,12 +31,20 @@ namespace ICSharpCode.NRefactory.CSharp @@ -31,12 +31,20 @@ namespace ICSharpCode.NRefactory.CSharp
{
public class IndexerDeclaration : PropertyDeclaration
{
public CSharpTokenNode LBracketToken {
get { return GetChildByRole (Roles.LBracket); }
}
public IEnumerable<ParameterDeclaration> Parameters {
get { return GetChildrenByRole (Roles.Parameter); }
set { SetChildrenByRole (Roles.Parameter, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public CSharpTokenNode RBracketToken {
get { return GetChildByRole (Roles.RBracket); }
}
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitIndexerDeclaration (this, data);
}

5
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/MethodDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// MethodDeclaration.cs
//
// Author:
@ -66,8 +66,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -66,8 +66,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitMethodDeclaration (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/OperatorDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// OperatorDeclaration.cs
//
// Author:
@ -104,7 +104,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -104,7 +104,7 @@ namespace ICSharpCode.NRefactory.CSharp
return Mono.CSharp.Operator.GetName((Mono.CSharp.Operator.OpType)type);
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitOperatorDeclaration (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/ParameterDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// ParameterDeclarationExpression.cs
//
// Author:
@ -78,7 +78,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -78,7 +78,7 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Expression, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitParameterDeclaration (this, data);
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/PropertyDeclaration.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// PropertyDeclaration.cs
//
// Author:
@ -49,7 +49,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -49,7 +49,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.RBrace); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitPropertyDeclaration (this, data);
}

5
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/VariableInitializer.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// VariableInitializer.cs
//
// Author:
@ -62,10 +62,9 @@ namespace ICSharpCode.NRefactory.CSharp @@ -62,10 +62,9 @@ namespace ICSharpCode.NRefactory.CSharp
set { SetChildByRole (Roles.Expression, value); }
}
public override S AcceptVisitor<T, S> (AstVisitor<T, S> visitor, T data)
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitVariableInitializer (this, data);
}
}
}

95
NRefactory/ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System;
@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.CSharp
/// <summary>
/// Outputs the AST.
/// </summary>
public class OutputVisitor : AstVisitor<object, object>
public class OutputVisitor : IAstVisitor<object, object>
{
readonly IOutputFormatter formatter;
readonly CSharpFormattingPolicy policy;
@ -35,6 +35,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -35,6 +35,7 @@ namespace ICSharpCode.NRefactory.CSharp
KeywordOrIdentifier,
Plus,
Minus,
Ampersand,
QuestionMark,
Division
}
@ -221,10 +222,12 @@ namespace ICSharpCode.NRefactory.CSharp @@ -221,10 +222,12 @@ namespace ICSharpCode.NRefactory.CSharp
// Avoid that two +, - or ? tokens are combined into a ++, -- or ?? token.
// Note that we don't need to handle tokens like = because there's no valid
// C# program that contains the single token twice in a row.
// (for + and -, this can happen with unary operators;
// and for ?, this can happen in "a is int? ? b : c" or "a as int? ?? 0")
// (for +, - and &, this can happen with unary operators;
// for ?, this can happen in "a is int? ? b : c" or "a as int? ?? 0";
// and for /, this can happen with "1/ *ptr" or "1/ //comment".)
if (lastWritten == LastWritten.Plus && token[0] == '+'
|| lastWritten == LastWritten.Minus && token[0] == '-'
|| lastWritten == LastWritten.Ampersand && token[0] == '&'
|| lastWritten == LastWritten.QuestionMark && token[0] == '?'
|| lastWritten == LastWritten.Division && token[0] == '*')
{
@ -235,6 +238,8 @@ namespace ICSharpCode.NRefactory.CSharp @@ -235,6 +238,8 @@ namespace ICSharpCode.NRefactory.CSharp
lastWritten = LastWritten.Plus;
else if (token == "-")
lastWritten = LastWritten.Minus;
else if (token == "&")
lastWritten = LastWritten.Ampersand;
else if (token == "?")
lastWritten = LastWritten.QuestionMark;
else if (token == "/")
@ -1265,6 +1270,22 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1265,6 +1270,22 @@ namespace ICSharpCode.NRefactory.CSharp
return EndNode(continueStatement);
}
public object VisitDoWhileStatement(DoWhileStatement doWhileStatement, object data)
{
StartNode(doWhileStatement);
WriteKeyword("do", DoWhileStatement.DoKeywordRole);
WriteEmbeddedStatement(doWhileStatement.EmbeddedStatement);
WriteKeyword("while", DoWhileStatement.WhileKeywordRole);
Space(policy.WhileParentheses);
LPar();
Space(policy.WithinWhileParentheses);
doWhileStatement.Condition.AcceptVisitor(this, data);
Space(policy.WithinWhileParentheses);
RPar();
Semicolon();
return EndNode(doWhileStatement);
}
public object VisitEmptyStatement(EmptyStatement emptyStatement, object data)
{
StartNode(emptyStatement);
@ -1333,25 +1354,31 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1333,25 +1354,31 @@ namespace ICSharpCode.NRefactory.CSharp
return EndNode(forStatement);
}
public object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data)
{
StartNode(gotoCaseStatement);
WriteKeyword("goto");
WriteKeyword("case", GotoCaseStatement.CaseKeywordRole);
Space();
gotoCaseStatement.LabelExpression.AcceptVisitor(this, data);
Semicolon();
return EndNode(gotoCaseStatement);
}
public object VisitGotoDefaultStatement(GotoDefaultStatement gotoDefaultStatement, object data)
{
StartNode(gotoDefaultStatement);
WriteKeyword("goto");
WriteKeyword("default", GotoDefaultStatement.DefaultKeywordRole);
Semicolon();
return EndNode(gotoDefaultStatement);
}
public object VisitGotoStatement(GotoStatement gotoStatement, object data)
{
StartNode(gotoStatement);
WriteKeyword("goto");
switch (gotoStatement.GotoType) {
case GotoType.Label:
WriteIdentifier(gotoStatement.Label);
break;
case GotoType.Case:
WriteKeyword("case", GotoStatement.CaseKeywordRole);
Space();
gotoStatement.LabelExpression.AcceptVisitor(this, data);
break;
case GotoType.CaseDefault:
WriteKeyword("default", GotoStatement.DefaultKeywordRole);
break;
default:
throw new NotSupportedException("Invalid value for GotoType");
}
WriteIdentifier(gotoStatement.Label);
Semicolon();
return EndNode(gotoStatement);
}
@ -1539,11 +1566,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1539,11 +1566,6 @@ namespace ICSharpCode.NRefactory.CSharp
public object VisitWhileStatement(WhileStatement whileStatement, object data)
{
StartNode(whileStatement);
if (whileStatement.WhilePosition == WhilePosition.End) {
// do .. while
WriteKeyword("do", WhileStatement.DoKeywordRole);
WriteEmbeddedStatement(whileStatement.EmbeddedStatement);
}
WriteKeyword("while", WhileStatement.WhileKeywordRole);
Space(policy.WhileParentheses);
LPar();
@ -1551,25 +1573,26 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1551,25 +1573,26 @@ namespace ICSharpCode.NRefactory.CSharp
whileStatement.Condition.AcceptVisitor(this, data);
Space(policy.WithinWhileParentheses);
RPar();
if (whileStatement.WhilePosition == WhilePosition.Begin) {
WriteEmbeddedStatement(whileStatement.EmbeddedStatement);
} else {
Semicolon();
}
WriteEmbeddedStatement(whileStatement.EmbeddedStatement);
return EndNode(whileStatement);
}
public object VisitYieldBreakStatement(YieldBreakStatement yieldBreakStatement, object data)
{
StartNode(yieldBreakStatement);
WriteKeyword("yield", YieldBreakStatement.YieldKeywordRole);
WriteKeyword("break", YieldBreakStatement.BreakKeywordRole);
Semicolon();
return EndNode(yieldBreakStatement);
}
public object VisitYieldStatement(YieldStatement yieldStatement, object data)
{
StartNode(yieldStatement);
WriteKeyword("yield", YieldStatement.YieldKeywordRole);
if (yieldStatement.Expression.IsNull) {
WriteKeyword("break", YieldStatement.BreakKeywordRole);
} else {
WriteKeyword("return", YieldStatement.ReturnKeywordRole);
Space();
yieldStatement.Expression.AcceptVisitor(this, data);
}
WriteKeyword("return", YieldStatement.ReturnKeywordRole);
Space();
yieldStatement.Expression.AcceptVisitor(this, data);
Semicolon();
return EndNode(yieldStatement);
}

243
NRefactory/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs

@ -67,6 +67,72 @@ namespace ICSharpCode.NRefactory.CSharp @@ -67,6 +67,72 @@ namespace ICSharpCode.NRefactory.CSharp
#region Global
Stack<NamespaceDeclaration> namespaceStack = new Stack<NamespaceDeclaration> ();
void AddTypeArguments (ATypeNameExpression texpr, AstType result)
{
if (!texpr.HasTypeArguments)
return;
foreach (var arg in texpr.TypeArguments.Args) {
result.AddChild (ConvertToType (arg), AstType.Roles.TypeArgument);
}
}
AstType ConvertToType (Mono.CSharp.Expression typeName)
{
if (typeName is TypeExpression) {
var typeExpr = (Mono.CSharp.TypeExpression)typeName;
return new PrimitiveType (typeExpr.GetSignatureForError (), Convert (typeExpr.Location));
}
if (typeName is Mono.CSharp.QualifiedAliasMember) {
var qam = (Mono.CSharp.QualifiedAliasMember)typeName;
return new SimpleType (qam.Name, Convert (qam.Location));
}
if (typeName is MemberAccess) {
MemberAccess ma = (MemberAccess)typeName;
var memberType = new MemberType ();
memberType.AddChild (ConvertToType (ma.LeftExpression), MemberType.TargetRole);
memberType.MemberName = ma.Name;
AddTypeArguments (ma, memberType);
return memberType;
}
if (typeName is SimpleName) {
var sn = (SimpleName)typeName;
var result = new SimpleType (sn.Name, Convert (sn.Location));
AddTypeArguments (sn, result);
return result;
}
if (typeName is ComposedCast) {
var cc = (ComposedCast)typeName;
var baseType = ConvertToType (cc.Left);
var result = new ComposedType () { BaseType = baseType };
if (cc.Spec.IsNullable) {
result.HasNullableSpecifier = true;
} else if (cc.Spec.IsPointer) {
result.PointerRank++;
} else {
var location = LocationsBag.GetLocations (cc.Spec);
var spec = new ArraySpecifier () { Dimensions = cc.Spec.Dimension - 1 };
spec.AddChild (new CSharpTokenNode (Convert (cc.Spec.Location), 1), FieldDeclaration.Roles.LBracket);
if (location != null)
spec.AddChild (new CSharpTokenNode (Convert (location[0]), 1), FieldDeclaration.Roles.RBracket);
result.ArraySpecifiers = new ArraySpecifier[] {
spec
};
}
return result;
}
System.Console.WriteLine ("Error while converting :" + typeName + " - unknown type name");
return new SimpleType ("unknown");
}
public override void Visit (UsingsBag.Namespace nspace)
{
NamespaceDeclaration nDecl = null;
@ -242,7 +308,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -242,7 +308,7 @@ namespace ICSharpCode.NRefactory.CSharp
AddModifiers (newDelegate, location);
if (location != null)
newDelegate.AddChild (new CSharpTokenNode (Convert (location[0]), "delegate".Length), TypeDeclaration.Roles.Keyword);
newDelegate.AddChild ((AstType)d.ReturnType.Accept (this), AstNode.Roles.Type);
newDelegate.AddChild (ConvertToType (d.ReturnType), AstNode.Roles.Type);
newDelegate.AddChild (new Identifier (d.Name, Convert (d.MemberName.Location)), AstNode.Roles.Identifier);
if (d.MemberName.TypeArguments != null) {
var typeArgLocation = LocationsBag.GetLocations (d.MemberName);
@ -322,22 +388,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -322,22 +388,6 @@ namespace ICSharpCode.NRefactory.CSharp
#region Type members
void AddFixedFieldInitializer (VariableInitializer variable, Mono.CSharp.Expression initializer)
{
if (initializer == null)
return;
if (initializer is ConstInitializer) {
variable.AddChild (new CSharpTokenNode (Convert (initializer.Location), 1), FieldDeclaration.Roles.LBracket);
variable.AddChild ((VariableInitializer)initializer.Accept (this), FieldDeclaration.Roles.Variable);
var initializerLoc = LocationsBag.GetLocations (initializer);
if (initializerLoc != null)
variable.AddChild (new CSharpTokenNode (Convert (initializerLoc[0]), 1), FieldDeclaration.Roles.RBracket);
} else {
variable.AddChild (new CSharpTokenNode (Convert (initializer.Location), 1), FieldDeclaration.Roles.Assign);
variable.AddChild ((VariableInitializer)initializer.Accept (this), FieldDeclaration.Roles.Variable);
}
}
public override void Visit (FixedField f)
{
var location = LocationsBag.GetMemberLocation (f);
@ -347,11 +397,13 @@ namespace ICSharpCode.NRefactory.CSharp @@ -347,11 +397,13 @@ namespace ICSharpCode.NRefactory.CSharp
AddModifiers (newField, location);
if (location != null)
newField.AddChild (new CSharpTokenNode (Convert (location[0]), "fixed".Length), FieldDeclaration.Roles.Keyword);
newField.AddChild ((AstType)f.TypeName.Accept (this), FieldDeclaration.Roles.Type);
newField.AddChild (ConvertToType (f.TypeName), FieldDeclaration.Roles.Type);
VariableInitializer variable = new VariableInitializer ();
variable.AddChild (new Identifier (f.MemberName.Name, Convert (f.MemberName.Location)), FieldDeclaration.Roles.Identifier);
AddFixedFieldInitializer (variable, f.Initializer);
if (!f.Initializer.IsNull) {
variable.AddChild ((Expression)f.Initializer.Accept (this), FieldDeclaration.Roles.Expression);
}
newField.AddChild (variable, FieldDeclaration.Roles.Variable);
if (f.Declarators != null) {
@ -362,7 +414,9 @@ namespace ICSharpCode.NRefactory.CSharp @@ -362,7 +414,9 @@ namespace ICSharpCode.NRefactory.CSharp
variable = new VariableInitializer ();
variable.AddChild (new Identifier (decl.Name.Value, Convert (decl.Name.Location)), FieldDeclaration.Roles.Identifier);
AddFixedFieldInitializer (variable, decl.Initializer);
if (!decl.Initializer.IsNull) {
variable.AddChild ((Expression)decl.Initializer.Accept (this), FieldDeclaration.Roles.Expression);
}
newField.AddChild (variable, FieldDeclaration.Roles.Variable);
}
}
@ -379,7 +433,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -379,7 +433,7 @@ namespace ICSharpCode.NRefactory.CSharp
FieldDeclaration newField = new FieldDeclaration ();
AddModifiers (newField, location);
newField.AddChild ((AstType)f.TypeName.Accept (this), FieldDeclaration.Roles.Type);
newField.AddChild (ConvertToType (f.TypeName), FieldDeclaration.Roles.Type);
VariableInitializer variable = new VariableInitializer ();
variable.AddChild (new Identifier (f.MemberName.Name, Convert (f.MemberName.Location)), FieldDeclaration.Roles.Identifier);
@ -420,7 +474,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -420,7 +474,7 @@ namespace ICSharpCode.NRefactory.CSharp
AddModifiers (newField, location);
if (location != null)
newField.AddChild (new CSharpTokenNode (Convert (location[0]), "const".Length), FieldDeclaration.Roles.Keyword);
newField.AddChild ((AstType)f.TypeName.Accept (this), FieldDeclaration.Roles.Type);
newField.AddChild (ConvertToType (f.TypeName), FieldDeclaration.Roles.Type);
VariableInitializer variable = new VariableInitializer ();
variable.AddChild (new Identifier (f.MemberName.Name, Convert (f.MemberName.Location)), VariableInitializer.Roles.Identifier);
@ -462,7 +516,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -462,7 +516,7 @@ namespace ICSharpCode.NRefactory.CSharp
AddModifiers (newOperator, location);
newOperator.AddChild ((AstType)o.TypeName.Accept (this), AstNode.Roles.Type);
newOperator.AddChild (ConvertToType (o.TypeName), AstNode.Roles.Type);
if (o.OperatorType == Operator.OpType.Implicit) {
if (location != null) {
@ -519,7 +573,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -519,7 +573,7 @@ namespace ICSharpCode.NRefactory.CSharp
var location = LocationsBag.GetMemberLocation (indexer);
AddModifiers (newIndexer, location);
newIndexer.AddChild ((AstType)indexer.TypeName.Accept (this), AstNode.Roles.Type);
newIndexer.AddChild (ConvertToType (indexer.TypeName), AstNode.Roles.Type);
if (location != null)
newIndexer.AddChild (new CSharpTokenNode (Convert (location[0]), 1), IndexerDeclaration.Roles.LBracket);
@ -573,7 +627,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -573,7 +627,7 @@ namespace ICSharpCode.NRefactory.CSharp
var location = LocationsBag.GetMemberLocation (m);
AddModifiers (newMethod, location);
newMethod.AddChild ((AstType)m.TypeName.Accept (this), AstNode.Roles.Type);
newMethod.AddChild (ConvertToType (m.TypeName), AstNode.Roles.Type);
newMethod.AddChild (new Identifier (m.Name, Convert (m.Location)), AstNode.Roles.Identifier);
if (m.MemberName.TypeArguments != null) {
@ -641,7 +695,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -641,7 +695,7 @@ namespace ICSharpCode.NRefactory.CSharp
var location = LocationsBag.GetMemberLocation (p);
AddModifiers (newProperty, location);
newProperty.AddChild ((AstType)p.TypeName.Accept (this), AstNode.Roles.Type);
newProperty.AddChild (ConvertToType (p.TypeName), AstNode.Roles.Type);
newProperty.AddChild (new Identifier (p.MemberName.Name, Convert (p.MemberName.Location)), AstNode.Roles.Identifier);
if (location != null)
newProperty.AddChild (new CSharpTokenNode (Convert (location[0]), 1), MethodDeclaration.Roles.LBrace);
@ -729,7 +783,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -729,7 +783,7 @@ namespace ICSharpCode.NRefactory.CSharp
if (location != null)
newEvent.AddChild (new CSharpTokenNode (Convert (location[0]), "event".Length), EventDeclaration.Roles.Keyword);
newEvent.AddChild ((AstType)e.TypeName.Accept (this), AstNode.Roles.Type);
newEvent.AddChild (ConvertToType (e.TypeName), AstNode.Roles.Type);
newEvent.AddChild (new Identifier (e.MemberName.Name, Convert (e.MemberName.Location)), EventDeclaration.Roles.Identifier);
if (location != null)
newEvent.AddChild (new CSharpTokenNode (Convert (location[1]), ";".Length), EventDeclaration.Roles.Semicolon);
@ -746,7 +800,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -746,7 +800,7 @@ namespace ICSharpCode.NRefactory.CSharp
if (location != null)
newEvent.AddChild (new CSharpTokenNode (Convert (location[0]), "event".Length), CustomEventDeclaration.Roles.Keyword);
newEvent.AddChild ((AstType)ep.TypeName.Accept (this), CustomEventDeclaration.Roles.Type);
newEvent.AddChild (ConvertToType (ep.TypeName), CustomEventDeclaration.Roles.Type);
newEvent.AddChild (new Identifier (ep.MemberName.Name, Convert (ep.MemberName.Location)), CustomEventDeclaration.Roles.Identifier);
if (location != null && location.Count >= 2)
newEvent.AddChild (new CSharpTokenNode (Convert (location[1]), 1), CustomEventDeclaration.Roles.LBrace);
@ -789,7 +843,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -789,7 +843,7 @@ namespace ICSharpCode.NRefactory.CSharp
public override object Visit (BlockVariableDeclaration blockVariableDeclaration)
{
var result = new VariableDeclarationStatement ();
result.AddChild ((AstType)blockVariableDeclaration.TypeExpression.Accept (this), VariableDeclarationStatement.Roles.Type);
result.AddChild (ConvertToType (blockVariableDeclaration.TypeExpression), VariableDeclarationStatement.Roles.Type);
var varInit = new VariableInitializer ();
var location = LocationsBag.GetLocations (blockVariableDeclaration);
@ -828,7 +882,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -828,7 +882,7 @@ namespace ICSharpCode.NRefactory.CSharp
public override object Visit (BlockConstantDeclaration blockVariableDeclaration)
{
var result = new VariableDeclarationStatement ();
result.AddChild ((AstType)blockVariableDeclaration.TypeExpression.Accept (this), VariableDeclarationStatement.Roles.Type);
result.AddChild (ConvertToType (blockVariableDeclaration.TypeExpression), VariableDeclarationStatement.Roles.Type);
var varInit = new VariableInitializer ();
var location = LocationsBag.GetLocations (blockVariableDeclaration);
@ -907,18 +961,18 @@ namespace ICSharpCode.NRefactory.CSharp @@ -907,18 +961,18 @@ namespace ICSharpCode.NRefactory.CSharp
public override object Visit (Do doStatement)
{
var result = new WhileStatement (WhilePosition.End);
var result = new DoWhileStatement ();
var location = LocationsBag.GetLocations (doStatement);
result.AddChild (new CSharpTokenNode (Convert (doStatement.loc), "do".Length), WhileStatement.DoKeywordRole);
result.AddChild (new CSharpTokenNode (Convert (doStatement.loc), "do".Length), DoWhileStatement.DoKeywordRole);
result.AddChild ((Statement)doStatement.EmbeddedStatement.Accept (this), WhileStatement.Roles.EmbeddedStatement);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), "while".Length), WhileStatement.WhileKeywordRole);
result.AddChild (new CSharpTokenNode (Convert (location[0]), "while".Length), DoWhileStatement.WhileKeywordRole);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), WhileStatement.Roles.LPar);
result.AddChild ((Expression)doStatement.expr.Accept (this), WhileStatement.Roles.Condition);
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), DoWhileStatement.Roles.LPar);
result.AddChild ((Expression)doStatement.expr.Accept (this), DoWhileStatement.Roles.Condition);
if (location != null) {
result.AddChild (new CSharpTokenNode (Convert (location[2]), 1), WhileStatement.Roles.RPar);
result.AddChild (new CSharpTokenNode (Convert (location[3]), 1), WhileStatement.Roles.Semicolon);
result.AddChild (new CSharpTokenNode (Convert (location[2]), 1), DoWhileStatement.Roles.RPar);
result.AddChild (new CSharpTokenNode (Convert (location[3]), 1), DoWhileStatement.Roles.Semicolon);
}
return result;
@ -926,7 +980,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -926,7 +980,7 @@ namespace ICSharpCode.NRefactory.CSharp
public override object Visit (While whileStatement)
{
var result = new WhileStatement (WhilePosition.Begin);
var result = new WhileStatement ();
var location = LocationsBag.GetLocations (whileStatement);
result.AddChild (new CSharpTokenNode (Convert (whileStatement.loc), "while".Length), WhileStatement.WhileKeywordRole);
@ -1010,7 +1064,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1010,7 +1064,6 @@ namespace ICSharpCode.NRefactory.CSharp
public override object Visit (Goto gotoStatement)
{
var result = new GotoStatement ();
result.GotoType = GotoType.Label;
var location = LocationsBag.GetLocations (gotoStatement);
result.AddChild (new CSharpTokenNode (Convert (gotoStatement.loc), "goto".Length), GotoStatement.Roles.Keyword);
result.AddChild (new Identifier (gotoStatement.Target, Convert (gotoStatement.loc)), GotoStatement.Roles.Identifier);
@ -1029,13 +1082,12 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1029,13 +1082,12 @@ namespace ICSharpCode.NRefactory.CSharp
public override object Visit (GotoDefault gotoDefault)
{
var result = new GotoStatement ();
result.GotoType = GotoType.CaseDefault;
result.AddChild (new CSharpTokenNode (Convert (gotoDefault.loc), "goto".Length), GotoStatement.Roles.Keyword);
var result = new GotoDefaultStatement ();
result.AddChild (new CSharpTokenNode (Convert (gotoDefault.loc), "goto".Length), GotoDefaultStatement.Roles.Keyword);
var location = LocationsBag.GetLocations (gotoDefault);
if (location != null) {
result.AddChild (new CSharpTokenNode (Convert (location[0]), "default".Length), GotoStatement.DefaultKeywordRole);
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), GotoStatement.Roles.Semicolon);
result.AddChild (new CSharpTokenNode (Convert (location[0]), "default".Length), GotoDefaultStatement.DefaultKeywordRole);
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), GotoDefaultStatement.Roles.Semicolon);
}
return result;
@ -1043,16 +1095,15 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1043,16 +1095,15 @@ namespace ICSharpCode.NRefactory.CSharp
public override object Visit (GotoCase gotoCase)
{
var result = new GotoStatement ();
result.GotoType = GotoType.Case;
result.AddChild (new CSharpTokenNode (Convert (gotoCase.loc), "goto".Length), GotoStatement.Roles.Keyword);
var result = new GotoCaseStatement ();
result.AddChild (new CSharpTokenNode (Convert (gotoCase.loc), "goto".Length), GotoCaseStatement.Roles.Keyword);
var location = LocationsBag.GetLocations (gotoCase);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), "case".Length), GotoStatement.CaseKeywordRole);
result.AddChild ((Expression)gotoCase.Expr.Accept (this), GotoStatement.Roles.Expression);
result.AddChild (new CSharpTokenNode (Convert (location[0]), "case".Length), GotoCaseStatement.CaseKeywordRole);
result.AddChild ((Expression)gotoCase.Expr.Accept (this), GotoCaseStatement.Roles.Expression);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), GotoStatement.Roles.Semicolon);
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), GotoCaseStatement.Roles.Semicolon);
return result;
}
@ -1104,13 +1155,13 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1104,13 +1155,13 @@ namespace ICSharpCode.NRefactory.CSharp
usingResult.AddChild (new CSharpTokenNode (Convert (u.loc), "using".Length), UsingStatement.Roles.Keyword);
usingResult.AddChild (new CSharpTokenNode (Convert (blockStatement.StartLocation), 1), UsingStatement.Roles.LPar);
if (u.Variables != null) {
usingResult.AddChild ((AstType)u.Variables.TypeExpression.Accept (this), UsingStatement.Roles.Type);
usingResult.AddChild (ConvertToType (u.Variables.TypeExpression), UsingStatement.Roles.Type);
usingResult.AddChild (new Identifier (u.Variables.Variable.Name, Convert (u.Variables.Variable.Location)), UsingStatement.Roles.Identifier);
var loc = LocationsBag.GetLocations (u.Variables);
if (loc != null)
usingResult.AddChild (new CSharpTokenNode (Convert (loc[1]), 1), ContinueStatement.Roles.Assign);
if (u.Variables.Initializer != null)
usingResult.AddChild ((AstType)u.Variables.Initializer.Accept (this), UsingStatement.ResourceAcquisitionRole);
usingResult.AddChild (ConvertToType (u.Variables.Initializer), UsingStatement.ResourceAcquisitionRole);
}
cur = u.Statement;
@ -1181,8 +1232,11 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1181,8 +1232,11 @@ namespace ICSharpCode.NRefactory.CSharp
var bodyBlock = new BlockStatement ();
int curLocal = 0;
AddBlockChildren (bodyBlock, blockStatement, ref curLocal);
newSection.AddChild (bodyBlock, SwitchSection.Roles.Body);
foreach (var statement in bodyBlock.Statements) {
statement.Remove ();
newSection.AddChild (statement, SwitchSection.Roles.EmbeddedStatement);
}
result.AddChild (newSection, SwitchStatement.SwitchSectionRole);
}
@ -1244,7 +1298,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1244,7 +1298,7 @@ namespace ICSharpCode.NRefactory.CSharp
/*
if (fixedStatement.Variables != null) {
result.AddChild ((AstType)fixedStatement.Variables.TypeExpression.Accept (this), UsingStatement.Roles.Type);
result.AddChild (ConvertToType (fixedStatement.Variables.TypeExpression.Accept (this), UsingStatement.Roles.Type);
result.AddChild (new Identifier (fixedStatement.Variables.Variable.Name, Convert (fixedStatement.Variables.Variable.Location)), UsingStatement.Roles.Identifier);
var loc = LocationsBag.GetLocations (fixedStatement.Variables);
if (loc != null)
@ -1288,7 +1342,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1288,7 +1342,7 @@ namespace ICSharpCode.NRefactory.CSharp
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), CatchClause.Roles.LPar);
result.AddChild ((AstType)ctch.TypeExpression.Accept (this), CatchClause.Roles.Type);
result.AddChild (ConvertToType (ctch.TypeExpression), CatchClause.Roles.Type);
if (ctch.Variable != null && !string.IsNullOrEmpty (ctch.Variable.Name))
result.AddChild (new Identifier (ctch.Variable.Name, Convert (ctch.Variable.Location)), CatchClause.Roles.Identifier);
@ -1344,7 +1398,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1344,7 +1398,7 @@ namespace ICSharpCode.NRefactory.CSharp
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), ForeachStatement.Roles.LPar);
if (foreachStatement.TypeExpr == null)
result.AddChild ((AstType)foreachStatement.TypeExpr.Accept (this), ForeachStatement.Roles.Type);
result.AddChild (ConvertToType (foreachStatement.TypeExpr), ForeachStatement.Roles.Type);
if (foreachStatement.Variable != null)
result.AddChild (new Identifier (foreachStatement.Variable.Name, Convert (foreachStatement.Variable.Location)), ForeachStatement.Roles.Identifier);
@ -1379,12 +1433,12 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1379,12 +1433,12 @@ namespace ICSharpCode.NRefactory.CSharp
public override object Visit (YieldBreak yieldBreakStatement)
{
var result = new YieldStatement ();
var result = new YieldBreakStatement ();
var location = LocationsBag.GetLocations (yieldBreakStatement);
result.AddChild (new CSharpTokenNode (Convert (yieldBreakStatement.loc), "yield".Length), YieldStatement.YieldKeywordRole);
result.AddChild (new CSharpTokenNode (Convert (yieldBreakStatement.loc), "yield".Length), YieldBreakStatement.YieldKeywordRole);
if (location != null) {
result.AddChild (new CSharpTokenNode (Convert (location[0]), "break".Length), YieldStatement.BreakKeywordRole);
result.AddChild (new CSharpTokenNode (Convert (location[1]), ";".Length), YieldStatement.Roles.Semicolon);
result.AddChild (new CSharpTokenNode (Convert (location[0]), "break".Length), YieldBreakStatement.BreakKeywordRole);
result.AddChild (new CSharpTokenNode (Convert (location[1]), ";".Length), YieldBreakStatement.Roles.Semicolon);
}
return result;
}
@ -1400,40 +1454,39 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1400,40 +1454,39 @@ namespace ICSharpCode.NRefactory.CSharp
public override object Visit (TypeExpression typeExpression)
{
var result = new PrimitiveType ();
result.Location = Convert (typeExpression.Location);
string keyword;
if (typeExpression.Type == TypeManager.void_type) {
result.Keyword = "void";
keyword = "void";
} else if (typeExpression.Type == TypeManager.string_type) {
result.Keyword = "string";
keyword = "string";
} else if (typeExpression.Type == TypeManager.int32_type) {
result.Keyword = "int";
keyword = "int";
} else if (typeExpression.Type == TypeManager.object_type) {
result.Keyword = "object";
keyword = "object";
} else if (typeExpression.Type == TypeManager.float_type) {
result.Keyword = "float";
keyword = "float";
} else if (typeExpression.Type == TypeManager.double_type) {
result.Keyword = "double";
keyword = "double";
} else if (typeExpression.Type == TypeManager.int64_type) {
result.Keyword = "long";
keyword = "long";
} else if (typeExpression.Type == TypeManager.byte_type) {
result.Keyword = "byte";
keyword = "byte";
} else if (typeExpression.Type == TypeManager.uint32_type) {
result.Keyword = "uint";
keyword = "uint";
} else if (typeExpression.Type == TypeManager.uint64_type) {
result.Keyword = "ulong";
keyword = "ulong";
} else if (typeExpression.Type == TypeManager.short_type) {
result.Keyword = "short";
keyword = "short";
} else if (typeExpression.Type == TypeManager.ushort_type) {
result.Keyword = "ushort";
keyword = "ushort";
} else if (typeExpression.Type == TypeManager.sbyte_type) {
result.Keyword = "sbyte";
keyword = "sbyte";
} else if (typeExpression.Type == TypeManager.decimal_type) {
result.Keyword = "decimal";
keyword = "decimal";
} else {
throw new NotImplementedException();
keyword = "unknown";
}
return result;
return new IdentifierExpression (keyword, Convert (typeExpression.Location));
}
public override object Visit (LocalVariableReference localVariableReference)
@ -1570,7 +1623,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1570,7 +1623,7 @@ namespace ICSharpCode.NRefactory.CSharp
var result = new IsExpression ();
result.AddChild ((Expression)isExpression.Expr.Accept (this), IsExpression.Roles.Expression);
result.AddChild (new CSharpTokenNode (Convert (isExpression.Location), "is".Length), IsExpression.Roles.Keyword);
result.AddChild ((AstType)isExpression.ProbeType.Accept (this), IsExpression.Roles.Type);
result.AddChild (ConvertToType (isExpression.ProbeType), IsExpression.Roles.Type);
return result;
}
@ -1579,7 +1632,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1579,7 +1632,7 @@ namespace ICSharpCode.NRefactory.CSharp
var result = new AsExpression ();
result.AddChild ((Expression)asExpression.Expr.Accept (this), AsExpression.Roles.Expression);
result.AddChild (new CSharpTokenNode (Convert (asExpression.Location), "as".Length), AsExpression.Roles.Keyword);
result.AddChild ((AstType)asExpression.ProbeType.Accept (this), AsExpression.Roles.Type);
result.AddChild (ConvertToType (asExpression.ProbeType), AsExpression.Roles.Type);
return result;
}
@ -1590,7 +1643,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1590,7 +1643,7 @@ namespace ICSharpCode.NRefactory.CSharp
result.AddChild (new CSharpTokenNode (Convert (castExpression.Location), 1), CastExpression.Roles.LPar);
if (castExpression.TargetType != null)
result.AddChild ((AstType)castExpression.TargetType.Accept (this), CastExpression.Roles.Type);
result.AddChild (ConvertToType (castExpression.TargetType), CastExpression.Roles.Type);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), CastExpression.Roles.RPar);
if (castExpression.Expr != null)
@ -1601,7 +1654,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1601,7 +1654,7 @@ namespace ICSharpCode.NRefactory.CSharp
public override object Visit (ComposedCast composedCast)
{
var result = new ComposedType ();
result.AddChild ((AstType)composedCast.Left.Accept (this), ComposedType.Roles.Type);
result.AddChild (ConvertToType (composedCast.Left), ComposedType.Roles.Type);
var spec = composedCast.Spec;
while (spec != null) {
@ -1630,7 +1683,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1630,7 +1683,7 @@ namespace ICSharpCode.NRefactory.CSharp
var location = LocationsBag.GetLocations (defaultValueExpression);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), CastExpression.Roles.LPar);
result.AddChild ((AstType)defaultValueExpression.Expr.Accept (this), CastExpression.Roles.Type);
result.AddChild (ConvertToType (defaultValueExpression.Expr), CastExpression.Roles.Type);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), CastExpression.Roles.RPar);
return result;
@ -1773,7 +1826,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1773,7 +1826,7 @@ namespace ICSharpCode.NRefactory.CSharp
break;
}
if (p.TypeExpression != null) // lambdas may have no types (a, b) => ...
parameterDeclarationExpression.AddChild ((AstType)p.TypeExpression.Accept (this), ParameterDeclaration.Roles.Type);
parameterDeclarationExpression.AddChild (ConvertToType (p.TypeExpression), ParameterDeclaration.Roles.Type);
parameterDeclarationExpression.AddChild (new Identifier (p.Name, Convert (p.Location)), ParameterDeclaration.Roles.Identifier);
if (p.HasDefaultValue) {
if (location != null)
@ -1794,7 +1847,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1794,7 +1847,7 @@ namespace ICSharpCode.NRefactory.CSharp
var arg = typeArguments.Args[i];
if (arg == null)
continue;
parent.AddChild ((AstType)arg.Accept (this), InvocationExpression.Roles.TypeArgument);
parent.AddChild (ConvertToType (arg), InvocationExpression.Roles.TypeArgument);
}
}
@ -1808,7 +1861,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1808,7 +1861,7 @@ namespace ICSharpCode.NRefactory.CSharp
var arg = typeArguments.Args[i];
if (arg == null)
continue;
parent.AddChild ((AstType)arg.Accept (this), InvocationExpression.Roles.TypeArgument);
parent.AddChild (ConvertToType (arg), InvocationExpression.Roles.TypeArgument);
}
}
@ -1824,7 +1877,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1824,7 +1877,7 @@ namespace ICSharpCode.NRefactory.CSharp
parent.AddChild (new Identifier (c.TypeParameter.Value, Convert (c.TypeParameter.Location)), InvocationExpression.Roles.Identifier);
parent.AddChild (new CSharpTokenNode (Convert (location[1]), 1), Constraint.ColonRole);
foreach (var expr in c.ConstraintExpressions)
parent.AddChild ((AstType)expr.Accept (this), Constraint.BaseTypeRole);
parent.AddChild (ConvertToType (expr), Constraint.BaseTypeRole);
}
}
@ -1881,7 +1934,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1881,7 +1934,7 @@ namespace ICSharpCode.NRefactory.CSharp
result.AddChild (new CSharpTokenNode (Convert (newExpression.Location), "new".Length), ObjectCreateExpression.Roles.Keyword);
if (newExpression.TypeRequested != null)
result.AddChild ((AstType)newExpression.TypeRequested.Accept (this), ObjectCreateExpression.Roles.Type);
result.AddChild (ConvertToType (newExpression.TypeRequested), ObjectCreateExpression.Roles.Type);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), ObjectCreateExpression.Roles.LPar);
AddArguments (result, location, newExpression.Arguments);
@ -1901,7 +1954,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1901,7 +1954,7 @@ namespace ICSharpCode.NRefactory.CSharp
result.AddChild (new CSharpTokenNode (Convert (newInitializeExpression.Location), "new".Length), ObjectCreateExpression.Roles.Keyword);
if (newInitializeExpression.TypeRequested != null)
result.AddChild ((AstType)newInitializeExpression.TypeRequested.Accept (this), ObjectCreateExpression.Roles.Type);
result.AddChild (ConvertToType (newInitializeExpression.TypeRequested), ObjectCreateExpression.Roles.Type);
var location = LocationsBag.GetLocations (newInitializeExpression);
if (location != null)
@ -1922,7 +1975,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1922,7 +1975,7 @@ namespace ICSharpCode.NRefactory.CSharp
result.AddChild (new CSharpTokenNode (Convert (arrayCreationExpression.Location), "new".Length), ArrayCreateExpression.Roles.Keyword);
if (arrayCreationExpression.NewType != null)
result.AddChild ((AstType)arrayCreationExpression.NewType.Accept (this), ArrayCreateExpression.Roles.Type);
result.AddChild (ConvertToType (arrayCreationExpression.NewType), ArrayCreateExpression.Roles.Type);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), ArrayCreateExpression.Roles.LBracket);
if (arrayCreationExpression.Arguments != null) {
@ -1992,7 +2045,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1992,7 +2045,7 @@ namespace ICSharpCode.NRefactory.CSharp
var location = LocationsBag.GetLocations (typeOfExpression);
result.AddChild (new CSharpTokenNode (Convert (typeOfExpression.Location), "typeof".Length), TypeOfExpression.Roles.Keyword);
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), TypeOfExpression.Roles.LPar);
result.AddChild ((AstType)typeOfExpression.TypeExpression.Accept (this), TypeOfExpression.Roles.Type);
result.AddChild (ConvertToType (typeOfExpression.TypeExpression), TypeOfExpression.Roles.Type);
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), TypeOfExpression.Roles.RPar);
return result;
}
@ -2004,7 +2057,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -2004,7 +2057,7 @@ namespace ICSharpCode.NRefactory.CSharp
result.AddChild (new CSharpTokenNode (Convert (sizeOfExpression.Location), "sizeof".Length), TypeOfExpression.Roles.Keyword);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), TypeOfExpression.Roles.LPar);
result.AddChild ((AstType)sizeOfExpression.QueriedType.Accept (this), TypeOfExpression.Roles.Type);
result.AddChild (ConvertToType (sizeOfExpression.QueriedType), TypeOfExpression.Roles.Type);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), TypeOfExpression.Roles.RPar);
return result;
@ -2063,7 +2116,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -2063,7 +2116,7 @@ namespace ICSharpCode.NRefactory.CSharp
var location = LocationsBag.GetLocations (stackAllocExpression);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), "stackalloc".Length), StackAllocExpression.Roles.Keyword);
result.AddChild ((AstType)stackAllocExpression.TypeExpression.Accept (this), StackAllocExpression.Roles.Type);
result.AddChild (ConvertToType (stackAllocExpression.TypeExpression), StackAllocExpression.Roles.Type);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), StackAllocExpression.Roles.LBracket);
result.AddChild ((Expression)stackAllocExpression.CountExpression.Accept (this), StackAllocExpression.Roles.Expression);
@ -2180,7 +2233,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -2180,7 +2233,7 @@ namespace ICSharpCode.NRefactory.CSharp
public override object Visit (ConstInitializer constInitializer)
{
return new Identifier (constInitializer.Name, Convert (constInitializer.Location));
return constInitializer.Expr.Accept (this);
}
public override object Visit (ArrayInitializer arrayInitializer)

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save