|
@@ -21,14 +21,6 @@
|
|
|
*/
|
|
|
package cs.internal;
|
|
|
|
|
|
-@:classCode('
|
|
|
- static public readonly System.Type Type = typeof(T);
|
|
|
- static public readonly bool IsValueType = haxe.lang.NullMetadata<T>.Type.IsValueType;
|
|
|
-')
|
|
|
-@:keep @:nativeGen @:native("haxe.lang.NullMetadata") private class NullMetadata<T>
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
@:classCode('
|
|
|
//This function is here to be used with Reflection, when the haxe.lang.Null type is known
|
|
|
public static haxe.lang.Null<T> _ofDynamic(object obj)
|
|
@@ -54,19 +46,9 @@ package cs.internal;
|
|
|
@:readOnly public var value(default,never):T;
|
|
|
@:readOnly public var hasValue(default,never):Bool;
|
|
|
|
|
|
- @:functionCode('
|
|
|
- object obj = null;
|
|
|
- if (hasValue && System.Object.ReferenceEquals(v, obj))
|
|
|
- {
|
|
|
- hasValue = false;
|
|
|
- }
|
|
|
- this.value = v;
|
|
|
- this.hasValue = hasValue;
|
|
|
- ')
|
|
|
public function new(v:T, hasValue:Bool)
|
|
|
{
|
|
|
- var obj:Dynamic = null;
|
|
|
- if (hasValue && cs.system.Object.ReferenceEquals(v, obj))
|
|
|
+ if (hasValue && cs.system.Object.ReferenceEquals(v, null))
|
|
|
{
|
|
|
hasValue = false;
|
|
|
}
|
|
@@ -91,13 +73,10 @@ package cs.internal;
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- @:functionCode('
|
|
|
- if (this.hasValue)
|
|
|
- return value;
|
|
|
- return null;
|
|
|
- ')
|
|
|
public function toDynamic():Dynamic
|
|
|
{
|
|
|
+ if (this.hasValue)
|
|
|
+ return value;
|
|
|
return null;
|
|
|
}
|
|
|
}
|