Browse Source

DoMatch 1

ast-source-generator
Siegfried Pammer 3 months ago
parent
commit
31ebba1fbf
  1. 7
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs
  2. 6
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs
  3. 9
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs
  4. 6
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs
  5. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs
  6. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs
  7. 7
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs
  8. 7
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs

7
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs

@ -94,12 +94,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public AnonymousMethodExpression(BlockStatement body, params ParameterDeclaration[] parameters) : this(body, (IEnumerable<ParameterDeclaration>)parameters)
{
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
AnonymousMethodExpression o = other as AnonymousMethodExpression;
return o != null && this.IsAsync == o.IsAsync && this.HasParameterList == o.HasParameterList
&& this.Parameters.DoMatch(o.Parameters, match) && this.Body.DoMatch(o.Body, match);
}
}
}

6
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs

@ -66,12 +66,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public AnonymousTypeCreateExpression(params Expression[] initializer) : this((IEnumerable<Expression>)initializer)
{
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
var o = other as AnonymousTypeCreateExpression;
return o != null && this.Initializers.DoMatch(o.Initializers, match);
}
}
}

9
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs

@ -16,7 +16,6 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
namespace ICSharpCode.Decompiler.CSharp.Syntax
{
/// <summary>
@ -54,13 +53,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
get { return GetChildByRole(InitializerRole); }
set { SetChildByRole(InitializerRole, value); }
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ArrayCreateExpression o = other as ArrayCreateExpression;
return o != null && this.Type.DoMatch(o.Type, match)
&& this.Arguments.DoMatch(o.Arguments, match)
&& this.AdditionalArraySpecifiers.DoMatch(o.AdditionalArraySpecifiers, match)
&& this.Initializer.DoMatch(o.Initializer, match);
}
}
}

6
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs

@ -59,12 +59,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public CSharpTokenNode RBraceToken {
get { return GetChildByRole(Roles.RBrace); }
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
ArrayInitializerExpression o = other as ArrayInitializerExpression;
return o != null && this.Elements.DoMatch(o.Elements, match);
}
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs

@ -23,8 +23,6 @@
// 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.Decompiler.CSharp.Syntax
{
/// <summary>
@ -58,12 +56,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
AddChild(expression, Roles.Expression);
AddChild(type, Roles.Type);
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
AsExpression o = other as AsExpression;
return o != null && this.Expression.DoMatch(o.Expression, match) && this.Type.DoMatch(o.Type, match);
}
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs

@ -25,7 +25,6 @@
// THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
namespace ICSharpCode.Decompiler.CSharp.Syntax
@ -89,13 +88,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
set { SetChildByRole(RightRole, value); }
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
AssignmentExpression o = other as AssignmentExpression;
return o != null && (this.Operator == AssignmentOperatorType.Any || this.Operator == o.Operator)
&& this.Left.DoMatch(o.Left, match) && this.Right.DoMatch(o.Right, match);
}
public static TokenRole GetOperatorRole(AssignmentOperatorType op)
{
switch (op)

7
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs

@ -24,7 +24,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
namespace ICSharpCode.Decompiler.CSharp.Syntax
{
/// <summary>
@ -48,11 +47,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
return new TextLocation(Location.Line, Location.Column + "base".Length);
}
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
BaseReferenceExpression o = other as BaseReferenceExpression;
return o != null;
}
}
}

7
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs

@ -91,13 +91,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
set { SetChildByRole(RightRole, value); }
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
BinaryOperatorExpression o = other as BinaryOperatorExpression;
return o != null && (this.Operator == BinaryOperatorType.Any || this.Operator == o.Operator)
&& this.Left.DoMatch(o.Left, match) && this.Right.DoMatch(o.Right, match);
}
public static TokenRole GetOperatorRole(BinaryOperatorType op)
{
switch (op)

Loading…
Cancel
Save