Add a new ObjectValue value class

This commit is contained in:
de4dot 2012-08-04 12:02:40 +02:00
parent 6e0c666f32
commit fdd42859b3

View File

@ -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();