Browse Source

flash9/as3gen minor fixes.

Nicolas Cannasse 18 years ago
parent
commit
d2a87d3eca
15 changed files with 104 additions and 74 deletions
  1. 3 3
      std/Array.hx
  2. 1 1
      std/Hash.hx
  3. 1 1
      std/IntHash.hx
  4. 3 3
      std/Std.hx
  5. 8 0
      std/StdTypes.hx
  6. 1 1
      std/String.hx
  7. 1 1
      std/StringBuf.hx
  8. 2 2
      std/StringTools.hx
  9. 16 9
      std/Type.hx
  10. 27 23
      std/Xml.hx
  11. 22 16
      std/flash9/Boot.hx
  12. 15 7
      std/flash9/FlashXml__.hx
  13. 1 1
      std/flash9/Lib.hx
  14. 2 1
      std/haxe/Serializer.hx
  15. 1 5
      std/haxe/Unserializer.hx

+ 3 - 3
std/Array.hx

@@ -53,7 +53,7 @@ extern class Array<T> {
 	/**
 	/**
 		Removes the last element of the array and returns it.
 		Removes the last element of the array and returns it.
 	**/
 	**/
-	function pop() : T;
+	function pop() : Null<T>;
 
 
 	/**
 	/**
 		Adds the element [x] at the end of the array.
 		Adds the element [x] at the end of the array.
@@ -68,7 +68,7 @@ extern class Array<T> {
 	/**
 	/**
 		Removes the first element and returns it.
 		Removes the first element and returns it.
 	**/
 	**/
-	function shift() : T;
+	function shift() : Null<T>;
 
 
 	/**
 	/**
 		Copies the range of the array starting at [pos] up to,
 		Copies the range of the array starting at [pos] up to,
@@ -122,6 +122,6 @@ extern class Array<T> {
 	/**
 	/**
 		Returns an iterator of the Array values.
 		Returns an iterator of the Array values.
 	**/
 	**/
-	function iterator() : Iterator<T>;
+	function iterator() : Iterator<Null<T>>;
 
 
 }
 }

+ 1 - 1
std/Hash.hx

