Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ VisitAndConvert< T >() [1/2]

ReadOnlyCollection< T > System.Linq.Expressions.ExpressionVisitor.VisitAndConvert< T > ( ReadOnlyCollection< T > nodes,
string? callerName )
inlineinherited
Type Constraints
T :Expression 

Definition at line 100 of file ExpressionVisitor.cs.

100 : Expression
101 {
102 ContractUtils.RequiresNotNull(nodes, "nodes");
103 T[] array = null;
104 int i = 0;
105 for (int count = nodes.Count; i < count; i++)
106 {
107 if (!(Visit(nodes[i]) is T val))
108 {
109 throw Error.MustRewriteToSameNode(callerName, typeof(T), callerName);
110 }
111 if (array != null)
112 {
113 array[i] = val;
114 }
115 else if (val != nodes[i])
116 {
117 array = new T[count];
118 for (int j = 0; j < i; j++)
119 {
120 array[j] = nodes[j];
121 }
122 array[i] = val;
123 }
124 }
125 if (array == null)
126 {
127 return nodes;
128 }
130 }
static void RequiresNotNull(object value, string paramName)
virtual ? Expression Visit(Expression? node)

References System.array, System.Linq.count, System.Linq.Expressions.Error.MustRewriteToSameNode(), System.Dynamic.Utils.ContractUtils.RequiresNotNull(), and System.Linq.Expressions.ExpressionVisitor.Visit().