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

◆ CompileTryExpression()

void System.Linq.Expressions.Interpreter.LightCompiler.CompileTryExpression ( Expression expr)
inlineprivate

Definition at line 1473 of file LightCompiler.cs.

1474 {
1475 TryExpression tryExpression = (TryExpression)expr;
1476 if (tryExpression.Fault != null)
1477 {
1479 return;
1480 }
1481 BranchLabel label = _instructions.MakeLabel();
1482 BranchLabel branchLabel = _instructions.MakeLabel();
1484 BranchLabel branchLabel2 = null;
1485 if (tryExpression.Finally != null)
1486 {
1489 }
1490 else
1491 {
1493 }
1495 EnterTryCatchFinallyInstruction enterTryCatchFinallyInstruction = _instructions.GetInstruction(count) as EnterTryCatchFinallyInstruction;
1497 bool flag = tryExpression.Type != typeof(void);
1498 Compile(tryExpression.Body, !flag);
1501 _instructions.EmitGoto(label, flag, flag, flag);
1502 if (tryExpression.Handlers.Count > 0)
1503 {
1505 foreach (CatchBlock handler in tryExpression.Handlers)
1506 {
1507 ParameterExpression parameterExpression = handler.Variable ?? Expression.Parameter(handler.Test);
1510 ExceptionFilter filter = null;
1511 if (handler.Filter != null)
1512 {
1518 Compile(handler.Filter);
1520 filter = new ExceptionFilter(labelIndex, count3, _instructions.Count);
1523 }
1525 if (flag)
1526 {
1528 }
1529 else
1530 {
1532 }
1536 Compile(handler.Body, !flag);
1539 list.Add(new ExceptionHandler(labelIndex2, count4, _instructions.Count, handler.Test, filter));
1542 }
1543 }
1544 if (tryExpression.Finally != null)
1545 {
1551 enterTryCatchFinallyInstruction.SetTryHandler(new TryCatchFinallyHandler(count, count2, branchLabel.TargetIndex, branchLabel2.TargetIndex, _instructions.Count, list?.ToArray()));
1553 }
1554 else
1555 {
1556 enterTryCatchFinallyInstruction.SetTryHandler(new TryCatchFinallyHandler(count, count2, branchLabel.TargetIndex, list.ToArray()));
1557 }
1560 }
void Add(TKey key, TValue value)
void EmitEnterTryFinally(BranchLabel finallyStartLabel)
void EmitGoto(BranchLabel label, bool hasResult, bool hasValue, bool labelTargetGetsValue)
void EmitLeaveExceptionHandler(bool hasValue, BranchLabel tryExpressionEndLabel)
void EmitEnterFinally(BranchLabel finallyStartLabel)
void CompileSetVariable(ParameterExpression variable, bool isVoid)
readonly Stack< ParameterExpression > _exceptionForRethrowStack
void Compile(Expression expr, bool asVoid)
void CompileGetVariable(ParameterExpression variable)
void UndefineLocal(LocalDefinition definition, int end)
LocalDefinition DefineLocal(ParameterExpression variable, int start)

References System.Linq.Expressions.Interpreter.LightCompiler._exceptionForRethrowStack, System.Linq.Expressions.Interpreter.LightCompiler._instructions, System.Linq.Expressions.Interpreter.LightCompiler._locals, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Linq.Expressions.CatchBlock.Body, System.Linq.Expressions.Interpreter.LightCompiler.Compile(), System.Linq.Expressions.Interpreter.LightCompiler.CompileAsVoid(), System.Linq.Expressions.Interpreter.LightCompiler.CompileGetVariable(), System.Linq.Expressions.Interpreter.LightCompiler.CompileSetVariable(), System.Linq.Expressions.Interpreter.LightCompiler.CompileTryFaultExpression(), System.Linq.Expressions.Interpreter.InstructionList.Count, System.Linq.count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Linq.Expressions.Interpreter.LocalVariables.DefineLocal(), System.Linq.Expressions.Interpreter.InstructionList.EmitEnterExceptionFilter(), System.Linq.Expressions.Interpreter.InstructionList.EmitEnterExceptionHandlerNonVoid(), System.Linq.Expressions.Interpreter.InstructionList.EmitEnterExceptionHandlerVoid(), System.Linq.Expressions.Interpreter.InstructionList.EmitEnterFinally(), System.Linq.Expressions.Interpreter.InstructionList.EmitEnterTryCatch(), System.Linq.Expressions.Interpreter.InstructionList.EmitEnterTryFinally(), System.Linq.Expressions.Interpreter.InstructionList.EmitGoto(), System.Linq.Expressions.Interpreter.InstructionList.EmitLeaveExceptionFilter(), System.Linq.Expressions.Interpreter.InstructionList.EmitLeaveExceptionHandler(), System.Linq.Expressions.Interpreter.InstructionList.EmitLeaveFinally(), System.Linq.Expressions.CatchBlock.Filter, System.Linq.Expressions.Interpreter.InstructionList.GetInstruction(), System.list, System.Linq.Expressions.Interpreter.InstructionList.MakeLabel(), System.Linq.Expressions.Interpreter.InstructionList.MarkLabel(), System.Linq.Expressions.Interpreter.InstructionList.MarkRuntimeLabel(), System.Linq.Expressions.Expression< TDelegate >.Parameter(), System.Linq.Expressions.Interpreter.LightCompiler.PopLabelBlock(), System.Linq.Expressions.Interpreter.LightCompiler.PushLabelBlock(), System.Linq.Expressions.CatchBlock.Test, and System.Linq.Expressions.Interpreter.LocalVariables.UndefineLocal().

Referenced by System.Linq.Expressions.Interpreter.LightCompiler.CompileNoLabelPush().