Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
InvocationExpression2.cs
Go to the documentation of this file.
3
5
7{
8 private object _arg0;
9
10 private readonly Expression _arg1;
11
12 public override int ArgumentCount => 2;
13
14 public InvocationExpression2(Expression lambda, Type returnType, Expression arg0, Expression arg1)
15 : base(lambda, returnType)
16 {
17 _arg0 = arg0;
18 _arg1 = arg1;
19 }
20
22 {
23 return ExpressionUtils.ReturnReadOnly(this, ref _arg0);
24 }
25
26 public override Expression GetArgument(int index)
27 {
28 return index switch
29 {
30 0 => ExpressionUtils.ReturnObject<Expression>(_arg0),
31 1 => _arg1,
32 _ => throw new ArgumentOutOfRangeException("index"),
33 };
34 }
35
36 internal override InvocationExpression Rewrite(Expression lambda, Expression[] arguments)
37 {
38 if (arguments != null)
39 {
40 return System.Linq.Expressions.Expression.Invoke(lambda, arguments[0], arguments[1]);
41 }
43 }
44}
static ReadOnlyCollection< ParameterExpression > ReturnReadOnly(IParameterProvider provider, ref object collection)
static InvocationExpression Invoke(Expression expression)
override ReadOnlyCollection< Expression > GetOrMakeArguments()
InvocationExpression2(Expression lambda, Type returnType, Expression arg0, Expression arg1)
override InvocationExpression Rewrite(Expression lambda, Expression[] arguments)