Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ThrowInstruction.cs
Go to the documentation of this file.
1
using
System.Runtime.CompilerServices
;
2
3
namespace
System.Linq.Expressions.Interpreter
;
4
5
internal
sealed
class
ThrowInstruction
:
Instruction
6
{
7
internal
static
readonly
ThrowInstruction
Throw
=
new
ThrowInstruction
(hasResult: true, isRethrow: false);
8
9
internal
static
readonly
ThrowInstruction
VoidThrow
=
new
ThrowInstruction
(hasResult: false, isRethrow: false);
10
11
internal
static
readonly
ThrowInstruction
Rethrow
=
new
ThrowInstruction
(hasResult: true, isRethrow: true);
12
13
internal
static
readonly
ThrowInstruction
VoidRethrow
=
new
ThrowInstruction
(hasResult: false, isRethrow: true);
14
15
private
readonly
bool
_hasResult
;
16
17
private
readonly
bool
_rethrow
;
18
19
public
override
string
InstructionName
=>
"Throw"
;
20
21
public
override
int
ProducedStack
22
{
23
get
24
{
25
if
(!
_hasResult
)
26
{
27
return
0;
28
}
29
return
1;
30
}
31
}
32
33
public
override
int
ConsumedStack
=> 1;
34
35
private
ThrowInstruction
(
bool
hasResult,
bool
isRethrow)
36
{
37
_hasResult
= hasResult;
38
_rethrow
= isRethrow;
39
}
40
41
public
override
int
Run
(
InterpretedFrame
frame)
42
{
43
Exception
ex =
WrapThrownObject
(frame.
Pop
());
44
if
(
_rethrow
)
45
{
46
throw
new
RethrowException
();
47
}
48
throw
ex;
49
}
50
51
private
static
Exception
WrapThrownObject
(
object
thrown)
52
{
53
object
obj
;
54
if
(thrown !=
null
)
55
{
56
obj
= thrown as
Exception
;
57
if
(
obj
==
null
)
58
{
59
return
new
RuntimeWrappedException
(thrown);
60
}
61
}
62
else
63
{
64
obj
=
null
;
65
}
66
return
(
Exception
)
obj
;
67
}
68
}
System.Exception
Definition
Exception.cs:15
System.Linq.Expressions.Interpreter.Instruction
Definition
Instruction.cs:6
System.Linq.Expressions.Interpreter.InterpretedFrame.Pop
object Pop()
Definition
InterpretedFrame.cs:90
System.Linq.Expressions.Interpreter.InterpretedFrame
Definition
InterpretedFrame.cs:7
System.Linq.Expressions.Interpreter.RethrowException
Definition
RethrowException.cs:7
System.Linq.Expressions.Interpreter.ThrowInstruction.ProducedStack
override int ProducedStack
Definition
ThrowInstruction.cs:22
System.Linq.Expressions.Interpreter.ThrowInstruction.VoidThrow
static readonly ThrowInstruction VoidThrow
Definition
ThrowInstruction.cs:9
System.Linq.Expressions.Interpreter.ThrowInstruction._rethrow
readonly bool _rethrow
Definition
ThrowInstruction.cs:17
System.Linq.Expressions.Interpreter.ThrowInstruction.WrapThrownObject
static Exception WrapThrownObject(object thrown)
Definition
ThrowInstruction.cs:51
System.Linq.Expressions.Interpreter.ThrowInstruction.Rethrow
static readonly ThrowInstruction Rethrow
Definition
ThrowInstruction.cs:11
System.Linq.Expressions.Interpreter.ThrowInstruction.ThrowInstruction
ThrowInstruction(bool hasResult, bool isRethrow)
Definition
ThrowInstruction.cs:35
System.Linq.Expressions.Interpreter.ThrowInstruction._hasResult
readonly bool _hasResult
Definition
ThrowInstruction.cs:15
System.Linq.Expressions.Interpreter.ThrowInstruction.Run
override int Run(InterpretedFrame frame)
Definition
ThrowInstruction.cs:41
System.Linq.Expressions.Interpreter.ThrowInstruction.Throw
static readonly ThrowInstruction Throw
Definition
ThrowInstruction.cs:7
System.Linq.Expressions.Interpreter.ThrowInstruction.VoidRethrow
static readonly ThrowInstruction VoidRethrow
Definition
ThrowInstruction.cs:13
System.Linq.Expressions.Interpreter.ThrowInstruction.ConsumedStack
override int ConsumedStack
Definition
ThrowInstruction.cs:33
System.Linq.Expressions.Interpreter.ThrowInstruction.InstructionName
override string InstructionName
Definition
ThrowInstruction.cs:19
System.Linq.Expressions.Interpreter.ThrowInstruction
Definition
ThrowInstruction.cs:6
System.Runtime.CompilerServices.RuntimeWrappedException
Definition
RuntimeWrappedException.cs:8
System.Linq.Expressions.Interpreter
Definition
ActionCallInstruction.cs:3
System.Runtime.CompilerServices
Definition
NullablePublicOnlyAttribute.cs:3
System.ExceptionArgument.obj
@ obj
source
System.Linq.Expressions
System.Linq.Expressions.Interpreter
ThrowInstruction.cs
Generated by
1.10.0