Class ExpressionRewriterRuleCollection<TTarget>
Represents a collection of rewrite rules.
Inheritance
Implements
Namespace: System.Linq.CompilerServices
Assembly: Nuqleon.Linq.CompilerServices.dll
Syntax
public class ExpressionRewriterRuleCollection<TTarget> : Object, IEnumerable<Rule<ExpressionTreeBase, TTarget>>, IEnumerable where TTarget : ITree
Type Parameters
Name | Description |
---|---|
TTarget | Type of the target tree nodes. |
Methods
Add<TResult>(Expression<Func<TResult>>, Expression<Func<TTarget>>, Int32)
Adds a new rewrite rule.
Declaration
public void Add<TResult>(Expression<Func<TResult>> pattern, Expression<Func<TTarget>> goal, int cost)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<TResult>> | pattern | Lambda expression representing the pattern matched by the rule. |
System.Linq.Expressions.Expression<System.Func<TTarget>> | goal | Lambda expression representing the rewrite goal applied by the rule. |
System.Int32 | cost | Cost to apply the rule. |
Type Parameters
Name | Description |
---|---|
TResult | Return type of the expression. |
Add<T1, TResult>(Expression<Func<T1, TResult>>, Expression<Func<TTarget, TTarget>>, Int32)
Adds a new rewrite rule.
Declaration
public void Add<T1, TResult>(Expression<Func<T1, TResult>> pattern, Expression<Func<TTarget, TTarget>> goal, int cost)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<T1, TResult>> | pattern | Lambda expression representing the pattern matched by the rule. |
System.Linq.Expressions.Expression<System.Func<TTarget, TTarget>> | goal | Lambda expression representing the rewrite goal applied by the rule. |
System.Int32 | cost | Cost to apply the rule. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first parameter in the expression. |
TResult | Return type of the expression. |
Add<T1, T2, TResult>(Expression<Func<T1, T2, TResult>>, Expression<Func<TTarget, TTarget, TTarget>>, Int32)
Adds a new rewrite rule.
Declaration
public void Add<T1, T2, TResult>(Expression<Func<T1, T2, TResult>> pattern, Expression<Func<TTarget, TTarget, TTarget>> goal, int cost)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<T1, T2, TResult>> | pattern | Lambda expression representing the pattern matched by the rule. |
System.Linq.Expressions.Expression<System.Func<TTarget, TTarget, TTarget>> | goal | Lambda expression representing the rewrite goal applied by the rule. |
System.Int32 | cost | Cost to apply the rule. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first parameter in the expression. |
T2 | Type of the second parameter in the expression. |
TResult | Return type of the expression. |
Add<T1, T2, T3, TResult>(Expression<Func<T1, T2, T3, TResult>>, Expression<Func<TTarget, TTarget, TTarget, TTarget>>, Int32)
Adds a new rewrite rule.
Declaration
public void Add<T1, T2, T3, TResult>(Expression<Func<T1, T2, T3, TResult>> pattern, Expression<Func<TTarget, TTarget, TTarget, TTarget>> goal, int cost)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<T1, T2, T3, TResult>> | pattern | Lambda expression representing the pattern matched by the rule. |
System.Linq.Expressions.Expression<System.Func<TTarget, TTarget, TTarget, TTarget>> | goal | Lambda expression representing the rewrite goal applied by the rule. |
System.Int32 | cost | Cost to apply the rule. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first parameter in the expression. |
T2 | Type of the second parameter in the expression. |
T3 | Type of the third parameter in the expression. |
TResult | Return type of the expression. |
Add<T1, T2, T3, T4, TResult>(Expression<Func<T1, T2, T3, T4, TResult>>, Expression<Func<TTarget, TTarget, TTarget, TTarget, TTarget>>, Int32)
Adds a new rewrite rule.
Declaration
public void Add<T1, T2, T3, T4, TResult>(Expression<Func<T1, T2, T3, T4, TResult>> pattern, Expression<Func<TTarget, TTarget, TTarget, TTarget, TTarget>> goal, int cost)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<T1, T2, T3, T4, TResult>> | pattern | Lambda expression representing the pattern matched by the rule. |
System.Linq.Expressions.Expression<System.Func<TTarget, TTarget, TTarget, TTarget, TTarget>> | goal | Lambda expression representing the rewrite goal applied by the rule. |
System.Int32 | cost | Cost to apply the rule. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first parameter in the expression. |
T2 | Type of the second parameter in the expression. |
T3 | Type of the third parameter in the expression. |
T4 | Type of the fourth parameter in the expression. |
TResult | Return type of the expression. |
GetEnumerator()
Gets an enumerator to iterate over the rewrite rules in the collection.
Declaration
public IEnumerator<Rule<ExpressionTreeBase, TTarget>> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<Rule<ExpressionTreeBase, TTarget>> | Enumerator to iterate over the rewrite rules in the collection. |