Browse Source

allowed serialization of haxe.Int32 (as Int)

Nicolas Cannasse 14 years ago
parent
commit
c0eed23553
3 changed files with 9 additions and 0 deletions
  1. 1 0
      doc/CHANGES.txt
  2. 7 0
      std/haxe/Serializer.hx
  3. 1 0
      std/neko/_std/haxe/Int32.hx

+ 1 - 0
doc/CHANGES.txt

@@ -13,6 +13,7 @@
 	all : fixed "using" on macro function
 	all : fixed "using" on macro function
 	all : allowed member macros functions (called as static)
 	all : allowed member macros functions (called as static)
 	neko : added spod_macro support
 	neko : added spod_macro support
+	neko : allowed serialization of haxe.Int32 (as Int)
 
 
 2011-01-30: 2.07
 2011-01-30: 2.07
 	all : fixed completion support with --remap
 	all : fixed completion support with --remap

+ 7 - 0
std/haxe/Serializer.hx

@@ -383,6 +383,13 @@ class Serializer {
 		case TFunction:
 		case TFunction:
 			throw "Cannot serialize function";
 			throw "Cannot serialize function";
 		default:
 		default:
+			#if neko
+			if( untyped (__i32__kind != null && __dollar__iskind(v,__i32__kind)) ) {
+				buf.add("i");
+				buf.add(v);
+				return;
+			}
+			#end
 			throw "Cannot serialize "+Std.string(v);
 			throw "Cannot serialize "+Std.string(v);
 		}
 		}
 	}
 	}

+ 1 - 0
std/neko/_std/haxe/Int32.hx

@@ -114,6 +114,7 @@ package haxe;
 
 
 	static function __init__() : Void untyped {
 	static function __init__() : Void untyped {
 		__i32__new = neko.Lib.load("std","int32_new",1);
 		__i32__new = neko.Lib.load("std","int32_new",1);
+		__i32__kind = __dollar__getkind(__i32__new(0));
 		__i32__to_int = neko.Lib.load("std","int32_to_int",1);
 		__i32__to_int = neko.Lib.load("std","int32_to_int",1);
 		__i32__add = neko.Lib.load("std","int32_add",2);
 		__i32__add = neko.Lib.load("std","int32_add",2);
 		__i32__sub = neko.Lib.load("std","int32_sub",2);
 		__i32__sub = neko.Lib.load("std","int32_sub",2);