Browse Source

Rename FixedVariableInitializer.Initializer to CountExpression (this makes it consistent with StackAllocExpression).

newNRvisualizers
Daniel Grunwald 15 years ago
parent
commit
e8d472ba89
  1. 2
      ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/FieldDeclarationTests.cs
  2. 10
      ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/FixedVariableInitializer.cs
  3. 5
      ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs

2
ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/FieldDeclarationTests.cs

@ -67,7 +67,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.TypeMembers @@ -67,7 +67,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.TypeMembers
Variables = {
new FixedVariableInitializer {
Name = "Field",
Initializer = new PrimitiveExpression(100)
CountExpression = new PrimitiveExpression(100)
}
}
});

10
ICSharpCode.NRefactory/CSharp/Ast/TypeMembers/FixedVariableInitializer.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//
//
// FixedFieldDeclaration.cs
//
// Author:
@ -29,7 +29,7 @@ using System; @@ -29,7 +29,7 @@ using System;
namespace ICSharpCode.NRefactory.CSharp
{
/// <summary>
/// name [ <expression> ]
/// Name [ CountExpression ]
/// </summary>
public class FixedVariableInitializer : AstNode
{
@ -46,7 +46,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -46,7 +46,7 @@ namespace ICSharpCode.NRefactory.CSharp
public FixedVariableInitializer (string name, Expression initializer = null)
{
this.Name = name;
this.Initializer = initializer;
this.CountExpression = initializer;
}
public string Name {
@ -62,7 +62,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -62,7 +62,7 @@ namespace ICSharpCode.NRefactory.CSharp
get { return GetChildByRole (Roles.LBracket); }
}
public Expression Initializer {
public Expression CountExpression {
get { return GetChildByRole (Roles.Expression); }
set { SetChildByRole (Roles.Expression, value); }
}
@ -79,7 +79,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -79,7 +79,7 @@ namespace ICSharpCode.NRefactory.CSharp
protected internal override bool DoMatch (AstNode other, ICSharpCode.NRefactory.CSharp.PatternMatching.Match match)
{
var o = other as FixedVariableInitializer;
return o != null && MatchString (this.Name, o.Name) && this.Initializer.DoMatch (o.Initializer, match);
return o != null && MatchString (this.Name, o.Name) && this.CountExpression.DoMatch (o.CountExpression, match);
}
}
}

5
ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs

@ -1847,7 +1847,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1847,7 +1847,6 @@ namespace ICSharpCode.NRefactory.CSharp
StartNode(fixedFieldDeclaration);
WriteAttributes(fixedFieldDeclaration.Attributes);
WriteModifiers(fixedFieldDeclaration.ModifierTokens);
Space();
WriteKeyword("fixed");
Space();
fixedFieldDeclaration.ReturnType.AcceptVisitor (this, data);
@ -1861,10 +1860,10 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1861,10 +1860,10 @@ namespace ICSharpCode.NRefactory.CSharp
{
StartNode(fixedVariableInitializer);
WriteIdentifier(fixedVariableInitializer.Name);
if (!fixedVariableInitializer.Initializer.IsNull) {
if (!fixedVariableInitializer.CountExpression.IsNull) {
WriteToken("[", AstNode.Roles.LBracket);
Space(policy.SpacesWithinBrackets);
fixedVariableInitializer.Initializer.AcceptVisitor(this, data);
fixedVariableInitializer.CountExpression.AcceptVisitor(this, data);
Space(policy.SpacesWithinBrackets);
WriteToken("]", AstNode.Roles.RBracket);
}

Loading…
Cancel
Save