Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CastReferenceToEnumInstruction.cs
Go to the documentation of this file.
1
using
System.Dynamic.Utils
;
2
3
namespace
System.Linq.Expressions.Interpreter
;
4
5
internal
sealed
class
CastReferenceToEnumInstruction
:
CastInstruction
6
{
7
private
readonly
Type
_t
;
8
9
public
CastReferenceToEnumInstruction
(
Type
t)
10
{
11
_t
= t;
12
}
13
14
public
override
int
Run
(
InterpretedFrame
frame)
15
{
16
object
obj
= frame.
Pop
();
17
switch
(
_t
.
GetTypeCode
())
18
{
19
case
TypeCode
.Int32:
20
frame.
Push
(
Enum
.
ToObject
(
_t
, (
int
)
obj
));
21
break
;
22
case
TypeCode
.Int64:
23
frame.
Push
(
Enum
.
ToObject
(
_t
, (
long
)
obj
));
24
break
;
25
case
TypeCode
.UInt32:
26
frame.
Push
(
Enum
.
ToObject
(
_t
, (uint)
obj
));
27
break
;
28
case
TypeCode
.UInt64:
29
frame.
Push
(
Enum
.
ToObject
(
_t
, (ulong)
obj
));
30
break
;
31
case
TypeCode
.Byte:
32
frame.
Push
(
Enum
.
ToObject
(
_t
, (
byte
)
obj
));
33
break
;
34
case
TypeCode
.SByte:
35
frame.
Push
(
Enum
.
ToObject
(
_t
, (sbyte)
obj
));
36
break
;
37
case
TypeCode
.Int16:
38
frame.
Push
(
Enum
.
ToObject
(
_t
, (
short
)
obj
));
39
break
;
40
case
TypeCode
.UInt16:
41
frame.
Push
(
Enum
.
ToObject
(
_t
, (ushort)
obj
));
42
break
;
43
case
TypeCode
.Char:
44
frame.
Push
(
Enum
.
ToObject
(
_t
, (
char
)
obj
));
45
break
;
46
default
:
47
frame.
Push
(
Enum
.
ToObject
(
_t
, (
bool
)
obj
));
48
break
;
49
}
50
return
1;
51
}
52
}
System.Enum.ToObject
static object ToObject(Type enumType, object value)
Definition
Enum.cs:874
System.Enum
Definition
Enum.cs:14
System.Linq.Expressions.Interpreter.CastInstruction
Definition
CastInstruction.cs:6
System.Linq.Expressions.Interpreter.CastReferenceToEnumInstruction.Run
override int Run(InterpretedFrame frame)
Definition
CastReferenceToEnumInstruction.cs:14
System.Linq.Expressions.Interpreter.CastReferenceToEnumInstruction._t
readonly Type _t
Definition
CastReferenceToEnumInstruction.cs:7
System.Linq.Expressions.Interpreter.CastReferenceToEnumInstruction.CastReferenceToEnumInstruction
CastReferenceToEnumInstruction(Type t)
Definition
CastReferenceToEnumInstruction.cs:9
System.Linq.Expressions.Interpreter.CastReferenceToEnumInstruction
Definition
CastReferenceToEnumInstruction.cs:6
System.Linq.Expressions.Interpreter.InterpretedFrame.Pop
object Pop()
Definition
InterpretedFrame.cs:90
System.Linq.Expressions.Interpreter.InterpretedFrame.Push
void Push(object value)
Definition
InterpretedFrame.cs:55
System.Linq.Expressions.Interpreter.InterpretedFrame
Definition
InterpretedFrame.cs:7
System.Type.GetTypeCode
static TypeCode GetTypeCode(Type? type)
Definition
Type.cs:919
System.Type
Definition
Type.cs:14
System.Dynamic.Utils
Definition
CacheDict.cs:4
System.Linq.Expressions.Interpreter
Definition
ActionCallInstruction.cs:3
System.TypeCode
TypeCode
Definition
TypeCode.cs:4
System.ExceptionArgument.obj
@ obj
source
System.Linq.Expressions
System.Linq.Expressions.Interpreter
CastReferenceToEnumInstruction.cs
Generated by
1.10.0