@@ -69,7 +69,7 @@ class Hash<T> {
 	/**
 	/**
 		Get a value for the given key.
 		Get a value for the given key.
 	**/
 	**/
-	public function get( key : String ) : T {
+	public function get( key : String ) : Null<T> {
 		#if flash
 		#if flash
 		return untyped h[key];
 		return untyped h[key];
 		#else js
 		#else js

+ 1 - 1
std/IntHash.hx

@@ -66,7 +66,7 @@ class IntHash<T> {
 	/**
 	/**
 		Get a value for the given key.
 		Get a value for the given key.
 	**/
 	**/
-	public function get( key : Int ) : T {
+	public function get( key : Int ) : Null<T> {
 		#if flash
 		#if flash
 		return untyped h[key];
 		return untyped h[key];
 		#else js
 		#else js

+ 3 - 3
std/Std.hx

@@ -79,11 +79,11 @@ class Std {
 	/**
 	/**
 		Convert a String to an Int, parsing different possible representations. Returns [null] if could not be parsed.
 		Convert a String to an Int, parsing different possible representations. Returns [null] if could not be parsed.
 	**/
 	**/
-	public static function parseInt( x : String ) : Int {
+	public static function parseInt( x : String ) : Null<Int> {
 		untyped {
 		untyped {
 		#if flash9
 		#if flash9
 		var v = __global__["parseInt"](x);
 		var v = __global__["parseInt"](x);
-		if( Math.isNaN(v) )
+		if( __global__["isNaN"](v) )
 			return null;
 			return null;
 		return v;
 		return v;
 		#else flash
 		#else flash
@@ -137,7 +137,7 @@ class Std {
 	/**
 	/**
 		Return the character code of the first character of the String, or null if the String is empty.
 		Return the character code of the first character of the String, or null if the String is empty.
 	**/
 	**/
-	public static function ord( x : String ) : Int {
+	public static function ord( x : String ) : Null<Int> {
 		#if flash
 		#if flash
 		if( x == "" )
 		if( x == "" )
 			return null;
 			return null;

+ 8 - 0
std/StdTypes.hx

@@ -48,6 +48,14 @@ extern class Int extends Float { }
 typedef UInt = Int
 typedef UInt = Int
 #end
 #end
 
 
+/**
+	[Null] can be useful in two cases. In order to document some methods
+	that accepts or can return a [null] value, or for the Flash9 compiler and AS3
+	generator to distinguish between base values that can be null and others that
+	can't.
+**/
+typedef Null<T> = T
+
 /**
 /**
 	The standard Boolean type is represented as an enum with two choices.
 	The standard Boolean type is represented as an enum with two choices.
 **/
 **/

+ 1 - 1
std/String.hx

@@ -58,7 +58,7 @@ extern class String {
 		Returns the character code at the given position.
 		Returns the character code at the given position.
 		Returns [null] if outside of String bounds.
 		Returns [null] if outside of String bounds.
 	**/
 	**/
-	function charCodeAt( index : Int) : Int;
+	function charCodeAt( index : Int) : Null<Int>;
 
 
 	/**
 	/**
 		Returns the index of first occurence of [value]
 		Returns the index of first occurence of [value]

+ 1 - 1
std/StringBuf.hx

@@ -58,7 +58,7 @@ class StringBuf {
 	/**
 	/**
 		Adds a part of a string to the string buffer.
 		Adds a part of a string to the string buffer.
 	**/
 	**/
-	public function addSub( s : String, pos : Int, ?len : Int ) {
+	public function addSub( s : String, pos : Int, ?len : Null<Int> ) {
 		#if neko
 		#if neko
 		__add_sub(b,untyped s.__s,pos,len);
 		__add_sub(b,untyped s.__s,pos,len);
 		#else flash9
 		#else flash9

+ 2 - 2
std/StringTools.hx

@@ -260,11 +260,11 @@ class StringTools {
 		return out.toString();
 		return out.toString();
 		#end
 		#end
 	}
 	}
-	
+
 	/**
 	/**
 		Encode a number into a hexadecimal representation, with an optional number of zeros for left padding.
 		Encode a number into a hexadecimal representation, with an optional number of zeros for left padding.
 	**/
 	**/
-	public static function hex( n : Int, ?digits : Int ) {
+	public static function hex( n : Int, ?digits : Null<Int> ) {
 		var s = "";
 		var s = "";
 		var hexChars = "0123456789ABCDEF";
 		var hexChars = "0123456789ABCDEF";
 		do {
 		do {

+ 16 - 9
std/Type.hx

@@ -42,8 +42,8 @@ class Type {
 		#end
 		#end
 			return t;
 			return t;
 		} catch( e : Dynamic ) {
 		} catch( e : Dynamic ) {
-			return null;
 		}
 		}
+		return null;
 	}
 	}
 
 
 	/**
 	/**
@@ -60,8 +60,8 @@ class Type {
 		#end
 		#end
 			return t;
 			return t;
 		} catch( e : Dynamic ) {
 		} catch( e : Dynamic ) {
-			return null;
 		}
 		}
+		return null;
 	}
 	}
 
 
 	/**
 	/**
@@ -137,7 +137,7 @@ class Type {
 			var cname = __global__["flash.utils.getQualifiedSuperclassName"](c);
 			var cname = __global__["flash.utils.getQualifiedSuperclassName"](c);
 			if( cname == "Object" )
 			if( cname == "Object" )
 				return null;
 				return null;
-			return __global__["flash.utils.getDefinitionByName"](cname);
+			return __as__(__global__["flash.utils.getDefinitionByName"](cname),Class);
 		#else true
 		#else true
 			return c.__super__;
 			return c.__super__;
 		#end
 		#end
@@ -151,10 +151,7 @@ class Type {
 		if( c == null )
 		if( c == null )
 			return null;
 			return null;
 		#if flash9
 		#if flash9
-			var name = untyped __global__["flash.utils.getQualifiedClassName"](c);
-			if( name == "flash::FlashXml__" )
-				return "Xml";
-			return name;
+			return untyped __global__["flash.utils.getQualifiedClassName"](c);
 		#else true
 		#else true
 			var a : Array<String> = untyped c.__name__;
 			var a : Array<String> = untyped c.__name__;
 			return a.join(".");
 			return a.join(".");
@@ -183,7 +180,7 @@ class Type {
 		untyped {
 		untyped {
 		#if flash9
 		#if flash9
 			try {
 			try {
-				cl = __global__["flash.utils.getDefinitionByName"](name);
+				cl = __as__(__global__["flash.utils.getDefinitionByName"](name),Class);
 				if( cl.__isenum )
 				if( cl.__isenum )
 					return null;
 					return null;
 				return cl; // skip test below
 				return cl; // skip test below
@@ -282,7 +279,16 @@ class Type {
 	**/
 	**/
 	public static function createEmptyInstance<T>( cl : Class<T> ) : T untyped {
 	public static function createEmptyInstance<T>( cl : Class<T> ) : T untyped {
 		#if flash9
 		#if flash9
-			return cl.__construct__.call(null,null);
+			try {
+				flash.Boot.skip_constructor = true;
+				var i = cl.__construct__.call(null,[]);
+				flash.Boot.skip_constructor = false;
+				return i;
+			} catch( e : Dynamic ) {
+				flash.Boot.skip_constructor = false;
+				throw e;
+			}
+			return null;
 		#else flash
 		#else flash
 			var o : Dynamic = __new__(_global["Object"]);
 			var o : Dynamic = __new__(_global["Object"]);
 			o.__proto__ = cl.prototype;
 			o.__proto__ = cl.prototype;
@@ -425,6 +431,7 @@ class Type {
 				return if( c == null ) TFunction else TClass(c);
 				return if( c == null ) TFunction else TClass(c);
 			}
 			}
 		}
 		}
+		return null;
 		#else (flash || js)
 		#else (flash || js)
 		switch( #if flash __typeof__ #else true __js__("typeof") #end(v) ) {
 		switch( #if flash __typeof__ #else true __js__("typeof") #end(v) ) {
 		#if flash
 		#if flash

+ 27 - 23
std/Xml.hx

@@ -80,37 +80,37 @@ extern class Xml {
 
 
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
-	**/	
+	**/
 	static function createElement( name : String ) : Xml;
 	static function createElement( name : String ) : Xml;
 
 
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
-	**/	
+	**/
 	static function createPCData( data : String ) : Xml;
 	static function createPCData( data : String ) : Xml;
-	
+
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
-	**/	
+	**/
 	static function createCData( data : String ) : Xml;
 	static function createCData( data : String ) : Xml;
 
 
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
-	**/	
+	**/
 	static function createComment( data : String ) : Xml;
 	static function createComment( data : String ) : Xml;
 
 
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
-	**/	
+	**/
 	static function createDocType( data : String ) : Xml;
 	static function createDocType( data : String ) : Xml;
 
 
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
-	**/	
+	**/
 	static function createProlog( data : String ) : Xml;
 	static function createProlog( data : String ) : Xml;
 
 
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
-	**/	
+	**/
 	static function createDocument() : Xml;
 	static function createDocument() : Xml;
 
 
 	/**
 	/**
@@ -145,22 +145,22 @@ extern class Xml {
 		Attributes are case-sensitive.
 		Attributes are case-sensitive.
 	**/
 	**/
 	function set( att : String, value : String ) : Void;
 	function set( att : String, value : String ) : Void;
-	
+
 	/**
 	/**
 		Removes an attribute for an Element node.
 		Removes an attribute for an Element node.
 		Attributes are case-sensitive.
 		Attributes are case-sensitive.
-	**/	
+	**/
 	function remove( att : String ) : Void;
 	function remove( att : String ) : Void;
-	
+
 	/**
 	/**
 		Tells if the Element node has a given attribute.
 		Tells if the Element node has a given attribute.
 		Attributes are case-sensitive.
 		Attributes are case-sensitive.
-	**/	
+	**/
 	function exists( att : String ) : Bool;
 	function exists( att : String ) : Bool;
-	
+
 	/**
 	/**
 		Returns an [Iterator] on all the attributes values.
 		Returns an [Iterator] on all the attributes values.
-	**/	
+	**/
 	function attributes() : Iterator<String>;
 	function attributes() : Iterator<String>;
 
 
 	/**
 	/**
@@ -179,15 +179,15 @@ extern class Xml {
 	/**
 	/**
 		Returns an iterator of all child nodes which are Elements.
 		Returns an iterator of all child nodes which are Elements.
 		Only works if the current node is an Element or a Document.
 		Only works if the current node is an Element or a Document.
-	**/	
+	**/
 	function elements() : Iterator<Xml>;
 	function elements() : Iterator<Xml>;
-	
+
 	/**
 	/**
 		Returns an iterator of all child nodes which are Elements with the given nodeName.
 		Returns an iterator of all child nodes which are Elements with the given nodeName.
 		Only works if the current node is an Element or a Document.
 		Only works if the current node is an Element or a Document.
-	**/		
+	**/
 	function elementsNamed( name : String ) : Iterator<Xml>;
 	function elementsNamed( name : String ) : Iterator<Xml>;
-	
+
 	/**
 	/**
 		Returns the first child node.
 		Returns the first child node.
 	**/
 	**/
@@ -195,22 +195,22 @@ extern class Xml {
 
 
 	/**
 	/**
 		Returns the first child node which is an Element.
 		Returns the first child node which is an Element.
-	**/	
+	**/
 	function firstElement() : Xml;
 	function firstElement() : Xml;
 
 
-	
+
 	/**
 	/**
 		Adds a child node to the Document or Element.
 		Adds a child node to the Document or Element.
 		One node can only be inside one given node which is indicated by the [parent] property.
 		One node can only be inside one given node which is indicated by the [parent] property.
-	**/	
+	**/
 	function addChild( x : Xml ) : Void;
 	function addChild( x : Xml ) : Void;
 
 
 	/**
 	/**
 		Removes a child from the Document or Element.
 		Removes a child from the Document or Element.
 		Returns true if the child was successfuly removed.
 		Returns true if the child was successfuly removed.
-	**/	
+	**/
 	function removeChild( x : Xml ) : Bool;
 	function removeChild( x : Xml ) : Bool;
-	
+
 	/**
 	/**
 		Inserts a child at the given position among the other childs.
 		Inserts a child at the given position among the other childs.
 	**/
 	**/
@@ -227,12 +227,16 @@ extern class Xml {
 		neko.Boot.__classes.Xml = Xml;
 		neko.Boot.__classes.Xml = Xml;
 		#else js
 		#else js
 		Xml = js.JsXml__;
 		Xml = js.JsXml__;
+		#else flash9
+		var ref = flash.FlashXml__;
 		#else flash
 		#else flash
 		Xml = flash.FlashXml__;
 		Xml = flash.FlashXml__;
 		#else error
 		#else error
 		#end
 		#end
 
 
+		#if !flash9
 		Xml.__name__ = ["Xml"];
 		Xml.__name__ = ["Xml"];
+		#end
 		Xml.Element = "element";
 		Xml.Element = "element";
 		Xml.PCData = "pcdata";
 		Xml.PCData = "pcdata";
 		Xml.CData = "cdata";
 		Xml.CData = "cdata";

+ 22 - 16
std/flash9/Boot.hx

@@ -3,16 +3,19 @@ package flash;
 class Boot extends flash.display.MovieClip {
 class Boot extends flash.display.MovieClip {
 
 
 	#if (!flash9doc)
 	#if (!flash9doc)
-	
+
 	static var init : Void -> Void;
 	static var init : Void -> Void;
 	static var tf : flash.text.TextField;
 	static var tf : flash.text.TextField;
 	static var lines : Array<String>;
 	static var lines : Array<String>;
+	public static var skip_constructor = false;
 
 
-	function new() {
+	public function new(?mc:flash.display.MovieClip) {
 		super();
 		super();
 		untyped {
 		untyped {
 			var aproto = Array.prototype;
 			var aproto = Array.prototype;
-			aproto.copy = aproto.slice;
+			aproto.copy = function() {
+				return this.slice();
+			};
 			aproto.insert = function(i,x) {
 			aproto.insert = function(i,x) {
 				this.splice(i,0,x);
 				this.splice(i,0,x);
 			};
 			};
@@ -36,10 +39,12 @@ class Boot extends flash.display.MovieClip {
 					}
 					}
 				}
 				}
 			};
 			};
+			#if !as3gen
 			Bool = __global__["Boolean"];
 			Bool = __global__["Boolean"];
 			Int = __global__["int"];
 			Int = __global__["int"];
 			Float = __global__["Number"];
 			Float = __global__["Number"];
 			Dynamic = { toString : function(){ return "Dynamic"; } };
 			Dynamic = { toString : function(){ return "Dynamic"; } };
+			#end
 			var cca = String.prototype.charCodeAt;
 			var cca = String.prototype.charCodeAt;
 			String.prototype.charCodeAt = function(i) {
 			String.prototype.charCodeAt = function(i) {
 				var x = cca.call(this,i);
 				var x = cca.call(this,i);
@@ -49,37 +54,38 @@ class Boot extends flash.display.MovieClip {
 			};
 			};
 		}
 		}
 		lines = new Array();
 		lines = new Array();
-		flash.Lib.current = this;
-		init();
+		flash.Lib.current = if( mc == null ) this else mc;
+		if( init != null )
+			init();
 	}
 	}
 
 
-	static function enum_to_string( e ) {
+	public static function enum_to_string( e ) {
 		if( e.params == null )
 		if( e.params == null )
 			return e.tag;
 			return e.tag;
 		return e.tag+"("+e.params.join(",")+")";
 		return e.tag+"("+e.params.join(",")+")";
 	}
 	}
 
 
-	static function __instanceof( v : Dynamic, t : Dynamic ) {
+	public static function __instanceof( v : Dynamic, t : Dynamic ) {
 		try {
 		try {
 			if( t === untyped __global__["Dynamic"] )
 			if( t === untyped __global__["Dynamic"] )
 				return true;
 				return true;
 			return untyped __is__(v,t);
 			return untyped __is__(v,t);
 		} catch( e : Dynamic ) {
 		} catch( e : Dynamic ) {
-			return false;
 		}
 		}
+		return false;
 	}
 	}
 
 
-	static function __clear_trace() {
+	public static function __clear_trace() {
 		flash.Lib.current.removeChild(tf);
 		flash.Lib.current.removeChild(tf);
 		tf = null;
 		tf = null;
 		lines = new Array();
 		lines = new Array();
 	}
 	}
-	
-	static function __set_trace_color(rgb) {
+
+	public static function __set_trace_color(rgb) {
 		getTrace().textColor = rgb;
 		getTrace().textColor = rgb;
 	}
 	}
-	
-	static function getTrace() {
+
+	public static function getTrace() {
 		var mc = flash.Lib.current;
 		var mc = flash.Lib.current;
 		if( tf == null ) {
 		if( tf == null ) {
 			tf = new flash.text.TextField();
 			tf = new flash.text.TextField();
@@ -91,7 +97,7 @@ class Boot extends flash.display.MovieClip {
 		return tf;
 		return tf;
 	}
 	}
 
 
-	static function __trace( v : Dynamic, pos : haxe.PosInfos ) {
+	public static function __trace( v : Dynamic, pos : haxe.PosInfos ) {
 		var tf = getTrace();
 		var tf = getTrace();
 		var pstr = if( pos == null ) "(null)" else pos.fileName+":"+pos.lineNumber;
 		var pstr = if( pos == null ) "(null)" else pos.fileName+":"+pos.lineNumber;
 		lines = lines.concat((pstr +": "+__string_rec(v,"")).split("\n"));
 		lines = lines.concat((pstr +": "+__string_rec(v,"")).split("\n"));
@@ -103,7 +109,7 @@ class Boot extends flash.display.MovieClip {
 		}
 		}
 	}
 	}
 
 
-	static function __string_rec( v : Dynamic, str : String ) {
+	public static function __string_rec( v : Dynamic, str : String ) {
 		var cname = untyped __global__["flash.utils.getQualifiedClassName"](v);
 		var cname = untyped __global__["flash.utils.getQualifiedClassName"](v);
 		switch( cname ) {
 		switch( cname ) {
 		case "Object":
 		case "Object":
@@ -141,7 +147,7 @@ class Boot extends flash.display.MovieClip {
 		}
 		}
 		return new String(v);
 		return new String(v);
 	}
 	}
-	
+
 	#end
 	#end
 
 
 }
 }

+ 15 - 7
std/flash9/FlashXml__.hx

@@ -41,6 +41,14 @@ class FlashXml__ {
 	static var edoctype_elt = ~/[\[|\]>]/;
 	static var edoctype_elt = ~/[\[|\]>]/;
 	static var ecomment_end = ~/-->/;
 	static var ecomment_end = ~/-->/;
 
 
+	public static var Element : String;
+	public static var PCData : String;
+	public static var CData : String;
+	public static var Comment : String;
+	public static var DocType : String;
+	public static var Prolog : String;
+	public static var Document : String;
+
 	public var nodeType(default,null) : XmlType;
 	public var nodeType(default,null) : XmlType;
 	public var nodeName(getNodeName,setNodeName) : String;
 	public var nodeName(getNodeName,setNodeName) : String;
 	public var nodeValue(getNodeValue,setNodeValue) : String;
 	public var nodeValue(getNodeValue,setNodeValue) : String;
@@ -152,7 +160,7 @@ class FlashXml__ {
 	private function new(){
 	private function new(){
 	}
 	}
 
 
-	static function createElement( name : String ) : FlashXml__ {
+	public static function createElement( name : String ) : FlashXml__ {
 		var r = new FlashXml__();
 		var r = new FlashXml__();
 		r.nodeType = Xml.Element;
 		r.nodeType = Xml.Element;
 		r._children = new Array();
 		r._children = new Array();
@@ -161,42 +169,42 @@ class FlashXml__ {
 		return r;
 		return r;
 	}
 	}
 
 
-	static function createPCData( data : String ) : FlashXml__ {
+	public static function createPCData( data : String ) : FlashXml__ {
 		var r = new FlashXml__();
 		var r = new FlashXml__();
 		r.nodeType = Xml.PCData;
 		r.nodeType = Xml.PCData;
 		r.setNodeValue( data );
 		r.setNodeValue( data );
 		return r;
 		return r;
 	}
 	}
 
 
-	static function createCData( data : String ) : FlashXml__ {
+	public static function createCData( data : String ) : FlashXml__ {
 		var r = new FlashXml__();
 		var r = new FlashXml__();
 		r.nodeType = Xml.CData;
 		r.nodeType = Xml.CData;
 		r.setNodeValue( data );
 		r.setNodeValue( data );
 		return r;
 		return r;
 	}
 	}
 
 
-	static function createComment( data : String ) : FlashXml__ {
+	public static function createComment( data : String ) : FlashXml__ {
 		var r = new FlashXml__();
 		var r = new FlashXml__();
 		r.nodeType = Xml.Comment;
 		r.nodeType = Xml.Comment;
 		r.setNodeValue( data );
 		r.setNodeValue( data );
 		return r;
 		return r;
 	}
 	}
 
 
-	static function createDocType( data : String ) : FlashXml__ {
+	public static function createDocType( data : String ) : FlashXml__ {
 		var r = new FlashXml__();
 		var r = new FlashXml__();
 		r.nodeType = Xml.DocType;
 		r.nodeType = Xml.DocType;
 		r.setNodeValue( data );
 		r.setNodeValue( data );
 		return r;
 		return r;
 	}
 	}
 
 
-	static function createProlog( data : String ) : FlashXml__ {
+	public static function createProlog( data : String ) : FlashXml__ {
 		var r = new FlashXml__();
 		var r = new FlashXml__();
 		r.nodeType = Xml.Prolog;
 		r.nodeType = Xml.Prolog;
 		r.setNodeValue( data );
 		r.setNodeValue( data );
 		return r;
 		return r;
 	}
 	}
 
 
-	static function createDocument() : FlashXml__ {
+	public static function createDocument() : FlashXml__ {
 		var r = new FlashXml__();
 		var r = new FlashXml__();
 		r.nodeType = Xml.Document;
 		r.nodeType = Xml.Document;
 		r._children = new Array();
 		r._children = new Array();

+ 1 - 1
std/flash9/Lib.hx

@@ -35,7 +35,7 @@ class Lib {
 	public static function eval( path : String ) : Dynamic {
 	public static function eval( path : String ) : Dynamic {
 		var p = path.split(".");
 		var p = path.split(".");
 		var fields = new Array();
 		var fields = new Array();
-		var o = null;
+		var o : Dynamic = null;
 		while( p.length > 0 ) {
 		while( p.length > 0 ) {
 			try {
 			try {
 				o = untyped __global__["flash.utils.getDefinitionByName"](p.join("."));
 				o = untyped __global__["flash.utils.getDefinitionByName"](p.join("."));

+ 2 - 1
std/haxe/Serializer.hx

@@ -218,8 +218,9 @@ class Serializer {
 					serialize(i);
 					serialize(i);
 				buf.add("h");
 				buf.add("h");
 			case cast Date:
 			case cast Date:
+				var d : Date = v;
 				buf.add("v");
 				buf.add("v");
-				buf.add(v.toString());
+				buf.add(d.toString());
 			case cast Hash:
 			case cast Hash:
 				buf.add("b");
 				buf.add("b");
 				for( k in v.keys() ) {
 				for( k in v.keys() ) {

+ 1 - 5
std/haxe/Unserializer.hx

@@ -129,11 +129,7 @@ class Unserializer {
  				else
  				else
  					break;
  					break;
  			}
  			}
- 			var s = buf.substr(p1,pos-p1);
- 			var f = Std.parseFloat(s);
- 			if( f == null )
- 				throw ("Invalid float "+s);
- 			return f;
+ 			return Std.parseFloat(buf.substr(p1,pos-p1));
 		case 121: // y
 		case 121: // y
  			var len = readDigits();
  			var len = readDigits();
  			if( buf.charAt(pos++) != ":" || length - pos < len )
  			if( buf.charAt(pos++) != ":" || length - pos < len )