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

◆ EmitSwitchCases()

void System.Linq.Expressions.Compiler.LambdaCompiler.EmitSwitchCases ( SwitchExpression node,
Label[] labels,
bool[] isGoto,
Label @ default,
Label end,
CompilationFlags flags )
inlineprivate

Definition at line 3139 of file LambdaCompiler.cs.

3140 {
3141 _ilg.Emit(OpCodes.Br, @default);
3142 int i = 0;
3143 for (int count = node.Cases.Count; i < count; i++)
3144 {
3145 if (isGoto[i])
3146 {
3147 continue;
3148 }
3149 _ilg.MarkLabel(labels[i]);
3150 EmitExpressionAsType(node.Cases[i].Body, node.Type, flags);
3151 if (node.DefaultBody != null || i < count - 1)
3152 {
3153 if ((flags & CompilationFlags.EmitAsTailCallMask) == CompilationFlags.EmitAsTail)
3154 {
3156 }
3157 else
3158 {
3159 _ilg.Emit(OpCodes.Br, end);
3160 }
3161 }
3162 }
3163 if (node.DefaultBody != null)
3164 {
3165 _ilg.MarkLabel(@default);
3166 EmitExpressionAsType(node.DefaultBody, node.Type, flags);
3167 }
3168 _ilg.MarkLabel(end);
3169 }
void EmitExpressionAsType(Expression node, Type type, CompilationFlags flags)
virtual void MarkLabel(Label loc)
virtual void Emit(OpCode opcode)
static readonly OpCode Br
Definition OpCodes.cs:115
static readonly OpCode Ret
Definition OpCodes.cs:87

References System.Linq.Expressions.Compiler.LambdaCompiler._ilg, System.Reflection.Emit.OpCodes.Br, System.Linq.count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Reflection.Emit.ILGenerator.Emit(), System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpressionAsType(), System.Reflection.Emit.ILGenerator.MarkLabel(), and System.Reflection.Emit.OpCodes.Ret.

Referenced by System.Linq.Expressions.Compiler.LambdaCompiler.EmitSwitchExpression(), and System.Linq.Expressions.Compiler.LambdaCompiler.TryEmitSwitchInstruction().