Add a new ObjectValue value class
This commit is contained in:
parent
6e0c666f32
commit
fdd42859b3
|
@ -21,6 +21,7 @@ namespace de4dot.blocks.cflow {
|
|||
public enum ValueType : byte {
|
||||
Unknown,
|
||||
Null,
|
||||
Object,
|
||||
Boxed,
|
||||
Int32,
|
||||
Int64,
|
||||
|
@ -45,6 +46,10 @@ namespace de4dot.blocks.cflow {
|
|||
return valueType == ValueType.Null;
|
||||
}
|
||||
|
||||
public bool isObject() {
|
||||
return valueType == ValueType.Object;
|
||||
}
|
||||
|
||||
public bool isBoxed() {
|
||||
return valueType == ValueType.Boxed;
|
||||
}
|
||||
|
@ -80,6 +85,23 @@ namespace de4dot.blocks.cflow {
|
|||
}
|
||||
}
|
||||
|
||||
public class ObjectValue : Value {
|
||||
public readonly object obj; // can be null but that doesn't mean that this ObjectValue instance is null
|
||||
|
||||
public ObjectValue()
|
||||
: this(null) {
|
||||
}
|
||||
|
||||
public ObjectValue(object obj)
|
||||
: base(ValueType.Object) {
|
||||
this.obj = obj;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return "<non-null object>";
|
||||
}
|
||||
}
|
||||
|
||||
public class NullValue : Value {
|
||||
// There's only one type of null
|
||||
public static readonly NullValue Instance = new NullValue();
|
||||
|
|
Loading…
Reference in New Issue
Block a user