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

◆ EmitUnary()

void System.Linq.Expressions.Compiler.LambdaCompiler.EmitUnary ( UnaryExpression node,
CompilationFlags flags )
inlineprivate

Definition at line 3469 of file LambdaCompiler.cs.

3470 {
3471 if (node.Method != null)
3472 {
3473 EmitUnaryMethod(node, flags);
3474 }
3475 else if (node.NodeType == ExpressionType.NegateChecked && node.Operand.Type.IsInteger())
3476 {
3477 Type type = node.Type;
3478 if (type.IsNullableType())
3479 {
3482 EmitExpression(node.Operand);
3486 _ilg.EmitGetValueOrDefault(type);
3488 Type nonNullableType = type.GetNonNullableType();
3489 _ilg.EmitDefault(nonNullableType, null);
3491 _ilg.EmitGetValueOrDefault(type);
3499 }
3500 else
3501 {
3502 _ilg.EmitDefault(type, null);
3503 EmitExpression(node.Operand);
3505 }
3506 }
3507 else
3508 {
3509 EmitExpression(node.Operand);
3510 EmitUnaryOperator(node.NodeType, node.Operand.Type, node.Type);
3511 }
3512 }
static ConstructorInfo GetNullableConstructor(Type nullableType)
Definition TypeUtils.cs:34
void EmitUnaryMethod(UnaryExpression node, CompilationFlags flags)
void EmitBinaryOperator(ExpressionType op, Type leftType, Type rightType, Type resultType, bool liftedToNull)
void EmitUnaryOperator(ExpressionType op, Type operandType, Type resultType)
virtual void MarkLabel(Label loc)
virtual void Emit(OpCode opcode)
static readonly OpCode Ldloca
Definition OpCodes.cs:427
static readonly OpCode Br_S
Definition OpCodes.cs:89
static readonly OpCode Stloc
Definition OpCodes.cs:429
static readonly OpCode Newobj
Definition OpCodes.cs:233
static readonly OpCode Ldloc
Definition OpCodes.cs:425
static readonly OpCode Brfalse_S
Definition OpCodes.cs:91

References System.Linq.Expressions.Compiler.LambdaCompiler._ilg, System.Reflection.Emit.OpCodes.Br_S, System.Reflection.Emit.OpCodes.Brfalse_S, System.Reflection.Emit.ILGenerator.DefineLabel(), System.Reflection.Emit.ILGenerator.Emit(), System.Linq.Expressions.Compiler.LambdaCompiler.EmitBinaryOperator(), System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpression(), System.Linq.Expressions.Compiler.LambdaCompiler.EmitUnaryMethod(), System.Linq.Expressions.Compiler.LambdaCompiler.EmitUnaryOperator(), System.Linq.Expressions.Compiler.LambdaCompiler.FreeLocal(), System.Linq.Expressions.Compiler.LambdaCompiler.GetLocal(), System.Dynamic.Utils.TypeUtils.GetNullableConstructor(), System.Reflection.Emit.OpCodes.Ldloc, System.Reflection.Emit.OpCodes.Ldloca, System.Reflection.Emit.ILGenerator.MarkLabel(), System.Reflection.Emit.OpCodes.Newobj, System.Reflection.Emit.OpCodes.Stloc, and System.type.

Referenced by System.Linq.Expressions.Compiler.LambdaCompiler.EmitUnaryExpression().