Browse Source

Merge branch 'development' into genpy

Simon Krajewski 11 years ago
parent
commit
16f778276e
100 changed files with 1249 additions and 891 deletions
  1. 6 4
      .travis.yml
  2. 0 6
      Makefile
  3. 5 5
      README.md
  4. 16 0
      ast.ml
  5. 3 8
      codegen.ml
  6. 32 11
      common.ml
  7. 27 4
      extra/CHANGES.txt
  8. 6 0
      extra/clean-whitespace
  9. 1 0
      extra/installer.nsi
  10. 16 15
      extra/release-checklist.txt
  11. 111 33
      filters.ml
  12. 1 1
      genas3.ml
  13. 10 9
      gencommon.ml
  14. 72 18
      gencpp.ml
  15. 88 28
      gencs.ml
  16. 1 1
      genjava.ml
  17. 6 8
      genjs.ml
  18. 1 1
      interp.ml
  19. 1 1
      libs
  20. 11 4
      main.ml
  21. 27 8
      matcher.ml
  22. 61 23
      optimizer.ml
  23. 6 6
      parser.ml
  24. 1 1
      std/Class.hx
  25. 7 7
      std/Date.hx
  26. 4 4
      std/DateTools.hx
  27. 31 31
      std/EReg.hx
  28. 2 2
      std/Enum.hx
  29. 4 4
      std/IntIterator.hx
  30. 9 9
      std/List.hx
  31. 31 31
      std/Map.hx
  32. 35 35
      std/Reflect.hx
  33. 5 5
      std/Std.hx
  34. 9 9
      std/StdTypes.hx
  35. 26 26
      std/String.hx
  36. 11 11
      std/StringBuf.hx
  37. 6 6
      std/StringTools.hx
  38. 59 59
      std/Type.hx
  39. 24 36
      std/UInt.hx
  40. 17 0
      std/cpp/Pointer.hx
  41. 1 1
      std/cpp/_std/Reflect.hx
  42. 10 10
      std/cpp/vm/Debugger.hx
  43. 5 5
      std/cpp/vm/WeakRef.hx
  44. 2 2
      std/cs/Out.hx
  45. 2 2
      std/cs/Ref.hx
  46. 3 3
      std/cs/StringBuilder.hx
  47. 3 3
      std/cs/_std/sys/net/Host.hx
  48. 4 4
      std/cs/_std/sys/net/Socket.hx
  49. 7 0
      std/cs/internal/Exceptions.hx
  50. 12 12
      std/cs/internal/FieldLookup.hx
  51. 5 5
      std/cs/internal/Iterator.hx
  52. 11 11
      std/cs/io/NativeInput.hx
  53. 1 1
      std/flash/Lib.hx
  54. 1 1
      std/flash/_std/Reflect.hx
  55. 1 1
      std/flash/_std/Xml.hx
  56. 4 4
      std/flash/_std/haxe/ds/ObjectMap.hx
  57. 4 4
      std/flash/_std/haxe/ds/WeakMap.hx
  58. 1 1
      std/flash/_std/haxe/zip/Compress.hx
  59. 1 1
      std/flash8/_std/Reflect.hx
  60. 1 1
      std/flash8/_std/Std.hx
  61. 12 12
      std/flash8/_std/haxe/ds/ObjectMap.hx
  62. 23 1
      std/haxe/CallStack.hx
  63. 2 2
      std/haxe/Constraints.hx
  64. 7 7
      std/haxe/EnumFlags.hx
  65. 29 29
      std/haxe/EnumTools.hx
  66. 6 6
      std/haxe/Http.hx
  67. 28 28
      std/haxe/Int64.hx
  68. 1 1
      std/haxe/Log.hx
  69. 2 2
      std/haxe/PosInfos.hx
  70. 3 2
      std/haxe/Serializer.hx
  71. 16 16
      std/haxe/Timer.hx
  72. 25 25
      std/haxe/Ucs2.hx
  73. 2 2
      std/haxe/Unserializer.hx
  74. 2 2
      std/haxe/crypto/Adler32.hx
  75. 2 2
      std/haxe/crypto/Base64.hx
  76. 5 5
      std/haxe/crypto/Crc32.hx
  77. 12 12
      std/haxe/ds/ArraySort.hx
  78. 33 33
      std/haxe/ds/BalancedTree.hx
  79. 4 4
      std/haxe/ds/EnumValueMap.hx
  80. 7 7
      std/haxe/ds/GenericStack.hx
  81. 2 2
      std/haxe/ds/IntMap.hx
  82. 5 5
      std/haxe/ds/ListSort.hx
  83. 16 16
      std/haxe/ds/ObjectMap.hx
  84. 1 1
      std/haxe/ds/StringMap.hx
  85. 4 5
      std/haxe/ds/Vector.hx
  86. 18 18
      std/haxe/ds/WeakMap.hx
  87. 1 1
      std/haxe/format/JsonPrinter.hx
  88. 14 7
      std/haxe/io/Bytes.hx
  89. 7 4
      std/haxe/io/BytesInput.hx
  90. 3 3
      std/haxe/macro/Compiler.hx
  91. 6 6
      std/haxe/macro/ComplexTypeTools.hx
  92. 5 5
      std/haxe/macro/ExprTools.hx
  93. 16 16
      std/haxe/macro/MacroStringTools.hx
  94. 6 6
      std/haxe/macro/Printer.hx
  95. 11 11
      std/haxe/macro/Type.hx
  96. 29 29
      std/haxe/macro/TypeTools.hx
  97. 8 8
      std/haxe/macro/TypedExprTools.hx
  98. 1 1
      std/haxe/rtti/Meta.hx
  99. 1 1
      std/haxe/rtti/XmlParser.hx
  100. 6 6
      std/haxe/xml/Parser.hx

+ 6 - 4
.travis.yml

@@ -13,19 +13,21 @@ env:
     - TARGET=php
     - TARGET=php
     - TARGET=cpp
     - TARGET=cpp
     - TARGET=flash9
     - TARGET=flash9
-    - TARGET=flash8
     - TARGET=as3
     - TARGET=as3
     - TARGET=java
     - TARGET=java
     - TARGET=cs
     - TARGET=cs
+    - TARGET=flash8
 
 
 matrix:
 matrix:
+  fast_finish: true
   allow_failures:
   allow_failures:
     - env: TARGET=flash8
     - env: TARGET=flash8
 
 
 before_install:
 before_install:
-  - sudo apt-get update
-  - sudo apt-get install ocaml zlib1g-dev libgc-dev -y
-  - git clone https://github.com/HaxeFoundation/neko.git ~/neko && cd ~/neko && make && sudo make install && cd $TRAVIS_BUILD_DIR
+  - travis_retry sudo apt-get update
+  - travis_retry sudo apt-get install ocaml zlib1g-dev libgc-dev -y
+  - travis_retry git clone https://github.com/HaxeFoundation/neko.git ~/neko
+  - cd ~/neko && make && sudo make install && cd $TRAVIS_BUILD_DIR
 
 
 script:
 script:
   - make
   - make

+ 0 - 6
Makefile

@@ -32,8 +32,6 @@ NATIVE_LIBS=-cclib libs/extc/extc_stubs.o -cclib -lz -cclib libs/objsize/c_objsi
 
 
 RELDIR=../../..
 RELDIR=../../..
 
 
-EXPORT=../../../projects/motionTools/haxe
-
 MODULES=ast type lexer common genxml parser typecore optimizer typeload \
 MODULES=ast type lexer common genxml parser typecore optimizer typeload \
 codegen gencommon genas3 gencpp genjs genneko genphp genswf8 \
 codegen gencommon genas3 gencpp genjs genneko genphp genswf8 \
 	genswf9 genswf genjava gencs genpy interp dce filters typer matcher version main
 	genswf9 genswf genjava gencs genpy interp dce filters typer matcher version main
@@ -105,10 +103,6 @@ install_tools: tools
 uninstall:
 uninstall:
 	rm -rf $(INSTALL_BIN_DIR)/haxe $(INSTALL_BIN_DIR)/haxelib $(INSTALL_LIB_DIR)
 	rm -rf $(INSTALL_BIN_DIR)/haxe $(INSTALL_BIN_DIR)/haxelib $(INSTALL_LIB_DIR)
 
 
-export:
-	cp haxe*.exe doc/CHANGES.txt $(EXPORT)
-	rsync -a --exclude .svn --exclude *.n --exclude std/libs --delete std $(EXPORT)
-
 codegen.cmx: optimizer.cmx typeload.cmx typecore.cmx type.cmx genxml.cmx common.cmx ast.cmx
 codegen.cmx: optimizer.cmx typeload.cmx typecore.cmx type.cmx genxml.cmx common.cmx ast.cmx
 
 
 common.cmx: type.cmx ast.cmx
 common.cmx: type.cmx ast.cmx

+ 5 - 5
README.md

@@ -35,12 +35,12 @@ For the complete Haxe licenses, please see http://haxe.org/doc/license or [doc/L
 
 
 ## Installing Haxe
 ## Installing Haxe
 
 
-The latest stable release is [Haxe v3.1.0](http://haxe.org/download). Pre-built binaries are available for your platform:
+The latest stable release is [Haxe v3.1.1](http://haxe.org/download). Pre-built binaries are available for your platform:
 
 
- * **[Windows installer](http://haxe.org/file/haxe-3.1.0-win.exe)**
- * **[OSX installer](http://haxe.org/file/haxe-3.1.0-osx-installer.pkg)**
- * **[Linux 32-bit binaries](http://haxe.org/file/haxe-3.1.0-linux32.tar.gz)**
- * **[Linux 64-bit binaries](http://haxe.org/file/haxe-3.1.0-linux64.tar.gz)**
+ * **[Windows installer](http://haxe.org/file/haxe-3.1.1-win.exe)**
+ * **[OSX installer](http://haxe.org/file/haxe-3.1.1-osx-installer.pkg)**
+ * **[Linux 32-bit binaries](http://haxe.org/file/haxe-3.1.1-linux32.tar.gz)**
+ * **[Linux 64-bit binaries](http://haxe.org/file/haxe-3.1.1-linux64.tar.gz)**
  
  
 Automated development builds are available from [build.haxe.org](http://build.haxe.org).
 Automated development builds are available from [build.haxe.org](http://build.haxe.org).
 
 

+ 16 - 0
ast.ml

@@ -617,6 +617,22 @@ let unescape s =
 					let c = (try char_of_int (int_of_string ("0x" ^ String.sub s (i+1) 2)) with _ -> raise Exit) in
 					let c = (try char_of_int (int_of_string ("0x" ^ String.sub s (i+1) 2)) with _ -> raise Exit) in
 					Buffer.add_char b c;
 					Buffer.add_char b c;
 					inext := !inext + 2;
 					inext := !inext + 2;
+				| 'u' ->
+					let (u, a) =
+					  (try
+					      (int_of_string ("0x" ^ String.sub s (i+1) 4), 4)
+					    with
+					      _ -> try
+						assert (s.[i+1] = '{');
+						let l = String.index_from s (i+3) '}' - (i+2) in
+						let u = int_of_string ("0x" ^ String.sub s (i+2) l) in
+						assert (u <= 0x10FFFF);
+						(u, l+2)
+					      with _ -> raise Exit) in
+					let ub = UTF8.Buf.create 0 in
+					UTF8.Buf.add_char ub (UChar.uchar_of_int u);
+					Buffer.add_string b (UTF8.Buf.contents ub);
+					inext := !inext + a;
 				| _ ->
 				| _ ->
 					raise Exit);
 					raise Exit);
 				loop false !inext;
 				loop false !inext;

+ 3 - 8
codegen.ml

@@ -531,7 +531,7 @@ let build_macro_type ctx pl p =
 		| [TInst ({ cl_kind = KExpr (EArrayDecl [ECall (e,args),_],_) },_)] ->
 		| [TInst ({ cl_kind = KExpr (EArrayDecl [ECall (e,args),_],_) },_)] ->
 			get_macro_path e args p
 			get_macro_path e args p
 		| _ ->
 		| _ ->
-			error "MacroType require a single expression call parameter" p
+			error "MacroType requires a single expression call parameter" p
 	) in
 	) in
 	let old = ctx.ret in
 	let old = ctx.ret in
 	let t = (match ctx.g.do_macro ctx MMacroType path field args p with
 	let t = (match ctx.g.do_macro ctx MMacroType path field args p with
@@ -544,7 +544,7 @@ let build_macro_type ctx pl p =
 let build_macro_build ctx c pl cfl p =
 let build_macro_build ctx c pl cfl p =
 	let path, field, args = match Meta.get Meta.GenericBuild c.cl_meta with
 	let path, field, args = match Meta.get Meta.GenericBuild c.cl_meta with
 		| _,[ECall(e,args),_],_ -> get_macro_path e args p
 		| _,[ECall(e,args),_],_ -> get_macro_path e args p
-		| _ -> assert false
+		| _ -> error "genericBuild requires a single expression call parameter" p
 	in
 	in
 	let old = ctx.ret,ctx.g.get_build_infos in
 	let old = ctx.ret,ctx.g.get_build_infos in
 	ctx.g.get_build_infos <- (fun() -> Some (TClassDecl c, pl, cfl));
 	ctx.g.get_build_infos <- (fun() -> Some (TClassDecl c, pl, cfl));
@@ -673,12 +673,7 @@ module Abstract = struct
 				maybe_recurse (apply_params a.a_types pl a.a_this)
 				maybe_recurse (apply_params a.a_types pl a.a_this)
 
 
 	let make_static_call ctx c cf a pl args t p =
 	let make_static_call ctx c cf a pl args t p =
-		let ta = TAnon { a_fields = c.cl_statics; a_status = ref (Statics c) } in
-		let ethis = mk (TTypeExpr (TClassDecl c)) ta p in
-	  	let monos = List.map (fun _ -> mk_mono()) cf.cf_params in
-		let map t = apply_params a.a_types pl (apply_params cf.cf_params monos t) in
-		let ef = mk (TField (ethis,(FStatic (c,cf)))) (map cf.cf_type) p in
-		make_call ctx ef args (map t) p
+		make_static_call ctx c cf (apply_params a.a_types pl) args t p
 
 
 	let rec do_check_cast ctx tleft eright p =
 	let rec do_check_cast ctx tleft eright p =
 		let tright = follow eright.etype in
 		let tright = follow eright.etype in

+ 32 - 11
common.ml

@@ -132,6 +132,7 @@ type context = {
 	mutable print : string -> unit;
 	mutable print : string -> unit;
 	mutable get_macros : unit -> context option;
 	mutable get_macros : unit -> context option;
 	mutable run_command : string -> int;
 	mutable run_command : string -> int;
+	file_lookup_cache : (string,string option) Hashtbl.t;
 	(* output *)
 	(* output *)
 	mutable file : string;
 	mutable file : string;
 	mutable flash_version : float;
 	mutable flash_version : float;
@@ -171,6 +172,7 @@ module Define = struct
 		| Dce
 		| Dce
 		| DceDebug
 		| DceDebug
 		| Debug
 		| Debug
+		| DeprecationWarnings
 		| Display
 		| Display
 		| DllExport
 		| DllExport
 		| DllImport
 		| DllImport
@@ -242,6 +244,7 @@ module Define = struct
 		| Dce -> ("dce","The current DCE mode")
 		| Dce -> ("dce","The current DCE mode")
 		| DceDebug -> ("dce_debug","Show DCE log")
 		| DceDebug -> ("dce_debug","Show DCE log")
 		| Debug -> ("debug","Activated when compiling with -debug")
 		| Debug -> ("debug","Activated when compiling with -debug")
+		| DeprecationWarnings -> ("deprecation-warnings","Warn if fields annotated with @:deprecated are used")
 		| Display -> ("display","Activated during completion")
 		| Display -> ("display","Activated during completion")
 		| DllExport -> ("dll_export", "GenCPP experimental linking")
 		| DllExport -> ("dll_export", "GenCPP experimental linking")
 		| DllImport -> ("dll_import", "GenCPP experimental linking")
 		| DllImport -> ("dll_import", "GenCPP experimental linking")
@@ -701,6 +704,7 @@ let create v args =
 			tstring = m;
 			tstring = m;
 			tarray = (fun _ -> assert false);
 			tarray = (fun _ -> assert false);
 		};
 		};
+		file_lookup_cache = Hashtbl.create 0;
 		memory_marker = memory_marker;
 		memory_marker = memory_marker;
 	}
 	}
 
 
@@ -709,7 +713,12 @@ let log com str =
 
 
 let clone com =
 let clone com =
 	let t = com.basic in
 	let t = com.basic in
-	{ com with basic = { t with tvoid = t.tvoid }; main_class = None; features = Hashtbl.create 0; }
+	{ com with
+		basic = { t with tvoid = t.tvoid };
+		main_class = None;
+		features = Hashtbl.create 0;
+		file_lookup_cache = Hashtbl.create 0;
+	}
 
 
 let file_time file =
 let file_time file =
 	try (Unix.stat file).Unix.st_mtime with _ -> 0.
 	try (Unix.stat file).Unix.st_mtime with _ -> 0.
@@ -877,16 +886,28 @@ let add_final_filter ctx f =
 	ctx.final_filters <- f :: ctx.final_filters
 	ctx.final_filters <- f :: ctx.final_filters
 
 
 let find_file ctx f =
 let find_file ctx f =
-	let rec loop = function
-		| [] -> raise Not_found
-		| p :: l ->
-			let file = p ^ f in
-			if Sys.file_exists file then
-				file
-			else
-				loop l
-	in
-	loop ctx.class_path
+	try
+		(match Hashtbl.find ctx.file_lookup_cache f with
+		| None -> raise Exit
+		| Some f -> f)
+	with Exit ->
+		raise Not_found
+	| Not_found ->
+		let rec loop = function
+			| [] -> raise Not_found
+			| p :: l ->
+				let file = p ^ f in
+				if Sys.file_exists file then
+					file
+				else
+					loop l
+		in
+		let r = (try Some (loop ctx.class_path) with Not_found -> None) in
+		Hashtbl.add ctx.file_lookup_cache f r;
+		(match r with
+		| None -> raise Not_found
+		| Some f -> f)
+		
 
 
 let get_full_path f = try Extc.get_full_path f with _ -> f
 let get_full_path f = try Extc.get_full_path f with _ -> f
 
 

+ 27 - 4
extra/CHANGES.txt

@@ -1,15 +1,38 @@
-2014-??-??: 3.1.1
+2014-??-??: 3.1.2
+
+	Bugfixes:
+
+	all : properly disallowed usage of super as value
+	all : disallowed spaces between >>, >>>, >>= and >>>=
+	cpp : fixed bug in side-effect handler which caused incorrect behavior of while loops
+
+	General improvements and optimizations:
+
+	all : cached file exist checks to speed up compilations with a lot of class paths
+	all : allowed iterating on abstract which have get_length and @:arrayAccess fields
+
+2014-03-15: 3.1.1
+
+	New features:
+
+	all : added -D deprecation-warnings
+	all : allowed \u escape sequences in strings
+	cs : implemented haxe.CallStack
 
 
 	Bugfixes:
 	Bugfixes:
 
 
 	all : fixed wrong handling of "" and null in haxe.io.Path.join
 	all : fixed wrong handling of "" and null in haxe.io.Path.join
 	all : fixed invalid cast-to-self generation on some abstracts
 	all : fixed invalid cast-to-self generation on some abstracts
 	all : removed @:to Dynamic from UInt to avoid issues in the Map selection algorithm
 	all : removed @:to Dynamic from UInt to avoid issues in the Map selection algorithm
+	all : fixed various issues with UInt
+	all : fixed position setter in haxe.io.BytesInput
 	all : fixed various issues with member/static extension macros
 	all : fixed various issues with member/static extension macros
-	all : disallowed member field initialization of classes without constructors
 	flash : fixed invalid override involving single-constraint type parameters
 	flash : fixed invalid override involving single-constraint type parameters
-	flash8: fixed various bugs
-	js : disable Std.string optimization of basic type to avoid problems with null values
+	flash8 : fixed various bugs
+	js : fixed a problem with Std.string(null) being optimized incorrectly
+	js : fixed custom generators
+	cpp : dealt with string literals that are too long for MSVC
+	cs : fixed various issues with -net-lib
 
 
 2014-03-04: 3.1.0
 2014-03-04: 3.1.0
 
 

+ 6 - 0
extra/clean-whitespace

@@ -0,0 +1,6 @@
+#!/bin/sh
+#
+# Remove trailing whitespace from Haxe files
+
+# Exclude generated js.html.* for now
+find  -path ./std/js/html -prune -o -name '*.hx' -print0 | xargs -0 perl -pi -e "s/[ \t]+$//"

+ 1 - 0
extra/installer.nsi

@@ -122,6 +122,7 @@ Section "Haxe ${VERSION}" Main
 	SectionIn 1 2 RO
 	SectionIn 1 2 RO
 	SetOverwrite on
 	SetOverwrite on
 
 
+	RMDir /r /REBOOTOK "$INSTDIR\haxe\std"
 	SetOutPath "$INSTDIR\haxe"
 	SetOutPath "$INSTDIR\haxe"
 
 
 	File /r /x .svn /x *.db /x Exceptions.log /x .local /x .multi /x *.pdb /x *.vshost.exe /x *.vshost.exe.config /x *.vshost.exe.manifest "resources\haxe\*.*"
 	File /r /x .svn /x *.db /x Exceptions.log /x .local /x .multi /x *.pdb /x *.vshost.exe /x *.vshost.exe.config /x *.vshost.exe.manifest "resources\haxe\*.*"

+ 16 - 15
extra/release-checklist.txt

@@ -1,15 +1,16 @@
-1. Make sure CHANGES.txt has a proper date set.
-2. Make sure `version` in main.ml has the correct value.
-3. Merge development branch into master.
-4. Wait for Travis to greenlight master.
-5. Tag master.
-6. Wait for builds.haxe.org to build master.
-7. If required, tell Caue to fix builds.haxe.org.
-8. Get https://github.com/waneck/hxbuilds/tree/master/release-helper
-9. Run it with the fileName corresponding to the latest master file name on builds.haxe.org.
-10. Upload generated files to some place.
-11. Update Haxe download page.
-12. Double-check that you got the links right.
-13. Regenerate and upload API documentation.
-14. Write announcement post.
-15. Post announcement post.
+- Make sure CHANGES.txt has a proper date set.
+- Make sure `version` in main.ml has the correct value.
+- Merge development branch into master.
+- Wait for Travis to greenlight master.
+- Tag master.
+- Wait for builds.haxe.org to build master.
+- If required, tell Caue to fix builds.haxe.org.
+- Get https://github.com/waneck/hxbuilds/tree/master/release-helper
+- Run it with the fileName corresponding to the latest master file name on builds.haxe.org.
+- Upload generated files to some place.
+- Update Haxe download page.
+- Double-check that you got the links right.
+- Regenerate and upload API documentation.
+- Update http://haxe.org/file/CHANGES.txt
+- Write announcement post.
+- Post announcement post.

+ 111 - 33
filters.ml

@@ -66,6 +66,13 @@ let mk_block_context com gen_temp =
 	- array access
 	- array access
 *)
 *)
 let handle_side_effects com gen_temp e =
 let handle_side_effects com gen_temp e =
+	let has_direct_side_effect e = match e.eexpr with
+		| TConst _ | TLocal _ | TField _ | TTypeExpr _ | TFunction _ -> false
+		| TPatMatch _ | TNew _ | TCall _ | TBinop ((OpAssignOp _ | OpAssign),_,_) | TUnop ((Increment|Decrement),_,_) -> true
+		| TReturn _ | TBreak | TContinue | TThrow _ | TCast (_,Some _) -> true
+		| TIf _ | TTry _ | TSwitch _ -> true
+		| TArray _ | TEnumParameter _ | TCast (_,None) | TBinop _ | TUnop _ | TParenthesis _ | TMeta _ | TWhile _ | TFor _ | TArrayDecl _ | TVar _ | TBlock _ | TObjectDecl _ -> false
+	in
 	let block,declare_temp,close_block = mk_block_context com gen_temp in
 	let block,declare_temp,close_block = mk_block_context com gen_temp in
 	let rec loop e =
 	let rec loop e =
 		match e.eexpr with
 		match e.eexpr with
@@ -106,6 +113,15 @@ let handle_side_effects com gen_temp e =
 				| _ ->
 				| _ ->
 					assert false
 					assert false
 			end
 			end
+		| TWhile(e1,e2,flag) when (match e1.eexpr with TParenthesis {eexpr = TConst(TBool true)} -> false | _ -> true) ->
+			let p = e.epos in
+			let e_break = mk TBreak t_dynamic p in
+			let e_not = mk (TUnop(Not,Prefix,Codegen.mk_parent e1)) e1.etype e1.epos in
+			let e_if = mk (TIf(e_not,e_break,None)) com.basic.tvoid p in
+			let e_block = if flag = NormalWhile then Codegen.concat e_if e2 else Codegen.concat e2 e_if in
+			let e_true = mk (TConst (TBool true)) com.basic.tbool p in
+			let e = mk (TWhile(Codegen.mk_parent e_true,e_block,NormalWhile)) e.etype p in
+			loop e
 		| _ ->
 		| _ ->
 			Type.map_expr loop e
 			Type.map_expr loop e
 	and ordered_list el =
 	and ordered_list el =
@@ -118,22 +134,10 @@ let handle_side_effects com gen_temp e =
 				e
 				e
 			end
 			end
 		in
 		in
-		let rec no_side_effect e = match e.eexpr with
-			| TNew _ | TCall _ | TArrayDecl _ | TObjectDecl _ | TBinop ((OpAssignOp _ | OpAssign),_,_) | TUnop ((Increment|Decrement),_,_) ->
-				bind e;
-			| TIf _ | TTry _ | TSwitch _ ->
-				(* Technically these are not side-effects, but we have to move them out anyway because their blocks code have side-effects.
-				   This also probably improves readability of the generated code. We can ignore TWhile and TFor because their type is Void,
-				   so they could never appear in a place where side-effects matter. *)
-				bind e
-			| TBinop(op,e1,e2) when Optimizer.has_side_effect e1 || Optimizer.has_side_effect e2 ->
-				bind e;
-			| TConst _ | TLocal _ | TTypeExpr _ | TFunction _
-			| TReturn _ | TBreak | TContinue | TThrow _ | TCast (_,Some _) ->
-				e
-			| TBlock _ ->
+		let rec no_side_effect e =
+			if has_direct_side_effect e then
 				bind e
 				bind e
-			| _ ->
+			else
 				Type.map_expr no_side_effect e
 				Type.map_expr no_side_effect e
 		in
 		in
 		let rec loop2 acc el = match el with
 		let rec loop2 acc el = match el with
@@ -312,12 +316,12 @@ let check_local_vars_init e =
 				vars := intersect !vars v1)
 				vars := intersect !vars v1)
 		| TWhile (cond,e,flag) ->
 		| TWhile (cond,e,flag) ->
 			(match flag with
 			(match flag with
-			| NormalWhile ->
+			| NormalWhile when (match cond.eexpr with TParenthesis {eexpr = TConst (TBool true)} -> false | _ -> true) ->
 				loop vars cond;
 				loop vars cond;
 				let old = !vars in
 				let old = !vars in
 				loop vars e;
 				loop vars e;
 				vars := old;
 				vars := old;
-			| DoWhile ->
+			| _ ->
 				loop vars e;
 				loop vars e;
 				loop vars cond)
 				loop vars cond)
 		| TTry (e,catches) ->
 		| TTry (e,catches) ->
@@ -807,6 +811,72 @@ let rename_local_vars com e =
 	loop e;
 	loop e;
 	e
 	e
 
 
+let check_deprecation com =
+	let curclass = ref null_class in
+	let definition_positions = (Common.defined_value_safe com Define.DeprecationWarnings) = "def-pos" in
+	let warned_positions = Hashtbl.create 0 in
+	let get_deprecation_message meta s p_usage p_definition =
+		try
+			let s = match Meta.get Meta.Deprecated meta with
+				| _,[EConst(String s),_],_ -> s
+				| _ -> Printf.sprintf "Usage of this %s is deprecated" s
+			in
+			if not (Hashtbl.mem warned_positions p_usage) then begin
+				Hashtbl.replace warned_positions p_usage true;
+				com.warning s p_usage;
+			end;
+			if definition_positions then com.warning "Defined here" p_definition
+		with Not_found ->
+			()
+	in
+	let check_cf cf p = get_deprecation_message cf.cf_meta "field" p cf.cf_pos in
+	let check_class c p = if c != !curclass then get_deprecation_message c.cl_meta "class" p c.cl_pos in
+	let check_enum en p = get_deprecation_message en.e_meta "enum" p en.e_pos in
+	let check_ef ef p = get_deprecation_message ef.ef_meta "enum field" p ef.ef_pos in
+	let check_module_type mt p = match mt with
+		| TClassDecl c -> check_class c p
+		| TEnumDecl en -> check_enum en p
+		| _ -> ()
+	in
+	let rec expr e = match e.eexpr with
+		| TField(e1,fa) ->
+			expr e1;
+			begin match fa with
+				| FStatic(c,cf) | FInstance(c,cf) ->
+					check_class c e.epos;
+					check_cf cf e.epos
+				| FAnon cf ->
+					check_cf cf e.epos
+				| FClosure(co,cf) ->
+					(match co with None -> () | Some c -> check_class c e.epos);
+					check_cf cf e.epos
+				| FEnum(en,ef) ->
+					check_enum en e.epos;
+					check_ef ef e.epos;
+				| _ ->
+					()
+			end
+		| TNew(c,_,el) ->
+			List.iter expr el;
+			check_class c e.epos;
+			(match c.cl_constructor with None -> () | Some cf -> check_cf cf e.epos)
+		| TTypeExpr(mt) | TCast(_,Some mt) ->
+			check_module_type mt e.epos
+		| _ ->
+			Type.iter expr e
+	in
+	List.iter (fun t -> match t with
+		| TClassDecl c ->
+			curclass := c;
+			let field cf = match cf.cf_expr with None -> () | Some e -> expr e in
+			(match c.cl_constructor with None -> () | Some cf -> field cf);
+			(match c.cl_init with None -> () | Some e -> expr e);
+			List.iter field c.cl_ordered_statics;
+			List.iter field c.cl_ordered_fields;
+		| _ ->
+			()
+	) com.types
+
 (* PASS 1 end *)
 (* PASS 1 end *)
 
 
 (* Saves a class state so it can be restored later, e.g. after DCE or native path rewrite *)
 (* Saves a class state so it can be restored later, e.g. after DCE or native path rewrite *)
@@ -963,13 +1033,6 @@ let add_field_inits ctx t =
 		match inits with
 		match inits with
 		| [] -> ()
 		| [] -> ()
 		| _ ->
 		| _ ->
-			let cf_ctor = match c.cl_constructor with
-				| None ->
-					List.iter (fun cf -> display_error ctx "Cannot initialize member fields on classes that do not have a constructor" cf.cf_pos) inits;
-					error "Could not initialize member fields" c.cl_pos;
-				| Some cf ->
-					cf
-			in
 			let el = List.map (fun cf ->
 			let el = List.map (fun cf ->
 				match cf.cf_expr with
 				match cf.cf_expr with
 				| None -> assert false
 				| None -> assert false
@@ -984,13 +1047,25 @@ let add_field_inits ctx t =
 						eassign;
 						eassign;
 			) inits in
 			) inits in
 			let el = if !need_this then (mk (TVar((v, Some ethis))) ethis.etype ethis.epos) :: el else el in
 			let el = if !need_this then (mk (TVar((v, Some ethis))) ethis.etype ethis.epos) :: el else el in
-			match cf_ctor.cf_expr with
-			| Some { eexpr = TFunction f } ->
-				let bl = match f.tf_expr with {eexpr = TBlock b } -> b | x -> [x] in
-				let ce = mk (TFunction {f with tf_expr = mk (TBlock (el @ bl)) ctx.com.basic.tvoid c.cl_pos }) cf_ctor.cf_type cf_ctor.cf_pos in
-				c.cl_constructor <- Some {cf_ctor with cf_expr = Some ce }
-			| _ ->
-				assert false
+			match c.cl_constructor with
+			| None ->
+				let ct = TFun([],ctx.com.basic.tvoid) in
+				let ce = mk (TFunction {
+					tf_args = [];
+					tf_type = ctx.com.basic.tvoid;
+					tf_expr = mk (TBlock el) ctx.com.basic.tvoid c.cl_pos;
+				}) ct c.cl_pos in
+				let ctor = mk_field "new" ct c.cl_pos in
+				ctor.cf_kind <- Method MethNormal;
+				c.cl_constructor <- Some { ctor with cf_expr = Some ce };
+			| Some cf ->
+				match cf.cf_expr with
+				| Some { eexpr = TFunction f } ->
+					let bl = match f.tf_expr with {eexpr = TBlock b } -> b | x -> [x] in
+					let ce = mk (TFunction {f with tf_expr = mk (TBlock (el @ bl)) ctx.com.basic.tvoid c.cl_pos }) cf.cf_type cf.cf_pos in
+					c.cl_constructor <- Some {cf with cf_expr = Some ce }
+				| _ ->
+					assert false
 	in
 	in
 	match t with
 	match t with
 	| TClassDecl c ->
 	| TClassDecl c ->
@@ -1071,17 +1146,20 @@ let post_process_end() =
 let run com tctx main =
 let run com tctx main =
 	if com.display = DMUsage then
 	if com.display = DMUsage then
 		Codegen.detect_usage com;
 		Codegen.detect_usage com;
+	if Common.defined com Define.DeprecationWarnings then
+		check_deprecation com;
+
 	(* PASS 1: general expression filters *)
 	(* PASS 1: general expression filters *)
  	let filters = [
  	let filters = [
 		Codegen.Abstract.handle_abstract_casts tctx;
 		Codegen.Abstract.handle_abstract_casts tctx;
 		blockify_ast;
 		blockify_ast;
-		(match com.platform with
+(* 		(match com.platform with
 			| Cpp | Flash8 -> (fun e ->
 			| Cpp | Flash8 -> (fun e ->
 				let save = save_locals tctx in
 				let save = save_locals tctx in
 				let e = handle_side_effects com (Typecore.gen_local tctx) e in
 				let e = handle_side_effects com (Typecore.gen_local tctx) e in
 				save();
 				save();
 				e)
 				e)
-			| _ -> fun e -> e);
+			| _ -> fun e -> e); *)
 		if com.foptimize then (fun e -> Optimizer.reduce_expression tctx (Optimizer.inline_constructors tctx e)) else Optimizer.sanitize tctx;
 		if com.foptimize then (fun e -> Optimizer.reduce_expression tctx (Optimizer.inline_constructors tctx e)) else Optimizer.sanitize tctx;
 		check_local_vars_init;
 		check_local_vars_init;
 		captured_vars com;
 		captured_vars com;

+ 1 - 1
genas3.ml

@@ -229,7 +229,7 @@ let rec type_str ctx t p =
 	| TEnum _ | TInst _ when List.memq t ctx.local_types ->
 	| TEnum _ | TInst _ when List.memq t ctx.local_types ->
 		"*"
 		"*"
 	| TAbstract ({ a_impl = Some _ } as a,pl) ->
 	| TAbstract ({ a_impl = Some _ } as a,pl) ->
-		type_str ctx (apply_params a.a_types pl a.a_this) p
+		type_str ctx (Codegen.Abstract.get_underlying_type a pl) p
 	| TAbstract (a,_) ->
 	| TAbstract (a,_) ->
 		(match a.a_path with
 		(match a.a_path with
 		| [], "Void" -> "void"
 		| [], "Void" -> "void"

+ 10 - 9
gencommon.ml

@@ -2482,7 +2482,8 @@ struct
 
 
   let priority_as_synf = solve_deps name [DBefore DynamicOperators.priority_as_synf; DBefore DynamicFieldAccess.priority_as_synf]
   let priority_as_synf = solve_deps name [DBefore DynamicOperators.priority_as_synf; DBefore DynamicFieldAccess.priority_as_synf]
 
 
-  let default_implementation gen (should_change:texpr->bool) (get_fun:string) (set_fun:string) =
+  (* should change signature: tarray expr -> binop operation -> should change? *)
+  let default_implementation gen (should_change:texpr->Ast.binop option->bool) (get_fun:string) (set_fun:string) =
     let basic = gen.gcon.basic in
     let basic = gen.gcon.basic in
     let mk_get e e1 e2 =
     let mk_get e e1 e2 =
       let efield = mk_field_access gen e1 get_fun e.epos in
       let efield = mk_field_access gen e1 get_fun e.epos in
@@ -2496,10 +2497,10 @@ struct
       match e.eexpr with
       match e.eexpr with
         | TArray(e1, e2) ->
         | TArray(e1, e2) ->
           (* e1 should always be a var; no need to map there *)
           (* e1 should always be a var; no need to map there *)
-          if should_change e then mk_get e (run e1) (run e2) else Type.map_expr run e
-        | TBinop (Ast.OpAssign, ({ eexpr = TArray(e1a,e2a) } as earray), evalue) when should_change earray ->
+          if should_change e None then mk_get e (run e1) (run e2) else Type.map_expr run e
+        | TBinop (Ast.OpAssign, ({ eexpr = TArray(e1a,e2a) } as earray), evalue) when should_change earray (Some Ast.OpAssign) ->
           mk_set e (run e1a) (run e2a) (run evalue)
           mk_set e (run e1a) (run e2a) (run evalue)
-        | TBinop (Ast.OpAssignOp op,({ eexpr = TArray(e1a,e2a) } as earray) , evalue) when should_change earray ->
+        | TBinop (Ast.OpAssignOp op,({ eexpr = TArray(e1a,e2a) } as earray) , evalue) when should_change earray (Some (Ast.OpAssignOp op)) ->
           (* cache all arguments in vars so they don't get executed twice *)
           (* cache all arguments in vars so they don't get executed twice *)
           (* let ensure_local gen block name e = *)
           (* let ensure_local gen block name e = *)
           let block = ref [] in
           let block = ref [] in
@@ -2510,7 +2511,7 @@ struct
 
 
           { e with eexpr = TBlock (List.rev !block) }
           { e with eexpr = TBlock (List.rev !block) }
         | TUnop(op, flag, ({ eexpr = TArray(e1a, e2a) } as earray)) ->
         | TUnop(op, flag, ({ eexpr = TArray(e1a, e2a) } as earray)) ->
-          if should_change earray && match op with | Not | Neg -> false | _ -> true then begin
+          if should_change earray None && match op with | Not | Neg -> false | _ -> true then begin
 
 
             let block = ref [] in
             let block = ref [] in
 
 
@@ -2599,10 +2600,10 @@ struct
               match follow v.v_type with
               match follow v.v_type with
                 | TDynamic _ ->
                 | TDynamic _ ->
                   assert (is_none catchall);
                   assert (is_none catchall);
-                  (nowrap_catches, must_wrap_catches, Some(v,catch_map v (run catch)))
+                  (nowrap_catches, must_wrap_catches, Some(v,run catch))
                 (* see if we should unwrap it *)
                 (* see if we should unwrap it *)
                 | _ when should_wrap (follow v.v_type) ->
                 | _ when should_wrap (follow v.v_type) ->
-                  (nowrap_catches, (v,catch_map v (run catch)) :: must_wrap_catches, catchall)
+                  (nowrap_catches, (v,run catch) :: must_wrap_catches, catchall)
                 | _ ->
                 | _ ->
                   ( (v,catch_map v (run catch)) :: nowrap_catches, must_wrap_catches, catchall )
                   ( (v,catch_map v (run catch)) :: nowrap_catches, must_wrap_catches, catchall )
             ) ([], [], None) catches
             ) ([], [], None) catches
@@ -2648,7 +2649,7 @@ struct
                       | None ->
                       | None ->
                         mk_block (rethrow_expr temp_local)
                         mk_block (rethrow_expr temp_local)
                 in
                 in
-                [ ( temp_var, { e with eexpr = TBlock([ catchall_decl; if_is_wrapper_expr; loop must_wrap_catches ]) } ) ]
+                [ ( temp_var, catch_map temp_var { e with eexpr = TBlock([ catchall_decl; if_is_wrapper_expr; loop must_wrap_catches ]) } ) ]
               | _ ->
               | _ ->
                 []
                 []
             in
             in
@@ -9386,7 +9387,7 @@ struct
                 | Some t1, Some t2 ->
                 | Some t1, Some t2 ->
                   (match op with
                   (match op with
                     | Ast.OpAssign ->
                     | Ast.OpAssign ->
-                      { e with eexpr = TBinop( op, run e1, handle_wrap ( handle_unwrap t2 (run e2) ) t1 ) }
+                      Type.map_expr run e
                     | Ast.OpAssignOp op ->
                     | Ast.OpAssignOp op ->
                       (match e1.eexpr with
                       (match e1.eexpr with
                         | TLocal _ ->
                         | TLocal _ ->

+ 72 - 18
gencpp.ml

@@ -53,7 +53,7 @@ let join_class_path path separator =
 let is_internal_class = function
 let is_internal_class = function
 	|  ([],"Int") | ([],"Void") |  ([],"String") | ([], "Null") | ([], "Float")
 	|  ([],"Int") | ([],"Void") |  ([],"String") | ([], "Null") | ([], "Float")
 	|  ([],"Array") | ([], "Class") | ([], "Enum") | ([], "Bool")
 	|  ([],"Array") | ([], "Class") | ([], "Enum") | ([], "Bool")
-   |  ([], "Dynamic") | ([], "ArrayAccess") | (["cpp"], "FastIterator")-> true
+   |  ([], "Dynamic") | ([], "ArrayAccess") | (["cpp"], "FastIterator") | (["cpp"],"Pointer") -> true
 	|  ([],"Math") | (["haxe";"io"], "Unsigned_char__") -> true
 	|  ([],"Math") | (["haxe";"io"], "Unsigned_char__") -> true
 	| _ -> false;;
 	| _ -> false;;
 
 
@@ -315,6 +315,12 @@ let has_meta_key meta key =
 ;;
 ;;
 
 
 
 
+let get_field_access_meta field_access key =
+match field_access with
+	| FInstance(_,class_field) 
+	| FStatic(_,class_field) -> get_meta_string class_field.cf_meta key
+	| _ -> ""
+;;
 
 
 let get_code meta key =
 let get_code meta key =
 	let code = get_meta_string meta key in
 	let code = get_meta_string meta key in
@@ -417,6 +423,8 @@ let rec class_string klass suffix params =
 	(* FastIterator class *)
 	(* FastIterator class *)
 	|  (["cpp"],"FastIterator") -> "::cpp::FastIterator" ^ suffix ^ "< " ^ (String.concat ","
 	|  (["cpp"],"FastIterator") -> "::cpp::FastIterator" ^ suffix ^ "< " ^ (String.concat ","
 					 (List.map type_string  params) ) ^ " >"
 					 (List.map type_string  params) ) ^ " >"
+	|  (["cpp"],"Pointer") -> "::cpp::Pointer" ^ suffix ^ "< " ^ (String.concat ","
+					 (List.map type_string  params) ) ^ " >"
 	| _ when (match klass.cl_kind with KTypeParameter _ -> true | _ -> false) -> "Dynamic"
 	| _ when (match klass.cl_kind with KTypeParameter _ -> true | _ -> false) -> "Dynamic"
 	|  ([],"#Int") -> "/* # */int"
 	|  ([],"#Int") -> "/* # */int"
 	|  (["haxe";"io"],"Unsigned_char__") -> "unsigned char"
 	|  (["haxe";"io"],"Unsigned_char__") -> "unsigned char"
@@ -475,6 +483,10 @@ and type_string_suff suffix haxe_type =
 			(match params with
 			(match params with
 			| [t] -> "::cpp::FastIterator< " ^ (type_string (follow t) ) ^ " >"
 			| [t] -> "::cpp::FastIterator< " ^ (type_string (follow t) ) ^ " >"
 			| _ -> assert false)
 			| _ -> assert false)
+		| ["cpp"] , "Pointer" ->
+			(match params with
+			| [t] -> "::cpp::Pointer< " ^ (type_string (follow t) ) ^ " >"
+			| _ -> assert false)
 		| _ ->  type_string_suff suffix (apply_params type_def.t_types params type_def.t_type)
 		| _ ->  type_string_suff suffix (apply_params type_def.t_types params type_def.t_type)
 		)
 		)
 	| TFun (args,haxe_type) -> "Dynamic" ^ suffix
 	| TFun (args,haxe_type) -> "Dynamic" ^ suffix
@@ -531,6 +543,20 @@ let is_array haxe_type =
 	| _ -> false
 	| _ -> false
 	;;
 	;;
 
 
+
+let is_pointer haxe_type =
+	match follow haxe_type with
+	| TInst (klass,params) ->
+		(match klass.cl_path with
+		| ["cpp"] , "Pointer" -> true
+		| _ -> false )
+	| TType (type_def,params) ->
+		(match type_def.t_path with
+		| ["cpp"] , "Pointer" -> true
+		| _ -> false )
+	| _ -> false
+	;;
+
 let is_array_implementer haxe_type =
 let is_array_implementer haxe_type =
 	match follow haxe_type with
 	match follow haxe_type with
 	| TInst (klass,params) ->
 	| TInst (klass,params) ->
@@ -581,6 +607,12 @@ let is_internal_member member =
    | _ -> false;;
    | _ -> false;;
 
 
 
 
+let is_extern_class class_def =
+   class_def.cl_extern || (has_meta_key class_def.cl_meta Meta.Extern)
+;;
+
+
+
 let rec is_dynamic_accessor name acc field class_def =
 let rec is_dynamic_accessor name acc field class_def =
  ( ( acc ^ "_" ^ field.cf_name) = name ) &&
  ( ( acc ^ "_" ^ field.cf_name) = name ) &&
   ( not (List.exists (fun f -> f.cf_name=name) class_def.cl_ordered_fields) )
   ( not (List.exists (fun f -> f.cf_name=name) class_def.cl_ordered_fields) )
@@ -697,10 +729,24 @@ let escape_command s =
    String.iter (fun ch -> if (ch=='"' || ch=='\\' ) then Buffer.add_string b "\\";  Buffer.add_char b ch ) s;
    String.iter (fun ch -> if (ch=='"' || ch=='\\' ) then Buffer.add_string b "\\";  Buffer.add_char b ch ) s;
    Buffer.contents b;;
    Buffer.contents b;;
 
 
-
 let str s =
 let str s =
+	let rec split s plus =
+		let escaped = Ast.s_escape ~hex:false s in
+		let hexed = (special_to_hex escaped) in
+		if (String.length hexed <= 16000 ) then
+			plus ^ " HX_CSTRING(\"" ^ hexed ^ "\")"
+		else begin
+			let len = String.length s in
+			let half = len lsr 1 in
+			(split (String.sub s 0 half) plus ) ^ (split (String.sub s half (len-half)) "+" )
+		end
+	in
 	let escaped = Ast.s_escape ~hex:false s in
 	let escaped = Ast.s_escape ~hex:false s in
-		("HX_CSTRING(\"" ^ (special_to_hex escaped) ^ "\")")
+	let hexed = (special_to_hex escaped) in
+	if (String.length hexed <= 16000 ) then
+		"HX_CSTRING(\"" ^ hexed ^ "\")"
+	else
+		"(" ^ (split s "" ) ^ ")"
 ;;
 ;;
 
 
 let const_char_star s =
 let const_char_star s =
@@ -962,12 +1008,12 @@ let rec is_dynamic_in_cpp ctx expr =
 		| TField( obj, field ) ->
 		| TField( obj, field ) ->
 			let name = field_name field in
 			let name = field_name field in
 			ctx.ctx_dbgout ("/* ?tfield "^name^" */");
 			ctx.ctx_dbgout ("/* ?tfield "^name^" */");
-				if (is_dynamic_member_lookup_in_cpp ctx obj name) then
+				if (is_dynamic_member_lookup_in_cpp ctx obj field) then
             (
             (
                ctx.ctx_dbgout "/* tf=dynobj */";
                ctx.ctx_dbgout "/* tf=dynobj */";
                true
                true
             )
             )
-            else if (is_dynamic_member_return_in_cpp ctx obj name)  then
+            else if (is_dynamic_member_return_in_cpp ctx obj field)  then
             (
             (
                ctx.ctx_dbgout "/* tf=dynret */";
                ctx.ctx_dbgout "/* tf=dynret */";
                true
                true
@@ -999,9 +1045,11 @@ let rec is_dynamic_in_cpp ctx expr =
 		result
 		result
 	end
 	end
 
 
-and is_dynamic_member_lookup_in_cpp ctx field_object member =
+and is_dynamic_member_lookup_in_cpp ctx field_object field =
+   let member = field_name field in
    ctx.ctx_dbgout ("/*mem."^member^".*/");
    ctx.ctx_dbgout ("/*mem."^member^".*/");
 	if (is_internal_member member) then false else
 	if (is_internal_member member) then false else
+	if (is_pointer field_object.etype) then false else
 	if (match field_object.eexpr with | TTypeExpr _ -> ctx.ctx_dbgout "/*!TTypeExpr*/"; true | _ -> false) then false else
 	if (match field_object.eexpr with | TTypeExpr _ -> ctx.ctx_dbgout "/*!TTypeExpr*/"; true | _ -> false) then false else
 	if (is_dynamic_in_cpp ctx field_object) then true else
 	if (is_dynamic_in_cpp ctx field_object) then true else
 	if (is_array field_object.etype) then false else (
 	if (is_array field_object.etype) then false else (
@@ -1019,7 +1067,8 @@ and is_dynamic_member_lookup_in_cpp ctx field_object member =
 					false )
 					false )
 				with Not_found -> true
 				with Not_found -> true
    )
    )
-and is_dynamic_member_return_in_cpp ctx field_object member =
+and is_dynamic_member_return_in_cpp ctx field_object field =
+   let member = field_name field in
 	if (is_array field_object.etype) then false else
 	if (is_array field_object.etype) then false else
 	if (is_internal_member member) then false else
 	if (is_internal_member member) then false else
    match field_object.eexpr with
    match field_object.eexpr with
@@ -1538,11 +1587,15 @@ and gen_expression ctx retval expression =
 		(match field_object.eexpr with
 		(match field_object.eexpr with
 		(* static access ... *)
 		(* static access ... *)
 		| TTypeExpr type_def ->
 		| TTypeExpr type_def ->
-			let class_name = "::" ^ (join_class_path_remap (t_path type_def) "::" ) in
-			if (class_name="::String") then
-				output ("::String::" ^ remap_name)
-			else
-				output (class_name ^ "_obj::" ^ remap_name);
+			(match get_field_access_meta field Meta.Native with
+         | "" ->
+				let class_name = "::" ^ (join_class_path_remap (t_path type_def) "::" ) in
+				if (class_name="::String") then
+					output ("::String::" ^ remap_name)
+				else
+					output (class_name ^ "_obj::" ^ remap_name);
+         | native -> output native
+         )
 		(* Special internal access *)
 		(* Special internal access *)
 		| TLocal { v_name = "__global__" } ->
 		| TLocal { v_name = "__global__" } ->
 			output ("::" ^ member )
 			output ("::" ^ member )
@@ -1558,7 +1611,7 @@ and gen_expression ctx retval expression =
          let isString = (type_string field_object.etype)="::String" in
          let isString = (type_string field_object.etype)="::String" in
          if (is_internal_member member && not settingInternal) then begin
          if (is_internal_member member && not settingInternal) then begin
 				output ( (if isString then "." else "->") ^ member );
 				output ( (if isString then "." else "->") ^ member );
-         end else if (settingInternal || is_dynamic_member_lookup_in_cpp ctx field_object member) then begin
+         end else if (settingInternal || is_dynamic_member_lookup_in_cpp ctx field_object field) then begin
             if assigning then
             if assigning then
 				    output ( "->__FieldRef(" ^ (str member) ^ ")" )
 				    output ( "->__FieldRef(" ^ (str member) ^ ")" )
             else
             else
@@ -2324,6 +2377,7 @@ let path_of_string verbatim path =
    | head :: rest -> (List.rev rest, head)
    | head :: rest -> (List.rev rest, head)
 ;;
 ;;
 
 
+
 (*
 (*
   Get a list of all classes referred to by the class/enum definition
   Get a list of all classes referred to by the class/enum definition
   These are used for "#include"ing the appropriate header files,
   These are used for "#include"ing the appropriate header files,
@@ -2356,8 +2410,8 @@ let find_referenced_types ctx obj super_deps constructor_deps header_only for_de
 			for the Array or Class class, for which we do a fully typed object *)
 			for the Array or Class class, for which we do a fully typed object *)
 		| TInst (klass,params) ->
 		| TInst (klass,params) ->
 			(match klass.cl_path with
 			(match klass.cl_path with
-         | ([],"Array") | ([],"Class") | (["cpp"],"FastIterator") -> List.iter visit_type params
-         | _ when klass.cl_extern -> add_extern_class klass
+         | ([],"Array") | ([],"Class") | (["cpp"],"FastIterator") | (["cpp"],"Pointer")-> List.iter visit_type params
+         | _ when is_extern_class klass -> add_extern_class klass
 			| _ -> (match klass.cl_kind with KTypeParameter _ -> () | _ -> add_type klass.cl_path);
 			| _ -> (match klass.cl_kind with KTypeParameter _ -> () | _ -> add_type klass.cl_path);
 			)
 			)
 		| TFun (args,haxe_type) -> visit_type haxe_type;
 		| TFun (args,haxe_type) -> visit_type haxe_type;
@@ -2372,7 +2426,7 @@ let find_referenced_types ctx obj super_deps constructor_deps header_only for_de
 			(* Expand out TTypeExpr (ie, the name of a class, as used for static access etc ... *)
 			(* Expand out TTypeExpr (ie, the name of a class, as used for static access etc ... *)
 			(match expression.eexpr with
 			(match expression.eexpr with
 				| TTypeExpr type_def -> ( match type_def with
 				| TTypeExpr type_def -> ( match type_def with
-               | TClassDecl class_def when class_def.cl_extern -> add_extern_class class_def
+               | TClassDecl class_def when is_extern_class class_def -> add_extern_class class_def
 	            | _ -> add_type (t_path type_def)
 	            | _ -> add_type (t_path type_def)
                )
                )
 
 
@@ -2568,7 +2622,7 @@ let generate_files common_ctx file_info =
 	output_files "#ifdef HXCPP_DEBUGGER\n";
 	output_files "#ifdef HXCPP_DEBUGGER\n";
 	List.iter ( fun object_def ->
 	List.iter ( fun object_def ->
 	(match object_def with
 	(match object_def with
-		| TClassDecl class_def when class_def.cl_extern -> ( )
+		| TClassDecl class_def when is_extern_class class_def -> ( )
 		| TClassDecl class_def when class_def.cl_interface -> ( )
 		| TClassDecl class_def when class_def.cl_interface -> ( )
 		| TClassDecl class_def ->
 		| TClassDecl class_def ->
 			output_files ((const_char_star (join_class_path class_def.cl_path "." )) ^ ",\n")
 			output_files ((const_char_star (join_class_path class_def.cl_path "." )) ^ ",\n")
@@ -4479,7 +4533,7 @@ let generate_source common_ctx =
 
 
 	List.iter (fun object_def ->
 	List.iter (fun object_def ->
 		(match object_def with
 		(match object_def with
-		| TClassDecl class_def when class_def.cl_extern ->
+		| TClassDecl class_def when is_extern_class class_def ->
          (*if (gen_externs) then gen_extern_class common_ctx class_def file_info;*)();
          (*if (gen_externs) then gen_extern_class common_ctx class_def file_info;*)();
 		| TClassDecl class_def ->
 		| TClassDecl class_def ->
 			let name =  class_text class_def.cl_path in
 			let name =  class_text class_def.cl_path in

+ 88 - 28
gencs.ml

@@ -2403,13 +2403,16 @@ let configure gen =
 
 
   InitFunction.configure gen true;
   InitFunction.configure gen true;
   TArrayTransform.configure gen (TArrayTransform.default_implementation gen (
   TArrayTransform.configure gen (TArrayTransform.default_implementation gen (
-  fun e ->
+  fun e binop ->
     match e.eexpr with
     match e.eexpr with
       | TArray(e1, e2) ->
       | TArray(e1, e2) ->
         ( match follow e1.etype with
         ( match follow e1.etype with
           | TDynamic _ | TAnon _ | TMono _ -> true
           | TDynamic _ | TAnon _ | TMono _ -> true
           | TInst({ cl_kind = KTypeParameter _ }, _) -> true
           | TInst({ cl_kind = KTypeParameter _ }, _) -> true
-          | _ -> false )
+          | _ -> match binop, change_param_type (t_to_md e1.etype) [e.etype] with
+            | Some(Ast.OpAssignOp _), ([TDynamic _] | [TAnon _]) ->
+              true
+            | _ -> false)
       | _ -> assert false
       | _ -> assert false
   ) "__get" "__set" );
   ) "__get" "__set" );
 
 
@@ -2580,7 +2583,14 @@ let configure gen =
       )
       )
       (base_exception_t)
       (base_exception_t)
       (hx_exception_t)
       (hx_exception_t)
-      (fun v e -> e)
+      (fun v e ->
+
+        let exc_cl = get_cl (get_type gen (["haxe";"lang"],"Exceptions")) in
+        let exc_field = mk_static_field_access_infer exc_cl "exception" e.epos [] in
+        let esetstack = mk (TBinop(Ast.OpAssign, exc_field, mk_local v e.epos)) v.v_type e.epos in
+
+        Codegen.concat esetstack e;
+      )
   );
   );
 
 
   let get_typeof e =
   let get_typeof e =
@@ -2642,15 +2652,10 @@ let configure gen =
   mkdir gen.gcon.file;
   mkdir gen.gcon.file;
   mkdir (gen.gcon.file ^ "/src");
   mkdir (gen.gcon.file ^ "/src");
 
 
-  (* add resources array *)
-  (try
-    let res = get_cl (Hashtbl.find gen.gtypes (["haxe"], "Resource")) in
+  (* copy resource files *)
+  if Hashtbl.length gen.gcon.resources > 0 then begin
     mkdir (gen.gcon.file ^ "/src/Resources");
     mkdir (gen.gcon.file ^ "/src/Resources");
-    let cf = PMap.find "content" res.cl_statics in
-    let res = ref [] in
     Hashtbl.iter (fun name v ->
     Hashtbl.iter (fun name v ->
-      res := { eexpr = TConst(TString name); etype = gen.gcon.basic.tstring; epos = Ast.null_pos } :: !res;
-
       let full_path = gen.gcon.file ^ "/src/Resources/" ^ name in
       let full_path = gen.gcon.file ^ "/src/Resources/" ^ name in
       let parts = Str.split_delim (Str.regexp "[\\/]+") full_path in
       let parts = Str.split_delim (Str.regexp "[\\/]+") full_path in
       let dir_list = List.rev (List.tl (List.rev parts)) in
       let dir_list = List.rev (List.tl (List.rev parts)) in
@@ -2661,6 +2666,15 @@ let configure gen =
       output_string f v;
       output_string f v;
       close_out f
       close_out f
     ) gen.gcon.resources;
     ) gen.gcon.resources;
+  end;
+  (* add resources array *)
+  (try
+    let res = get_cl (Hashtbl.find gen.gtypes (["haxe"], "Resource")) in
+    let cf = PMap.find "content" res.cl_statics in
+    let res = ref [] in
+    Hashtbl.iter (fun name v ->
+      res := { eexpr = TConst(TString name); etype = gen.gcon.basic.tstring; epos = Ast.null_pos } :: !res;
+    ) gen.gcon.resources;
     cf.cf_expr <- Some ({ eexpr = TArrayDecl(!res); etype = gen.gcon.basic.tarray gen.gcon.basic.tstring; epos = Ast.null_pos })
     cf.cf_expr <- Some ({ eexpr = TArrayDecl(!res); etype = gen.gcon.basic.tarray gen.gcon.basic.tstring; epos = Ast.null_pos })
   with | Not_found -> ());
   with | Not_found -> ());
 
 
@@ -2783,6 +2797,7 @@ let netpath_to_hx std = function
 		let ns = (List.map String.lowercase ns) in
 		let ns = (List.map String.lowercase ns) in
 		add_cs ns, netcl_to_hx cl
 		add_cs ns, netcl_to_hx cl
 	| ns,(nhd :: ntl as nested), cl ->
 	| ns,(nhd :: ntl as nested), cl ->
+		let nested = List.map (netcl_to_hx) nested in
 		let ns = (List.map String.lowercase ns) @ [nhd] in
 		let ns = (List.map String.lowercase ns) @ [nhd] in
 		add_cs ns, String.concat "_" nested ^ "_" ^ netcl_to_hx cl
 		add_cs ns, String.concat "_" nested ^ "_" ^ netcl_to_hx cl
 
 
@@ -2802,6 +2817,8 @@ let mk_type_path ctx path params =
 		| ns,[], cl ->
 		| ns,[], cl ->
 			ns, None, netcl_to_hx cl
 			ns, None, netcl_to_hx cl
 		| ns, (nhd :: ntl as nested), cl ->
 		| ns, (nhd :: ntl as nested), cl ->
+			let nhd = netcl_to_hx nhd in
+			let nested = List.map (netcl_to_hx) nested in
 			ns, Some (String.concat "_" nested ^ "_" ^ netcl_to_hx cl), nhd
 			ns, Some (String.concat "_" nested ^ "_" ^ netcl_to_hx cl), nhd
 	in
 	in
   CTPath {
   CTPath {
@@ -2979,7 +2996,7 @@ let convert_ilevent ctx p ev =
     cff_kind = kind;
     cff_kind = kind;
   }
   }
 
 
-let convert_ilmethod ctx p m =
+let convert_ilmethod ctx p m is_explicit_impl =
 	if not (Common.defined ctx.ncom Define.Unsafe) && has_unmanaged m.msig.snorm then raise Exit;
 	if not (Common.defined ctx.ncom Define.Unsafe) && has_unmanaged m.msig.snorm then raise Exit;
 	let p = { p with pfile =  p.pfile ^" (" ^m.mname ^")" } in
 	let p = { p with pfile =  p.pfile ^" (" ^m.mname ^")" } in
 	let cff_doc = None in
 	let cff_doc = None in
@@ -2998,7 +3015,8 @@ let convert_ilmethod ctx p m =
 		| FAFamily | FAFamOrAssem -> APrivate
 		| FAFamily | FAFamOrAssem -> APrivate
 		(* | FAPrivate -> APrivate *)
 		(* | FAPrivate -> APrivate *)
 		| FAPublic -> APublic
 		| FAPublic -> APublic
-		| _ -> raise Exit
+		| _ ->
+			raise Exit
 	in
 	in
 	if PMap.mem "net_loader_debug" ctx.ncom.defines then
 	if PMap.mem "net_loader_debug" ctx.ncom.defines then
 		Printf.printf "\tname %s : %s\n" cff_name (IlMetaDebug.ilsig_s m.msig.ssig);
 		Printf.printf "\tname %s : %s\n" cff_name (IlMetaDebug.ilsig_s m.msig.ssig);
@@ -3016,6 +3034,11 @@ let convert_ilmethod ctx p m =
 			(Meta.Final, [], p) :: meta
 			(Meta.Final, [], p) :: meta
 		| _ -> meta
 		| _ -> meta
 	in
 	in
+	let meta = if is_explicit_impl then
+			(Meta.NoCompletion,[],p) :: (Meta.SkipReflection,[],p) :: meta
+		else
+			meta
+	in
 	(* let meta = if List.mem OSynchronized m.mflags.mf_interop then *)
 	(* let meta = if List.mem OSynchronized m.mflags.mf_interop then *)
 	(* 	(Meta.Synchronized,[],p) :: meta *)
 	(* 	(Meta.Synchronized,[],p) :: meta *)
 	(* else *)
 	(* else *)
@@ -3097,7 +3120,7 @@ let convert_ilmethod ctx p m =
 		cff_kind = kind;
 		cff_kind = kind;
 	}
 	}
 
 
-let convert_ilprop ctx p prop =
+let convert_ilprop ctx p prop is_explicit_impl =
 	if not (Common.defined ctx.ncom Define.Unsafe) && has_unmanaged prop.psig.snorm then raise Exit;
 	if not (Common.defined ctx.ncom Define.Unsafe) && has_unmanaged prop.psig.snorm then raise Exit;
 	let p = { p with pfile =  p.pfile ^" (" ^prop.pname ^")" } in
 	let p = { p with pfile =  p.pfile ^" (" ^prop.pname ^")" } in
   let pmflags = match prop.pget, prop.pset with
   let pmflags = match prop.pget, prop.pset with
@@ -3134,6 +3157,12 @@ let convert_ilprop ctx p prop =
 		| s -> raise Exit
 		| s -> raise Exit
 	in
 	in
 
 
+	let meta = if is_explicit_impl then
+			[ Meta.NoCompletion,[],p; Meta.SkipReflection,[],p ]
+		else
+			[]
+	in
+
 	let kind =
 	let kind =
 		FProp (get, set, Some(convert_signature ctx p ilsig), None)
 		FProp (get, set, Some(convert_signature ctx p ilsig), None)
 	in
 	in
@@ -3141,7 +3170,7 @@ let convert_ilprop ctx p prop =
 		cff_name = prop.pname;
 		cff_name = prop.pname;
 		cff_doc = None;
 		cff_doc = None;
 		cff_pos = p;
 		cff_pos = p;
-		cff_meta = [];
+		cff_meta = meta;
 		cff_access = cff_access;
 		cff_access = cff_access;
 		cff_kind = kind;
 		cff_kind = kind;
 	}
 	}
@@ -3180,15 +3209,27 @@ let mk_abstract_fun name p kind metas acc =
     cff_kind = kind;
     cff_kind = kind;
   }
   }
 
 
+let convert_fun_arg ctx p = function
+	| LManagedPointer s ->
+		mk_type_path ctx (["cs"],[],"Ref") [ TPType (convert_signature ctx p s) ]
+	| s ->
+		convert_signature ctx p s
+
+let convert_fun ctx p ret args =
+	let args = List.map (convert_fun_arg ctx p) args in
+	CTFunction(args, convert_signature ctx p ret)
+
 let convert_delegate ctx p ilcls =
 let convert_delegate ctx p ilcls =
-	let p = { p with pfile =  p.pfile ^" abstract delegate" } in
+	let p = { p with pfile =  p.pfile ^" (abstract delegate)" } in
   (* will have the following methods: *)
   (* will have the following methods: *)
   (* - new (haxeType:Func) *)
   (* - new (haxeType:Func) *)
   (* - FromHaxeFunction(haxeType) *)
   (* - FromHaxeFunction(haxeType) *)
   (* - Invoke() *)
   (* - Invoke() *)
   (* - AsDelegate():Super *)
   (* - AsDelegate():Super *)
   let invoke = List.find (fun m -> m.mname = "Invoke") ilcls.cmethods in
   let invoke = List.find (fun m -> m.mname = "Invoke") ilcls.cmethods in
-  let haxe_type = convert_signature ctx p invoke.msig.snorm in
+	let ret = invoke.mret.snorm in
+	let args = List.map (fun (_,_,s) -> s.snorm) invoke.margs in
+	let haxe_type = convert_fun ctx p ret args in
   let types = List.map (fun t ->
   let types = List.map (fun t ->
     {
     {
       tp_name = "T" ^ string_of_int t.tnumber;
       tp_name = "T" ^ string_of_int t.tnumber;
@@ -3203,10 +3244,6 @@ let convert_delegate ctx p ilcls =
     | ns,inner,name ->
     | ns,inner,name ->
       mk_type_path ctx (ns,inner,"Delegate_" ^ name) params
       mk_type_path ctx (ns,inner,"Delegate_" ^ name) params
   in
   in
-  let ret,args = match invoke.msig.snorm with
-    | LMethod (_,ret,args) -> ret,args
-    | _ -> assert false
-  in
 
 
   let fn_new = FFun {
   let fn_new = FFun {
     f_params = [];
     f_params = [];
@@ -3226,7 +3263,7 @@ let convert_delegate ctx p ilcls =
     f_params = [];
     f_params = [];
     f_args = List.map (fun arg ->
     f_args = List.map (fun arg ->
       incr i;
       incr i;
-      "arg" ^ string_of_int !i, false, Some (convert_signature ctx p arg), None
+      "arg" ^ string_of_int !i, false, Some (convert_fun_arg ctx p arg), None
     ) args;
     ) args;
     f_type = Some(convert_signature ctx p ret);
     f_type = Some(convert_signature ctx p ret);
     f_expr = Some(
     f_expr = Some(
@@ -3326,9 +3363,13 @@ let convert_ilclass ctx p ?(delegate=false) ilcls = match ilcls.csuper with
 				else
 				else
 					ilcls.cmethods
 					ilcls.cmethods
 			in
 			in
-			run_fields (convert_ilmethod ctx p) meths;
+			run_fields (fun m ->
+				convert_ilmethod ctx p m (List.exists (fun m2 -> m != m2 && String.get m2.mname 0 <> '.' && String.ends_with m2.mname ("." ^ m.mname)) meths)
+			) meths;
 			run_fields (convert_ilfield ctx p) ilcls.cfields;
 			run_fields (convert_ilfield ctx p) ilcls.cfields;
-			run_fields (convert_ilprop ctx p) ilcls.cprops;
+			run_fields (fun prop ->
+				convert_ilprop ctx p prop (List.exists (fun p2 -> prop != p2 && String.get p2.pname 0 <> '.' && String.ends_with p2.pname ("." ^ prop.pname)) ilcls.cprops)
+			) ilcls.cprops;
 			run_fields (convert_ilevent ctx p) ilcls.cevents;
 			run_fields (convert_ilevent ctx p) ilcls.cevents;
 
 
 			let params = List.map (fun p ->
 			let params = List.map (fun p ->
@@ -3416,7 +3457,11 @@ let ilcls_with_params ctx cls params =
 	| _ ->
 	| _ ->
 		{ cls with
 		{ cls with
 			cfields = List.map (fun f -> { f with fsig = { f.fsig with snorm = ilapply_params params f.fsig.snorm } }) cls.cfields;
 			cfields = List.map (fun f -> { f with fsig = { f.fsig with snorm = ilapply_params params f.fsig.snorm } }) cls.cfields;
-			cmethods = List.map (fun m -> { m with msig = { m.msig with snorm = ilapply_params params m.msig.snorm } }) cls.cmethods;
+			cmethods = List.map (fun m -> { m with
+				msig = { m.msig with snorm = ilapply_params params m.msig.snorm };
+				margs = List.map (fun (n,f,s) -> (n,f,{ s with snorm = ilapply_params params s.snorm })) m.margs;
+				mret = { m.mret with snorm = ilapply_params params m.mret.snorm };
+			}) cls.cmethods;
 			cprops = List.map (fun p -> { p with psig = { p.psig with snorm = ilapply_params params p.psig.snorm } }) cls.cprops;
 			cprops = List.map (fun p -> { p with psig = { p.psig with snorm = ilapply_params params p.psig.snorm } }) cls.cprops;
 			csuper = Option.map (fun s -> { s with snorm = ilapply_params params s.snorm } ) cls.csuper;
 			csuper = Option.map (fun s -> { s with snorm = ilapply_params params s.snorm } ) cls.csuper;
 			cimplements = List.map (fun s -> { s with snorm = ilapply_params params s.snorm } ) cls.cimplements;
 			cimplements = List.map (fun s -> { s with snorm = ilapply_params params s.snorm } ) cls.cimplements;
@@ -3520,13 +3565,26 @@ let normalize_ilcls ctx cls =
 					) !current_all) then begin
 					) !current_all) then begin
 						current_all := ff :: !current_all;
 						current_all := ff :: !current_all;
 						added := ff :: !added
 						added := ff :: !added
-					end
+					end else
+						(* ensure it's public *)
+						List.iter (fun mref -> match !mref with
+							| m when m.mname = name && compatible_field f (IlMethod m) ->
+								mref := { m with mflags = { m.mflags with mf_access = FAPublic } }
+							| _ -> ()
+						) meths
 				| _ -> ()
 				| _ -> ()
 			) (get_all_fields cif);
 			) (get_all_fields cif);
 			List.iter (loop_interface cif) cif.cimplements
 			List.iter (loop_interface cif) cif.cimplements
 		with | Not_found -> ()
 		with | Not_found -> ()
 	in
 	in
 	List.iter (loop_interface cls) cls.cimplements;
 	List.iter (loop_interface cls) cls.cimplements;
+	let added = List.map (function
+		| (IlMethod m,a,name,b) ->
+			(IlMethod { m with mflags = { m.mflags with mf_access = FAPublic } },a,name,b)
+		| (IlField f,a,name,b) ->
+			(IlField { f with fflags = { f.fflags with ff_access = FAPublic } },a,name,b)
+		| s -> s
+	) !added in
 
 
 	(* filter out properties that were already declared *)
 	(* filter out properties that were already declared *)
 	let props = List.filter (function
 	let props = List.filter (function
@@ -3538,7 +3596,7 @@ let normalize_ilcls ctx cls =
 	) cls.cprops in
 	) cls.cprops in
 	let cls = { cls with cmethods = List.map (fun v -> !v) meths; cprops = props } in
 	let cls = { cls with cmethods = List.map (fun v -> !v) meths; cprops = props } in
 
 
-	let clsfields = !added @ get_all_fields cls in
+	let clsfields = added @ (get_all_fields cls) in
 	let super_fields = !all_fields in
 	let super_fields = !all_fields in
 	all_fields := clsfields @ !all_fields;
 	all_fields := clsfields @ !all_fields;
 	let refclsfields = (List.map (fun v -> ref v) clsfields) in
 	let refclsfields = (List.map (fun v -> ref v) clsfields) in
@@ -3566,10 +3624,11 @@ let normalize_ilcls ctx cls =
 	let fields = List.filter (function | (IlField _,_,_,_) -> true | _ -> false) clsfields in
 	let fields = List.filter (function | (IlField _,_,_,_) -> true | _ -> false) clsfields in
 	let methods = List.filter (function | (IlMethod _,_,_,_) -> true | _ -> false) clsfields in
 	let methods = List.filter (function | (IlMethod _,_,_,_) -> true | _ -> false) clsfields in
 	let props = List.filter (function | (IlProp _,_,_,_) -> true | _ -> false) clsfields in
 	let props = List.filter (function | (IlProp _,_,_,_) -> true | _ -> false) clsfields in
+	let methods = List.map (function | (IlMethod f,_,_,_) -> f | _ -> assert false) methods in
 	{ cls with
 	{ cls with
 		cfields = List.map (function | (IlField f,_,_,_) -> f | _ -> assert false) fields;
 		cfields = List.map (function | (IlField f,_,_,_) -> f | _ -> assert false) fields;
-		cmethods = List.map (function | (IlMethod f,_,_,_) -> f | _ -> assert false) methods;
 		cprops = List.map (function | (IlProp f,_,_,_) -> f | _ -> assert false) props;
 		cprops = List.map (function | (IlProp f,_,_,_) -> f | _ -> assert false) props;
+		cmethods = methods;
 	}
 	}
 
 
 let add_net_std com file =
 let add_net_std com file =
@@ -3595,7 +3654,8 @@ let add_net_lib com file std =
 			let r = PeReader.create_r (open_in_bin file) com.defines in
 			let r = PeReader.create_r (open_in_bin file) com.defines in
 			let ctx = PeReader.read r in
 			let ctx = PeReader.read r in
 			let clr_header = PeReader.read_clr_header ctx in
 			let clr_header = PeReader.read_clr_header ctx in
-			let meta = IlMetaReader.read_meta_tables ctx clr_header in
+			let cache = IlMetaReader.create_cache () in
+			let meta = IlMetaReader.read_meta_tables ctx clr_header cache in
 			close_in (r.PeReader.ch);
 			close_in (r.PeReader.ch);
 			if PMap.mem "net_loader_debug" com.defines then
 			if PMap.mem "net_loader_debug" com.defines then
 				print_endline ("for lib " ^ file);
 				print_endline ("for lib " ^ file);

+ 1 - 1
genjava.ml

@@ -1900,7 +1900,7 @@ let configure gen =
 
 
   InitFunction.configure gen true;
   InitFunction.configure gen true;
   TArrayTransform.configure gen (TArrayTransform.default_implementation gen (
   TArrayTransform.configure gen (TArrayTransform.default_implementation gen (
-  fun e ->
+  fun e _ ->
     match e.eexpr with
     match e.eexpr with
       | TArray ({ eexpr = TLocal { v_extra = Some( _ :: _, _) } }, _) -> (* captured transformation *)
       | TArray ({ eexpr = TLocal { v_extra = Some( _ :: _, _) } }, _) -> (* captured transformation *)
         false
         false

+ 6 - 8
genjs.ml

@@ -89,14 +89,12 @@ let s_path ctx = if ctx.js_flatten then flat_path else dot_path
 let kwds =
 let kwds =
 	let h = Hashtbl.create 0 in
 	let h = Hashtbl.create 0 in
 	List.iter (fun s -> Hashtbl.add h s ()) [
 	List.iter (fun s -> Hashtbl.add h s ()) [
-		(* JS reserved words: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Reserved_Words *)
-		"break"; "case"; "catch"; "class"; "const"; "continue"; "debugger"; "default"; "delete";
-		"do"; "else"; "enum"; "export"; "extends"; "finally"; "for"; "function"; "if"; "implements";
-		"import"; "in"; "instanceof"; "interface"; "let"; "new"; "package"; "private"; "protected";
-		"public"; "return"; "static"; "super"; "switch"; "this"; "throw"; "try"; "typeof"; "var";
-		"void"; "while"; "with"; "yield";
-		(* reserved by closure compiler *)
-		"final"
+		"abstract"; "as"; "boolean"; "break"; "byte"; "case"; "catch"; "char"; "class"; "continue"; "const";
+		"debugger"; "default"; "delete"; "do"; "double"; "else"; "enum"; "export"; "extends"; "false"; "final";
+		"finally"; "float"; "for"; "function"; "goto"; "if"; "implements"; "import"; "in"; "instanceof"; "int";
+		"interface"; "is"; "let"; "long"; "namespace"; "native"; "new"; "null"; "package"; "private"; "protected";
+		"public"; "return"; "short"; "static"; "super"; "switch"; "synchronized"; "this"; "throw"; "throws";
+		"transient"; "true"; "try"; "typeof"; "use"; "var"; "void"; "volatile"; "while"; "with"; "yield"
 	];
 	];
 	h
 	h
 
 

+ 1 - 1
interp.ml

@@ -59,7 +59,6 @@ and vabstract =
 	| AZipD of zlib
 	| AZipD of zlib
 	| AUtf8 of UTF8.Buf.buf
 	| AUtf8 of UTF8.Buf.buf
 	| ASocket of Unix.file_descr
 	| ASocket of Unix.file_descr
-	| ATExpr of texpr
 	| ATDecl of module_type
 	| ATDecl of module_type
 	| AUnsafe of Obj.t
 	| AUnsafe of Obj.t
 	| ALazyType of (unit -> Type.t) ref
 	| ALazyType of (unit -> Type.t) ref
@@ -2470,6 +2469,7 @@ let macro_lib =
 			| VString cp ->
 			| VString cp ->
 				let com = ccom() in
 				let com = ccom() in
 				com.class_path <- (Common.normalize_path cp) :: com.class_path;
 				com.class_path <- (Common.normalize_path cp) :: com.class_path;
+				Hashtbl.clear com.file_lookup_cache;
 				VNull
 				VNull
 			| _ ->
 			| _ ->
 				error()
 				error()

+ 1 - 1
libs

@@ -1 +1 @@
-Subproject commit 023aca1e0d445ece294931a0059f9fff87c9d6f6
+Subproject commit 3a4b14d06216b5fe3aef666acc5cc436ce76dd86

+ 11 - 4
main.ml

@@ -45,7 +45,7 @@ exception Abort
 exception Completion of string
 exception Completion of string
 
 
 
 
-let version = 3100
+let version = 3102
 let version_major = version / 1000
 let version_major = version / 1000
 let version_minor = (version mod 1000) / 100
 let version_minor = (version mod 1000) / 100
 let version_revision = (version mod 100)
 let version_revision = (version mod 100)
@@ -928,7 +928,7 @@ try
 	let interp = ref false in
 	let interp = ref false in
 	let swf_version = ref false in
 	let swf_version = ref false in
 	Common.define_value com Define.HaxeVer (float_repres (float_of_int version /. 1000.));
 	Common.define_value com Define.HaxeVer (float_repres (float_of_int version /. 1000.));
-	Common.define_value com Define.HxcppApiLevel "310";
+	Common.define_value com Define.HxcppApiLevel "311";
 	Common.raw_define com "haxe3";
 	Common.raw_define com "haxe3";
 	Common.define_value com Define.Dce "std";
 	Common.define_value com Define.Dce "std";
 	com.warning <- (fun msg p -> message ctx ("Warning : " ^ msg) p);
 	com.warning <- (fun msg p -> message ctx ("Warning : " ^ msg) p);
@@ -1069,8 +1069,15 @@ try
 			Genjava.add_java_lib com file false
 			Genjava.add_java_lib com file false
 		),"<file> : add an external JAR or class directory library");
 		),"<file> : add an external JAR or class directory library");
 		("-net-lib",Arg.String (fun file ->
 		("-net-lib",Arg.String (fun file ->
-			Gencs.add_net_lib com file false
-		),"<file> : add an external .NET DLL file");
+			let file, is_std = match ExtString.String.nsplit file "@" with
+				| [file] ->
+					file,false
+				| [file;"std"] ->
+					file,true
+				| _ -> raise Exit
+			in
+			Gencs.add_net_lib com file is_std
+		),"<file>[@std] : add an external .NET DLL file");
 		("-net-std",Arg.String (fun file ->
 		("-net-std",Arg.String (fun file ->
 			Gencs.add_net_std com file
 			Gencs.add_net_std com file
 		),"<file> : add a root std .NET DLL search path");
 		),"<file> : add a root std .NET DLL search path");

+ 27 - 8
matcher.ml

@@ -170,6 +170,25 @@ let any = mk_any t_dynamic Ast.null_pos
 
 
 let fake_tuple_type = TInst(mk_class null_module ([],"-Tuple") null_pos, [])
 let fake_tuple_type = TInst(mk_class null_module ([],"-Tuple") null_pos, [])
 
 
+let mk_type_pat ctx mt t p =
+	let rec loop = function
+		| TClassDecl _ -> "Class"
+		| TEnumDecl _ -> "Enum"
+		| TAbstractDecl a when Meta.has Meta.RuntimeValue a.a_meta -> "Class"
+		| TTypeDecl t ->
+			begin match follow (monomorphs t.t_types t.t_type) with
+				| TInst(c,_) -> loop (TClassDecl c)
+				| TEnum(en,_) -> loop (TEnumDecl en)
+				| TAbstract(a,_) -> loop (TAbstractDecl a)
+				| _ -> error "Cannot use this type as a value" p
+			end
+		| _ -> error "Cannot use this type as a value" p
+	in
+	let tcl = Typeload.load_instance ctx {tname=loop mt;tpackage=[];tsub=None;tparams=[]} p true in
+	let t2 = match tcl with TAbstract(a,_) -> TAbstract(a,[mk_mono()]) | _ -> assert false in
+	unify ctx t t2 p;
+	mk_con_pat (CType mt) [] t2 p
+
 let mk_subs st con =
 let mk_subs st con =
 	let map = match follow st.st_type with
 	let map = match follow st.st_type with
 		| TInst(c,pl) -> apply_params c.cl_types pl
 		| TInst(c,pl) -> apply_params c.cl_types pl
@@ -327,8 +346,10 @@ let to_pattern ctx e t =
 			let e = type_expr ctx e (WithType t) in
 			let e = type_expr ctx e (WithType t) in
 			let e = match Optimizer.make_constant_expression ctx ~concat_strings:true e with Some e -> e | None -> e in
 			let e = match Optimizer.make_constant_expression ctx ~concat_strings:true e with Some e -> e | None -> e in
 			(match e.eexpr with
 			(match e.eexpr with
-			| TConst c | TCast({eexpr = TConst c},None) -> mk_con_pat (CConst c) [] t p
-			| TTypeExpr mt -> mk_con_pat (CType mt) [] t p
+			| TConst c | TCast({eexpr = TConst c},None) ->
+				mk_con_pat (CConst c) [] t p
+			| TTypeExpr mt ->
+				mk_type_pat ctx mt t p
 			| TField(_, FStatic(_,cf)) when is_value_type cf.cf_type ->
 			| TField(_, FStatic(_,cf)) when is_value_type cf.cf_type ->
 				mk_con_pat (CExpr e) [] cf.cf_type p
 				mk_con_pat (CExpr e) [] cf.cf_type p
 			| TField(_, FEnum(en,ef)) ->
 			| TField(_, FEnum(en,ef)) ->
@@ -427,14 +448,12 @@ let to_pattern ctx e t =
 							error (error_msg (Unify l)) p
 							error (error_msg (Unify l)) p
 						end;
 						end;
 						mk_con_pat (CEnum(en,ef)) [] t p
 						mk_con_pat (CEnum(en,ef)) [] t p
-                    | TConst c | TCast({eexpr = TConst c},None) ->
-                    	begin try unify_raise ctx ec.etype t ec.epos with Error (Unify _,_) -> raise Not_found end;
-                        unify ctx ec.etype t p;
+					| TConst c | TCast({eexpr = TConst c},None) ->
+						begin try unify_raise ctx ec.etype t ec.epos with Error (Unify _,_) -> raise Not_found end;
+						unify ctx ec.etype t p;
                         mk_con_pat (CConst c) [] t p
                         mk_con_pat (CConst c) [] t p
 					| TTypeExpr mt ->
 					| TTypeExpr mt ->
-						let tcl = Typeload.load_instance ctx {tname="Class";tpackage=[];tsub=None;tparams=[]} p true in
-						let t2 = match tcl with TAbstract(a,_) -> TAbstract(a,[mk_mono()]) | _ -> assert false in
-						mk_con_pat (CType mt) [] t2 p
+						mk_type_pat ctx mt t p
 					| _ ->
 					| _ ->
 						raise Not_found);
 						raise Not_found);
 			with Not_found ->
 			with Not_found ->

+ 61 - 23
optimizer.ml

@@ -69,23 +69,31 @@ let api_inline ctx c field params p =
 			Some { eexpr = TConst (TString (if b then "true" else "false")); epos = p; etype = ctx.t.tstring }
 			Some { eexpr = TConst (TString (if b then "true" else "false")); epos = p; etype = ctx.t.tstring }
 		| _ ->
 		| _ ->
 			None)
 			None)
-(* 	| ([],"Std"),"string",[v] when ctx.com.platform = Js || ctx.com.platform = Flash ->
+	| ([],"Std"),"string",[{ eexpr = TIf (_,{ eexpr = TConst (TString _)},Some { eexpr = TConst (TString _) }) } as e] ->
+		Some e
+ 	| ([],"Std"),"string",[{ eexpr = TLocal _ | TField({ eexpr = TLocal _ },_) } as v] when ctx.com.platform = Js || ctx.com.platform = Flash ->
 		let pos = v.epos in
 		let pos = v.epos in
-		let stringt = ctx.com.basic.tstring in
-		let stringv = mk (TBinop (Ast.OpAdd, mk (TConst (TString "")) stringt pos, v)) stringt pos in
+		let stringv() =
+			let to_str = mk (TBinop (Ast.OpAdd, mk (TConst (TString "")) ctx.t.tstring pos, v)) ctx.t.tstring pos in
+			if ctx.com.platform = Js || is_nullable v.etype then
+				let chk_null = mk (TBinop (Ast.OpEq, v, mk (TConst TNull) t_dynamic pos)) ctx.t.tbool pos in
+				mk (TIf (chk_null, mk (TConst (TString "null")) ctx.t.tstring pos, Some to_str)) ctx.t.tstring pos
+			else
+				to_str
+		in
 		(match follow v.etype with
 		(match follow v.etype with
 		| TInst ({ cl_path = [],"String" }, []) ->
 		| TInst ({ cl_path = [],"String" }, []) ->
-			Some v
+			Some (stringv())
 		| TAbstract ({ a_path = [],"Float" }, []) ->
 		| TAbstract ({ a_path = [],"Float" }, []) ->
-			Some stringv
+			Some (stringv())
 		| TAbstract ({ a_path = [],"Int" }, []) ->
 		| TAbstract ({ a_path = [],"Int" }, []) ->
-			Some stringv
+			Some (stringv())
 		| TAbstract ({ a_path = [],"UInt" }, []) ->
 		| TAbstract ({ a_path = [],"UInt" }, []) ->
-			Some stringv
+			Some (stringv())
 		| TAbstract ({ a_path = [],"Bool" }, []) ->
 		| TAbstract ({ a_path = [],"Bool" }, []) ->
-			Some stringv
+			Some (stringv())
 		| _ ->
 		| _ ->
-			None) *)
+			None)
 	| ([],"Std"),"is",[o;t] | (["js"],"Boot"),"__instanceof",[o;t] when ctx.com.platform = Js ->
 	| ([],"Std"),"is",[o;t] | (["js"],"Boot"),"__instanceof",[o;t] when ctx.com.platform = Js ->
 		let mk_local ctx n t pos = mk (TLocal (try PMap.find n ctx.locals with _ -> add_local ctx n t)) t pos in
 		let mk_local ctx n t pos = mk (TLocal (try PMap.find n ctx.locals with _ -> add_local ctx n t)) t pos in
 
 
@@ -541,7 +549,7 @@ let rec optimize_for_loop ctx i e1 e2 p =
 	let mk_field e n =
 	let mk_field e n =
 		TField (e,try quick_field e.etype n with Not_found -> assert false)
 		TField (e,try quick_field e.etype n with Not_found -> assert false)
 	in
 	in
-	let gen_int_iter pt =
+	let gen_int_iter pt f_get f_length =
 		let i = add_local ctx i pt in
 		let i = add_local ctx i pt in
 		let index = gen_local ctx t_int in
 		let index = gen_local ctx t_int in
 		let arr, avars = (match e1.eexpr with
 		let arr, avars = (match e1.eexpr with
@@ -552,21 +560,14 @@ let rec optimize_for_loop ctx i e1 e2 p =
 		) in
 		) in
 		let iexpr = mk (TLocal index) t_int p in
 		let iexpr = mk (TLocal index) t_int p in
 		let e2 = type_expr ctx e2 NoValue in
 		let e2 = type_expr ctx e2 NoValue in
-		let aget = mk (TVar (i,Some (mk (TArray (arr,iexpr)) pt p))) t_void p in
+		let aget = mk (TVar (i,Some (f_get arr iexpr pt p))) t_void p in
 		let incr = mk (TUnop (Increment,Prefix,iexpr)) t_int p in
 		let incr = mk (TUnop (Increment,Prefix,iexpr)) t_int p in
 		let block = match e2.eexpr with
 		let block = match e2.eexpr with
 			| TBlock el -> mk (TBlock (aget :: incr :: el)) t_void e2.epos
 			| TBlock el -> mk (TBlock (aget :: incr :: el)) t_void e2.epos
 			| _ -> mk (TBlock [aget;incr;e2]) t_void p
 			| _ -> mk (TBlock [aget;incr;e2]) t_void p
 		in
 		in
 		let ivar = Some (mk (TConst (TInt 0l)) t_int p) in
 		let ivar = Some (mk (TConst (TInt 0l)) t_int p) in
-		let elength = match follow e1.etype with
-			| TAbstract({a_impl = Some c},_) ->
-				let ta = TAnon { a_fields = c.cl_statics; a_status = ref (Statics c) } in
-				let ethis = mk (TTypeExpr (TClassDecl c)) ta e1.epos in
-				let efield = mk (mk_field ethis "get_length") (tfun [arr.etype] t_int) p in
-				make_call ctx efield [arr] t_int e1.epos
-			| _ -> mk (mk_field arr "length") t_int p
-		in
+		let elength = f_length arr p in
 		let el = [mk (TWhile (
 		let el = [mk (TWhile (
 				mk (TBinop (OpLt, iexpr, elength)) ctx.t.tbool p,
 				mk (TBinop (OpLt, iexpr, elength)) ctx.t.tbool p,
 				block,
 				block,
@@ -577,6 +578,12 @@ let rec optimize_for_loop ctx i e1 e2 p =
 		let el = (mk (TVar (index,ivar)) t_void p) :: el in
 		let el = (mk (TVar (index,ivar)) t_void p) :: el in
 		lblock el
 		lblock el
 	in
 	in
+	let get_next_array_element arr iexpr pt p =
+		(mk (TArray (arr,iexpr)) pt p)
+	in
+	let get_array_length arr p =
+		mk (mk_field arr "length") ctx.com.basic.tint p
+	in
 	match e1.eexpr, follow e1.etype with
 	match e1.eexpr, follow e1.etype with
 	| TNew ({ cl_path = ([],"IntIterator") },[],[i1;i2]) , _ ->
 	| TNew ({ cl_path = ([],"IntIterator") },[],[i1;i2]) , _ ->
 		let max = (match i1.eexpr , i2.eexpr with
 		let max = (match i1.eexpr , i2.eexpr with
@@ -634,11 +641,42 @@ let rec optimize_for_loop ctx i e1 e2 p =
 			])
 			])
 	| _ , TInst({ cl_path = [],"Array" },[pt])
 	| _ , TInst({ cl_path = [],"Array" },[pt])
 	| _ , TInst({ cl_path = ["flash"],"Vector" },[pt]) ->
 	| _ , TInst({ cl_path = ["flash"],"Vector" },[pt]) ->
-		gen_int_iter pt
+		gen_int_iter pt get_next_array_element get_array_length
 	| _ , TInst({ cl_array_access = Some pt } as c,pl) when (try match follow (PMap.find "length" c.cl_fields).cf_type with TAbstract ({ a_path = [],"Int" },[]) -> true | _ -> false with Not_found -> false) && not (PMap.mem "iterator" c.cl_fields) ->
 	| _ , TInst({ cl_array_access = Some pt } as c,pl) when (try match follow (PMap.find "length" c.cl_fields).cf_type with TAbstract ({ a_path = [],"Int" },[]) -> true | _ -> false with Not_found -> false) && not (PMap.mem "iterator" c.cl_fields) ->
-		gen_int_iter (apply_params c.cl_types pl pt)
-	| (TLocal _ | TField _), TAbstract({a_impl = Some c} as a,[pt]) when Meta.has Meta.ArrayAccess a.a_meta && (try match follow (PMap.find "length" c.cl_statics).cf_type with TAbstract ({ a_path = [],"Int" },[]) -> true | _ -> false with Not_found -> false) && not (PMap.mem "iterator" c.cl_statics) ->
-		gen_int_iter pt
+		gen_int_iter (apply_params c.cl_types pl pt) get_next_array_element get_array_length
+	| _, TAbstract({a_impl = Some c} as a,tl) ->
+		begin try
+			let cf_length = PMap.find "get_length" c.cl_statics in
+			let get_length e p =
+				make_static_call ctx c cf_length (apply_params a.a_types tl) [e] ctx.com.basic.tint p
+			in
+			begin match follow cf_length.cf_type with
+				| TFun(_,tr) ->
+					begin match follow tr with
+						| TAbstract({a_path = [],"Int"},_) -> ()
+						| _ -> raise Not_found
+					end
+				| _ ->
+					raise Not_found
+			end;
+			begin try
+				(* first try: do we have an @:arrayAccess getter field? *)
+				let cf,tf,r = find_array_access a tl ctx.com.basic.tint (mk_mono()) false in
+				let get_next e_base e_index t p =
+					make_static_call ctx c cf (apply_params a.a_types tl) [e_base;e_index] r p
+				in
+				gen_int_iter r get_next get_length
+			with Not_found ->
+				(* second try: do we have @:arrayAccess on the abstract itself? *)
+				if not (Meta.has Meta.ArrayAccess a.a_meta) then raise Not_found;
+				(* let's allow this only for core-type abstracts *)
+				if not (Meta.has Meta.CoreType a.a_meta) then raise Not_found;
+				(* in which case we assume that a singular type parameter is the element type *)
+				let t = match tl with [t] -> t | _ -> raise Not_found in
+				gen_int_iter t get_next_array_element get_length
+		end with Not_found ->
+			None
+		end
 	| _ , TInst ({ cl_kind = KGenericInstance ({ cl_path = ["haxe";"ds"],"GenericStack" },[t]) } as c,[]) ->
 	| _ , TInst ({ cl_kind = KGenericInstance ({ cl_path = ["haxe";"ds"],"GenericStack" },[t]) } as c,[]) ->
 		let tcell = (try (PMap.find "head" c.cl_fields).cf_type with Not_found -> assert false) in
 		let tcell = (try (PMap.find "head" c.cl_fields).cf_type with Not_found -> assert false) in
 		let i = add_local ctx i t in
 		let i = add_local ctx i t in

+ 6 - 6
parser.ml

@@ -1240,17 +1240,17 @@ and expr_next e1 = parser
 		| [< >] -> serror())
 		| [< >] -> serror())
 	| [< '(BkOpen,_); e2 = expr; '(BkClose,p2); s >] ->
 	| [< '(BkOpen,_); e2 = expr; '(BkClose,p2); s >] ->
 		expr_next (EArray (e1,e2), punion (pos e1) p2) s
 		expr_next (EArray (e1,e2), punion (pos e1) p2) s
-	| [< '(Binop OpGt,_); s >] ->
+	| [< '(Binop OpGt,p1); s >] ->
 		(match s with parser
 		(match s with parser
-		| [< '(Binop OpGt,_); s >] ->
+		| [< '(Binop OpGt,p2) when p1.pmax = p2.pmin; s >] ->
 			(match s with parser
 			(match s with parser
-			| [< '(Binop OpGt,_) >] ->
+			| [< '(Binop OpGt,p3) when p2.pmax = p3.pmin >] ->
 				(match s with parser
 				(match s with parser
-				| [< '(Binop OpAssign,_); e2 = expr >] -> make_binop (OpAssignOp OpUShr) e1 e2
+				| [< '(Binop OpAssign,p4) when p3.pmax = p4.pmin; e2 = expr >] -> make_binop (OpAssignOp OpUShr) e1 e2
 				| [< e2 = secure_expr >] -> make_binop OpUShr e1 e2)
 				| [< e2 = secure_expr >] -> make_binop OpUShr e1 e2)
-			| [< '(Binop OpAssign,_); e2 = expr >] -> make_binop (OpAssignOp OpShr) e1 e2
+			| [< '(Binop OpAssign,p3) when p2.pmax = p3.pmin; e2 = expr >] -> make_binop (OpAssignOp OpShr) e1 e2
 			| [< e2 = secure_expr >] -> make_binop OpShr e1 e2)
 			| [< e2 = secure_expr >] -> make_binop OpShr e1 e2)
-		| [< '(Binop OpAssign,_); s >] ->
+		| [< '(Binop OpAssign,p2) when p1.pmax = p2.pmin; s >] ->
 			make_binop OpGte e1 (secure_expr s)
 			make_binop OpGte e1 (secure_expr s)
 		| [< e2 = secure_expr >] ->
 		| [< e2 = secure_expr >] ->
 			make_binop OpGt e1 e2)
 			make_binop OpGt e1 e2)

+ 1 - 1
std/Class.hx

@@ -21,7 +21,7 @@
  */
  */
 /**
 /**
 	An abstract type that represents a Class.
 	An abstract type that represents a Class.
-	
+
 	See `Type` for the Haxe Reflection API.
 	See `Type` for the Haxe Reflection API.
 **/
 **/
 @:coreType @:runtimeValue abstract Class<T> {
 @:coreType @:runtimeValue abstract Class<T> {

+ 7 - 7
std/Date.hx

@@ -23,14 +23,14 @@
  /**
  /**
 	The Date class provides a basic structure for date and time related
 	The Date class provides a basic structure for date and time related
 	information. Date instances can be created by
 	information. Date instances can be created by
-	
+
 	- `new Date()` for a specific date,
 	- `new Date()` for a specific date,
 	- `Date.now()` to obtain information about the current time,
 	- `Date.now()` to obtain information about the current time,
 	- `Date.fromTime()` with a given timestamp or
 	- `Date.fromTime()` with a given timestamp or
 	- `Date.fromString()` by parsing from a String.
 	- `Date.fromString()` by parsing from a String.
-	
+
 	There is some extra functions available in the `DateTools` class.
 	There is some extra functions available in the `DateTools` class.
-	
+
 	In the context of haxe dates, a timestamp is defined as the number of
 	In the context of haxe dates, a timestamp is defined as the number of
 	milliseconds elapsed since 1st January 1970.
 	milliseconds elapsed since 1st January 1970.
 **/
 **/
@@ -38,10 +38,10 @@ extern class Date
 {
 {
 	/**
 	/**
 		Creates a new date object from the given arguments.
 		Creates a new date object from the given arguments.
-		
+
 		The behaviour of a Date instance is only consistent across platforms if
 		The behaviour of a Date instance is only consistent across platforms if
 		the the arguments describe a valid date.
 		the the arguments describe a valid date.
-		
+
 		- month: 0 to 11
 		- month: 0 to 11
 		- day: 1 to 31
 		- day: 1 to 31
 		- hour: 0 to 23
 		- hour: 0 to 23
@@ -111,11 +111,11 @@ extern class Date
 	/**
 	/**
 		Returns a Date from a formated string `s`, with the following accepted
 		Returns a Date from a formated string `s`, with the following accepted
 		formats:
 		formats:
-		
+
 		- `"YYYY-MM-DD hh:mm:ss"`
 		- `"YYYY-MM-DD hh:mm:ss"`
 		- `"YYYY-MM-DD"`
 		- `"YYYY-MM-DD"`
 		- `"hh:mm:ss"`
 		- `"hh:mm:ss"`
-		
+
 		The first two formats are expressed in local time, the third in UTC
 		The first two formats are expressed in local time, the third in UTC
 		Epoch.
 		Epoch.
 	**/
 	**/

+ 4 - 4
std/DateTools.hx

@@ -23,7 +23,7 @@
 /**
 /**
 	The DateTools class contains some extra functionalities for handling `Date`
 	The DateTools class contains some extra functionalities for handling `Date`
 	instances and timestamps.
 	instances and timestamps.
-	
+
 	In the context of haxe dates, a timestamp is defined as the number of
 	In the context of haxe dates, a timestamp is defined as the number of
 	milliseconds elapsed since 1st January 1970.
 	milliseconds elapsed since 1st January 1970.
 **/
 **/
@@ -123,7 +123,7 @@ class DateTools {
 
 
 	/**
 	/**
 		Returns the result of adding timestamp `t` to Date `d`.
 		Returns the result of adding timestamp `t` to Date `d`.
-		
+
 		This is a convenience function for calling
 		This is a convenience function for calling
 		`Date.fromTime(d.getTime() + t)`.
 		`Date.fromTime(d.getTime() + t)`.
 	**/
 	**/
@@ -135,7 +135,7 @@ class DateTools {
 
 
 	/**
 	/**
 		Returns the number of days in the month of Date `d`.
 		Returns the number of days in the month of Date `d`.
-		
+
 		This method handles leap years.
 		This method handles leap years.
 	**/
 	**/
 	public static function getMonthDays( d : Date ) : Int {
 	public static function getMonthDays( d : Date ) : Int {
@@ -199,7 +199,7 @@ class DateTools {
 	public static function make( o : { ms : Float, seconds : Int, minutes : Int, hours : Int, days : Int } ) {
 	public static function make( o : { ms : Float, seconds : Int, minutes : Int, hours : Int, days : Int } ) {
 		return o.ms + 1000.0 * (o.seconds + 60.0 * (o.minutes + 60.0 * (o.hours + 24.0 * o.days)));
 		return o.ms + 1000.0 * (o.seconds + 60.0 * (o.minutes + 60.0 * (o.hours + 24.0 * o.days)));
 	}
 	}
-	
+
 	#if (js || flash || php || cpp)
 	#if (js || flash || php || cpp)
 	/**
 	/**
 		Retrieve Unix timestamp value from Date components. Takes same argument sequence as the Date constructor.
 		Retrieve Unix timestamp value from Date components. Takes same argument sequence as the Date constructor.

+ 31 - 31
std/EReg.hx

@@ -22,17 +22,17 @@
 
 
 /**
 /**
 	The EReg class represents regular expressions.
 	The EReg class represents regular expressions.
-	
+
 	While basic usage and patterns consistently work across platforms, some more
 	While basic usage and patterns consistently work across platforms, some more
 	complex operations may yield different results. This is a necessary trade-
 	complex operations may yield different results. This is a necessary trade-
 	off to retain a certain level of performance.
 	off to retain a certain level of performance.
-	
+
 	EReg instances can be created by calling the constructor, or with the
 	EReg instances can be created by calling the constructor, or with the
 	special syntax ~/pattern/modifier
 	special syntax ~/pattern/modifier
-	
+
 	EReg instances maintain an internal state, which is affected by several of
 	EReg instances maintain an internal state, which is affected by several of
 	its methods.
 	its methods.
-	
+
 	A detailed explanation of the supported operations is available at
 	A detailed explanation of the supported operations is available at
 	http://haxe.org/doc/cross/regexp
 	http://haxe.org/doc/cross/regexp
 **/
 **/
@@ -40,9 +40,9 @@ class EReg {
 
 
 	/**
 	/**
 		Creates a new regular expression with pattern `r` and modifiers `opt`.
 		Creates a new regular expression with pattern `r` and modifiers `opt`.
-		
+
 		This is equivalent to the shorthand syntax `~/r/opt`
 		This is equivalent to the shorthand syntax `~/r/opt`
-		
+
 		If `r` or `opt` are null, the result is unspecified.
 		If `r` or `opt` are null, the result is unspecified.
 	**/
 	**/
 	public function new( r : String, opt : String ) {
 	public function new( r : String, opt : String ) {
@@ -51,9 +51,9 @@ class EReg {
 
 
 	/**
 	/**
 		Tells if `this` regular expression matches String `s`.
 		Tells if `this` regular expression matches String `s`.
-		
+
 		This method modifies the internal state.
 		This method modifies the internal state.
-		
+
 		If `s` is `null`, the result is unspecified.
 		If `s` is `null`, the result is unspecified.
 	**/
 	**/
 	public function match( s : String ) : Bool {
 	public function match( s : String ) : Bool {
@@ -62,13 +62,13 @@ class EReg {
 
 
 	/**
 	/**
 		Returns the matched sub-group `n` of `this` EReg.
 		Returns the matched sub-group `n` of `this` EReg.
-		
+
 		This method should only be called after `this.match` or
 		This method should only be called after `this.match` or
 		`this.matchSub`, and then operates on the String of that operation.
 		`this.matchSub`, and then operates on the String of that operation.
-		
+
 		The index `n` corresponds to the n-th set of parentheses in the pattern
 		The index `n` corresponds to the n-th set of parentheses in the pattern
 		of `this` EReg. If no such sub-group exists, an exception is thrown.
 		of `this` EReg. If no such sub-group exists, an exception is thrown.
-		
+
 		If `n` equals 0, the whole matched substring is returned.
 		If `n` equals 0, the whole matched substring is returned.
 	**/
 	**/
 	public function matched( n : Int ) : String {
 	public function matched( n : Int ) : String {
@@ -77,13 +77,13 @@ class EReg {
 
 
 	/**
 	/**
 		Returns the part to the left of the last matched substring.
 		Returns the part to the left of the last matched substring.
-		
+
 		If the most recent call to `this.match` or `this.matchSub` did not
 		If the most recent call to `this.match` or `this.matchSub` did not
 		match anything, the result is unspecified.
 		match anything, the result is unspecified.
-		
+
 		If the global g modifier was in place for the matching, only the
 		If the global g modifier was in place for the matching, only the
 		substring to the left of the leftmost match is returned.
 		substring to the left of the leftmost match is returned.
-		
+
 		The result does not include the matched part.
 		The result does not include the matched part.
 	**/
 	**/
 	public function matchedLeft() : String {
 	public function matchedLeft() : String {
@@ -92,13 +92,13 @@ class EReg {
 
 
 	/**
 	/**
 		Returns the part to the right of the last matched substring.
 		Returns the part to the right of the last matched substring.
-		
+
 		If the most recent call to `this.match` or `this.matchSub` did not
 		If the most recent call to `this.match` or `this.matchSub` did not
 		match anything, the result is unspecified.
 		match anything, the result is unspecified.
-		
+
 		If the global g modifier was in place for the matching, only the
 		If the global g modifier was in place for the matching, only the
 		substring to the right of the leftmost match is returned.
 		substring to the right of the leftmost match is returned.
-		
+
 		The result does not include the matched part.
 		The result does not include the matched part.
 	**/
 	**/
 	public function matchedRight() : String {
 	public function matchedRight() : String {
@@ -109,10 +109,10 @@ class EReg {
 		Returns the position and length of the last matched substring, within
 		Returns the position and length of the last matched substring, within
 		the String which was last used as argument to `this.match` or
 		the String which was last used as argument to `this.match` or
 		`this.matchSub`.
 		`this.matchSub`.
-		
+
 		If the most recent call to `this.match` or `this.matchSub` did not
 		If the most recent call to `this.match` or `this.matchSub` did not
 		match anything, the result is unspecified.
 		match anything, the result is unspecified.
-		
+
 		If the global g modifier was in place for the matching, the position and
 		If the global g modifier was in place for the matching, the position and
 		length of the leftmost substring is returned.
 		length of the leftmost substring is returned.
 	**/
 	**/
@@ -122,13 +122,13 @@ class EReg {
 
 
 	/**
 	/**
 		Tells if `this` regular expression matches a substring of String `s`.
 		Tells if `this` regular expression matches a substring of String `s`.
-		
+
 		This function expects `pos` and `len` to describe a valid substring of
 		This function expects `pos` and `len` to describe a valid substring of
 		`s`, or else the result is unspecified. To get more robust behavior,
 		`s`, or else the result is unspecified. To get more robust behavior,
 		`this.match(s.substr(pos,len))` can be used instead.
 		`this.match(s.substr(pos,len))` can be used instead.
-		
+
 		This method modifies the internal state.
 		This method modifies the internal state.
-		
+
 		If `s` is null, the result is unspecified.
 		If `s` is null, the result is unspecified.
 	**/
 	**/
 	public function matchSub( s : String, pos : Int, len : Int = 0):Bool {
 	public function matchSub( s : String, pos : Int, len : Int = 0):Bool {
@@ -137,20 +137,20 @@ class EReg {
 
 
 	/**
 	/**
 		Splits String `s` at all substrings `this` EReg matches.
 		Splits String `s` at all substrings `this` EReg matches.
-		
+
 		If a match is found at the start of `s`, the result contains a leading
 		If a match is found at the start of `s`, the result contains a leading
 		empty String "" entry.
 		empty String "" entry.
-		
+
 		If a match is found at the end of `s`, the result contains a trailing
 		If a match is found at the end of `s`, the result contains a trailing
 		empty String "" entry.
 		empty String "" entry.
-		
+
 		If two matching substrings appear next to each other, the result
 		If two matching substrings appear next to each other, the result
 		contains the empty String "" between them.
 		contains the empty String "" between them.
-		
+
 		By default, this method splits `s` into two parts at the first matched
 		By default, this method splits `s` into two parts at the first matched
 		substring. If the global g modifier is in place, `s` is split at each
 		substring. If the global g modifier is in place, `s` is split at each
 		matched substring.
 		matched substring.
-		
+
 		If `s` is null, the result is unspecified.
 		If `s` is null, the result is unspecified.
 	**/
 	**/
 	public function split( s : String ) : Array<String> {
 	public function split( s : String ) : Array<String> {
@@ -159,16 +159,16 @@ class EReg {
 
 
 	/**
 	/**
 		Replaces the first substring of `s` which `this` EReg matches with `by`.
 		Replaces the first substring of `s` which `this` EReg matches with `by`.
-		
+
 		If `this` EReg does not match any substring, the result is `s`.
 		If `this` EReg does not match any substring, the result is `s`.
-		
+
 		By default, this method replaces only the first matched substring. If
 		By default, this method replaces only the first matched substring. If
 		the global g modifier is in place, all matched substrings are replaced.
 		the global g modifier is in place, all matched substrings are replaced.
-		
+
 		If `by` contains `$1` to `$9`, the digit corresponds to number of a
 		If `by` contains `$1` to `$9`, the digit corresponds to number of a
 		matched sub-group and its value is used instead. If no such sub-group
 		matched sub-group and its value is used instead. If no such sub-group
 		exists, the replacement is unspecified. The string `$$` becomes `$`.
 		exists, the replacement is unspecified. The string `$$` becomes `$`.
-		
+
 		If `s` or `by` are null, the result is unspecified.
 		If `s` or `by` are null, the result is unspecified.
 	**/
 	**/
 	public function replace( s : String, by : String ) : String {
 	public function replace( s : String, by : String ) : String {

+ 2 - 2
std/Enum.hx

@@ -22,9 +22,9 @@
 
 
 /**
 /**
 	An abstract type that represents an Enum type.
 	An abstract type that represents an Enum type.
-	
+
 	The corresponding enum instance type is `EnumValue`.
 	The corresponding enum instance type is `EnumValue`.
-	
+
 	See `Type` for the Haxe Reflection API.
 	See `Type` for the Haxe Reflection API.
 **/
 **/
 @:coreType @:runtimeValue abstract Enum<T> {
 @:coreType @:runtimeValue abstract Enum<T> {

+ 4 - 4
std/IntIterator.hx

@@ -22,10 +22,10 @@
 
 
  /**
  /**
 	IntIterator is used for implementing interval iterations.
 	IntIterator is used for implementing interval iterations.
-	
+
 	It is usually not used explicitly, but through it's special syntax:
 	It is usually not used explicitly, but through it's special syntax:
 	`min...max`
 	`min...max`
-		
+
 	While it is possible to assign an instance of IntIterator to a variable or
 	While it is possible to assign an instance of IntIterator to a variable or
 	field, it is worth noting that IntIterator does not reset after being used
 	field, it is worth noting that IntIterator does not reset after being used
 	in a for-loop. Subsequent uses of the same instance will then have no
 	in a for-loop. Subsequent uses of the same instance will then have no
@@ -38,7 +38,7 @@ class IntIterator {
 
 
 	/**
 	/**
 		Iterates from `min` (inclusive) to `max` (exclusive).
 		Iterates from `min` (inclusive) to `max` (exclusive).
-		
+
 		If `max <= min`, the iterator will not act as a countdown.
 		If `max <= min`, the iterator will not act as a countdown.
 	**/
 	**/
 	public function new( min : Int, max : Int ) {
 	public function new( min : Int, max : Int ) {
@@ -55,7 +55,7 @@ class IntIterator {
 
 
 	/**
 	/**
 		Moves to the next item of the iterator.
 		Moves to the next item of the iterator.
-		
+
 		If this is called while hasNext() is false, the result is unspecified.
 		If this is called while hasNext() is false, the result is unspecified.
 	**/
 	**/
 	public function next() {
 	public function next() {

+ 9 - 9
std/List.hx

@@ -43,7 +43,7 @@ class List<T> {
 
 
 	/**
 	/**
 		Adds element `item` at the end of `this` List.
 		Adds element `item` at the end of `this` List.
-		
+
 		`this.length` increases by 1.
 		`this.length` increases by 1.
 	**/
 	**/
 	public function add( item : T ) {
 	public function add( item : T ) {
@@ -58,7 +58,7 @@ class List<T> {
 
 
 	/**
 	/**
 		Adds element `item` at the beginning of `this` List.
 		Adds element `item` at the beginning of `this` List.
-		
+
 		`this.length` increases by 1.
 		`this.length` increases by 1.
 	**/
 	**/
 	public function push( item : T ) {
 	public function push( item : T ) {
@@ -75,7 +75,7 @@ class List<T> {
 
 
 	/**
 	/**
 		Returns the first element of `this` List, or null if no elements exist.
 		Returns the first element of `this` List, or null if no elements exist.
-		
+
 		This function does not modify `this` List.
 		This function does not modify `this` List.
 	**/
 	**/
 	public function first() : Null<T> {
 	public function first() : Null<T> {
@@ -84,7 +84,7 @@ class List<T> {
 
 
 	/**
 	/**
 		Returns the last element of `this` List, or null if no elements exist.
 		Returns the last element of `this` List, or null if no elements exist.
-		
+
 		This function does not modify `this` List.
 		This function does not modify `this` List.
 	**/
 	**/
 	public function last() : Null<T> {
 	public function last() : Null<T> {
@@ -94,7 +94,7 @@ class List<T> {
 
 
 	/**
 	/**
 		Returns the first element of `this` List, or null if no elements exist.
 		Returns the first element of `this` List, or null if no elements exist.
-		
+
 		The element is removed from `this` List.
 		The element is removed from `this` List.
 	**/
 	**/
 	public function pop() : Null<T> {
 	public function pop() : Null<T> {
@@ -117,7 +117,7 @@ class List<T> {
 
 
 	/**
 	/**
 		Empties `this` List.
 		Empties `this` List.
-		
+
 		This function does not traverse the elements, but simply sets the
 		This function does not traverse the elements, but simply sets the
 		internal references to null and `this.length` to 0.
 		internal references to null and `this.length` to 0.
 	**/
 	**/
@@ -129,10 +129,10 @@ class List<T> {
 
 
 	/**
 	/**
 		Removes the first occurence of `v` in `this` List.
 		Removes the first occurence of `v` in `this` List.
-		
+
 		If `v` is found by checking standard equality, it is removed from `this`
 		If `v` is found by checking standard equality, it is removed from `this`
 		List and the function returns true.
 		List and the function returns true.
-		
+
 		Otherwise, false is returned.
 		Otherwise, false is returned.
 	**/
 	**/
 	public function remove( v : T ) : Bool {
 	public function remove( v : T ) : Bool {
@@ -196,7 +196,7 @@ class List<T> {
 
 
 	/**
 	/**
 		Returns a string representation of `this` List.
 		Returns a string representation of `this` List.
-		
+
 		The result is enclosed in { } with the individual elements being
 		The result is enclosed in { } with the individual elements being
 		separated by a comma.
 		separated by a comma.
 	**/
 	**/

+ 31 - 31
std/Map.hx

@@ -30,109 +30,109 @@ import haxe.ds.EnumValueMap;
  /**
  /**
 	Map allows key to value mapping for arbitrary value types, and many key
 	Map allows key to value mapping for arbitrary value types, and many key
 	types.
 	types.
-		
+
 	This is a multi-type abstract, it is instantiated as one of its
 	This is a multi-type abstract, it is instantiated as one of its
 	specialization types depending on its type parameters.
 	specialization types depending on its type parameters.
-	
+
 	A Map can be instantiated without explicit type parameters. Type inference
 	A Map can be instantiated without explicit type parameters. Type inference
 	will then determine the type parameters from the usage.
 	will then determine the type parameters from the usage.
-	
+
 	Maps can also be created with `key1 => value1, key2 => value2` syntax.
 	Maps can also be created with `key1 => value1, key2 => value2` syntax.
-	
+
 	Map is an abstract type, it is not available at runtime.
 	Map is an abstract type, it is not available at runtime.
 **/
 **/
 @:multiType(K)
 @:multiType(K)
 abstract Map<K,V>(IMap<K,V> ) {
 abstract Map<K,V>(IMap<K,V> ) {
-	
+
 	/**
 	/**
 		Creates a new Map.
 		Creates a new Map.
-		
+
 		This becomes a constructor call to one of the specialization types in
 		This becomes a constructor call to one of the specialization types in
 		the output. The rules for that are as follows:
 		the output. The rules for that are as follows:
-		
+
 		1. if K is a `String`, `haxe.ds.StringMap` is used
 		1. if K is a `String`, `haxe.ds.StringMap` is used
 		2. if K is an `Int`, `haxe.ds.IntMap` is used
 		2. if K is an `Int`, `haxe.ds.IntMap` is used
 		3. if K is an `EnumValue`, `haxe.ds.EnumValueMap` is used
 		3. if K is an `EnumValue`, `haxe.ds.EnumValueMap` is used
 		4. if K is any other class or structure, `haxe.ds.ObjectMap` is used
 		4. if K is any other class or structure, `haxe.ds.ObjectMap` is used
 		5. if K is any other type, it causes a compile-time error
 		5. if K is any other type, it causes a compile-time error
-			
+
 		(Cpp) Map does not use weak keys on ObjectMap by default.
 		(Cpp) Map does not use weak keys on ObjectMap by default.
 	**/
 	**/
 	public function new();
 	public function new();
 
 
 	/**
 	/**
 		Maps `key` to `value`.
 		Maps `key` to `value`.
-		
+
 		If `key` already has a mapping, the previous value disappears.
 		If `key` already has a mapping, the previous value disappears.
-		
+
 		If `key` is null, the result is unspecified.
 		If `key` is null, the result is unspecified.
 	**/
 	**/
 	public inline function set(key:K, value:V) this.set(key, value);
 	public inline function set(key:K, value:V) this.set(key, value);
-	
+
 	/**
 	/**
 		Returns the current mapping of `key`.
 		Returns the current mapping of `key`.
-		
+
 		If no such mapping exists, null is returned.
 		If no such mapping exists, null is returned.
-		
+
 		Note that a check like `map.get(key) == null` can hold for two reasons:
 		Note that a check like `map.get(key) == null` can hold for two reasons:
-		
+
 		1. the map has no mapping for `key`
 		1. the map has no mapping for `key`
 		2. the map has a mapping with a value of `null`
 		2. the map has a mapping with a value of `null`
-		
+
 		If it is important to distinguish these cases, `exists()` should be
 		If it is important to distinguish these cases, `exists()` should be
 		used.
 		used.
-		
+
 		If `key` is null, the result is unspecified.
 		If `key` is null, the result is unspecified.
 	**/
 	**/
 	@:arrayAccess public inline function get(key:K) return this.get(key);
 	@:arrayAccess public inline function get(key:K) return this.get(key);
-	
+
 	/**
 	/**
 		Returns true if `key` has a mapping, false otherwise.
 		Returns true if `key` has a mapping, false otherwise.
-		
+
 		If `key` is null, the result is unspecified.
 		If `key` is null, the result is unspecified.
 	**/
 	**/
 	public inline function exists(key:K) return this.exists(key);
 	public inline function exists(key:K) return this.exists(key);
-	
+
 	/**
 	/**
 		Removes the mapping of `key` and returns true if such a mapping existed,
 		Removes the mapping of `key` and returns true if such a mapping existed,
 		false otherwise.
 		false otherwise.
-		
+
 		If `key` is null, the result is unspecified.
 		If `key` is null, the result is unspecified.
 	**/
 	**/
 	public inline function remove(key:K) return this.remove(key);
 	public inline function remove(key:K) return this.remove(key);
-	
+
 	/**
 	/**
 		Returns an Iterator over the keys of `this` Map.
 		Returns an Iterator over the keys of `this` Map.
-		
+
 		The order of keys is undefined.
 		The order of keys is undefined.
 	**/
 	**/
 	public inline function keys():Iterator<K> {
 	public inline function keys():Iterator<K> {
 		return this.keys();
 		return this.keys();
 	}
 	}
-	
+
 	/**
 	/**
 		Returns an Iterator over the values of `this` Map.
 		Returns an Iterator over the values of `this` Map.
-		
+
 		The order of values is undefined.
 		The order of values is undefined.
 	**/
 	**/
 	public inline function iterator():Iterator<V> {
 	public inline function iterator():Iterator<V> {
 		return this.iterator();
 		return this.iterator();
 	}
 	}
-	
+
 	/**
 	/**
 		Returns a String representation of `this` Map.
 		Returns a String representation of `this` Map.
-		
+
 		The exact representation depends on the platform and key-type.
 		The exact representation depends on the platform and key-type.
 	**/
 	**/
 	public inline function toString():String {
 	public inline function toString():String {
 		return this.toString();
 		return this.toString();
 	}
 	}
-	
+
 	@:arrayAccess @:noCompletion public inline function arrayWrite(k:K, v:V):V {
 	@:arrayAccess @:noCompletion public inline function arrayWrite(k:K, v:V):V {
 		this.set(k, v);
 		this.set(k, v);
 		return v;
 		return v;
 	}
 	}
-	
+
 	@:to static inline function toStringMap(t:IMap<String,V>):StringMap<V> {
 	@:to static inline function toStringMap(t:IMap<String,V>):StringMap<V> {
 		return new StringMap<V>();
 		return new StringMap<V>();
 	}
 	}
@@ -140,7 +140,7 @@ abstract Map<K,V>(IMap<K,V> ) {
 	@:to static inline function toIntMap(t:IMap<Int,V>):IntMap<V> {
 	@:to static inline function toIntMap(t:IMap<Int,V>):IntMap<V> {
 		return new IntMap<V>();
 		return new IntMap<V>();
 	}
 	}
-	
+
 	@:to static inline function toEnumValueMapMap<K:EnumValue>(t:IMap<K,V>):EnumValueMap<K,V> {
 	@:to static inline function toEnumValueMapMap<K:EnumValue>(t:IMap<K,V>):EnumValueMap<K,V> {
 		return new EnumValueMap<K, V>();
 		return new EnumValueMap<K, V>();
 	}
 	}
@@ -148,11 +148,11 @@ abstract Map<K,V>(IMap<K,V> ) {
 	@:to static inline function toObjectMap<K:{ }>(t:IMap<K,V>):ObjectMap<K,V> {
 	@:to static inline function toObjectMap<K:{ }>(t:IMap<K,V>):ObjectMap<K,V> {
 		return new ObjectMap<K, V>();
 		return new ObjectMap<K, V>();
 	}
 	}
-	
+
 	@:from static inline function fromStringMap<V>(map:StringMap<V>):Map< String, V > {
 	@:from static inline function fromStringMap<V>(map:StringMap<V>):Map< String, V > {
 		return map;
 		return map;
 	}
 	}
-	
+
 	@:from static inline function fromIntMap<V>(map:IntMap<V>):Map< Int, V > {
 	@:from static inline function fromIntMap<V>(map:IntMap<V>):Map< Int, V > {
 		return map;
 		return map;
 	}
 	}

+ 35 - 35
std/Reflect.hx

@@ -27,25 +27,25 @@ extern class Reflect {
 
 
 	/**
 	/**
 		Tells if structure `o` has a field named `field`.
 		Tells if structure `o` has a field named `field`.
-		
+
 		This is only guaranteed to work for anonymous structures. Refer to
 		This is only guaranteed to work for anonymous structures. Refer to
 		`Type.getInstanceFields` for a function supporting class instances.
 		`Type.getInstanceFields` for a function supporting class instances.
-		
+
 		If `o` or `field` are null, the result is unspecified.
 		If `o` or `field` are null, the result is unspecified.
 	**/
 	**/
 	public static function hasField( o : Dynamic, field : String ) : Bool;
 	public static function hasField( o : Dynamic, field : String ) : Bool;
 
 
 	/**
 	/**
 		Returns the value of the field named `field` on object `o`.
 		Returns the value of the field named `field` on object `o`.
-		
+
 		If `o` is not an object or has no field named `field`, the result is
 		If `o` is not an object or has no field named `field`, the result is
 		null.
 		null.
-		
+
 		If the field is defined as a property, its accessors are ignored. Refer
 		If the field is defined as a property, its accessors are ignored. Refer
 		to `Reflect.getProperty` for a function supporting property accessors.
 		to `Reflect.getProperty` for a function supporting property accessors.
-		
+
 		If `field` is null, the result is unspecified.
 		If `field` is null, the result is unspecified.
-		
+
 		(As3) If used on a property field, the getter will be invoked. It is
 		(As3) If used on a property field, the getter will be invoked. It is
 		not possible to obtain the value directly.
 		not possible to obtain the value directly.
 	**/
 	**/
@@ -53,24 +53,24 @@ extern class Reflect {
 
 
 	/**
 	/**
 		Sets the field named `field` of object `o` to value `value`.
 		Sets the field named `field` of object `o` to value `value`.
-		
+
 		If `o` has no field named `field`, this function is only guaranteed to
 		If `o` has no field named `field`, this function is only guaranteed to
 		work for anonymous structures.
 		work for anonymous structures.
-		
+
 		If `o` or `field` are null, the result is unspecified.
 		If `o` or `field` are null, the result is unspecified.
-		
+
 		(As3) If used on a property field, the setter will be invoked. It is
 		(As3) If used on a property field, the setter will be invoked. It is
-		not possible to set the value directly.		
+		not possible to set the value directly.
 	**/
 	**/
 	public static function setField( o : Dynamic, field : String, value : Dynamic ) : Void;
 	public static function setField( o : Dynamic, field : String, value : Dynamic ) : Void;
 
 
 	/**
 	/**
 		Returns the value of the field named `field` on object `o`, taking
 		Returns the value of the field named `field` on object `o`, taking
 		property getter functions into account.
 		property getter functions into account.
-		
+
 		If the field is not a property, this function behaves like
 		If the field is not a property, this function behaves like
 		`Reflect.field`, but might be slower.
 		`Reflect.field`, but might be slower.
-		
+
 		If `o` or `field` are null, the result is unspecified.
 		If `o` or `field` are null, the result is unspecified.
 	**/
 	**/
 	public static function getProperty( o : Dynamic, field : String ) : Dynamic;
 	public static function getProperty( o : Dynamic, field : String ) : Dynamic;
@@ -78,10 +78,10 @@ extern class Reflect {
 	/**
 	/**
 		Sets the field named `field` of object `o` to value `value`, taking
 		Sets the field named `field` of object `o` to value `value`, taking
 		property setter functions into account.
 		property setter functions into account.
-		
+
 		If the field is not a property, this function behaves like
 		If the field is not a property, this function behaves like
 		`Reflect.setField`, but might be slower.
 		`Reflect.setField`, but might be slower.
-		
+
 		If `field` is null, the result is unspecified.
 		If `field` is null, the result is unspecified.
 	**/
 	**/
 	public static function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void;
 	public static function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void;
@@ -93,39 +93,39 @@ extern class Reflect {
 
 
 	/**
 	/**
 		Returns the fields of structure `o`.
 		Returns the fields of structure `o`.
-		
+
 		This method is only guaranteed to work on anonymous structures. Refer to
 		This method is only guaranteed to work on anonymous structures. Refer to
 		`Type.getInstanceFields` for a function supporting class instances.
 		`Type.getInstanceFields` for a function supporting class instances.
-		
+
 		If `o` is null, the result is unspecified.
 		If `o` is null, the result is unspecified.
 	**/
 	**/
 	public static function fields( o : Dynamic ) : Array<String>;
 	public static function fields( o : Dynamic ) : Array<String>;
 
 
 	/**
 	/**
 		Returns true if `f` is a function, false otherwise.
 		Returns true if `f` is a function, false otherwise.
-		
+
 		If `f` is null, the result is false.
 		If `f` is null, the result is false.
 	**/
 	**/
 	public static function isFunction( f : Dynamic ) : Bool;
 	public static function isFunction( f : Dynamic ) : Bool;
 
 
 	/**
 	/**
 		Compares `a` and `b`.
 		Compares `a` and `b`.
-		
+
 		If `a` is less than `b`, the result is negative. If `b` is less than
 		If `a` is less than `b`, the result is negative. If `b` is less than
 		`a`, the result is positive. If `a` and `b` are equal, the result is 0.
 		`a`, the result is positive. If `a` and `b` are equal, the result is 0.
-		
+
 		This function is only defined if `a` and `b` are of the same type.
 		This function is only defined if `a` and `b` are of the same type.
-		
+
 		If that type is a function, the result is unspecified and
 		If that type is a function, the result is unspecified and
 		`Reflect.compareMethods` should be used instead.
 		`Reflect.compareMethods` should be used instead.
-		
+
 		For all other types, the result is 0 if `a` and `b` are equal. If they
 		For all other types, the result is 0 if `a` and `b` are equal. If they
 		are not equal, the result depends on the type and is negative if:
 		are not equal, the result depends on the type and is negative if:
-		
+
 		- Numeric types: a is less than b
 		- Numeric types: a is less than b
 		- String: a is lexicographically less than b
 		- String: a is lexicographically less than b
 		- Other: unspecified
 		- Other: unspecified
-		
+
 		If `a` and `b` are null, the result is 0. If only one of them is null,
 		If `a` and `b` are null, the result is 0. If only one of them is null,
 		the result is unspecified.
 		the result is unspecified.
 	**/
 	**/
@@ -133,9 +133,9 @@ extern class Reflect {
 
 
 	/**
 	/**
 		Compares the functions `f1` and `f2`.
 		Compares the functions `f1` and `f2`.
-		
+
 		If `f1` or `f2` are not functions, the result is unspecified.
 		If `f1` or `f2` are not functions, the result is unspecified.
-		
+
 		Otherwise the result is true if `f1` and the `f2` are physically equal,
 		Otherwise the result is true if `f1` and the `f2` are physically equal,
 		false otherwise.
 		false otherwise.
 	**/
 	**/
@@ -143,42 +143,42 @@ extern class Reflect {
 
 
 	/**
 	/**
 		Tells if `v` is an object.
 		Tells if `v` is an object.
-		
+
 		The result is true if `v` is one of the following:
 		The result is true if `v` is one of the following:
-			
+
 		- class instance
 		- class instance
 		- structure
 		- structure
 		- Class<T>
 		- Class<T>
 		- Enum<T>
 		- Enum<T>
-			
+
 		Otherwise, including if `v` is null, the result is false.
 		Otherwise, including if `v` is null, the result is false.
 	**/
 	**/
 	public static function isObject( v : Dynamic ) : Bool;
 	public static function isObject( v : Dynamic ) : Bool;
 
 
 	/**
 	/**
 		Tells if `v` is an enum value.
 		Tells if `v` is an enum value.
-		
+
 		The result is true if `v` is of type EnumValue, i.e. an enum
 		The result is true if `v` is of type EnumValue, i.e. an enum
 		constructor.
 		constructor.
-		
+
 		Otherwise, including if `v` is null, the result is false.
 		Otherwise, including if `v` is null, the result is false.
 	**/
 	**/
 	public static function isEnumValue( v : Dynamic ) : Bool;
 	public static function isEnumValue( v : Dynamic ) : Bool;
-	
+
 	/**
 	/**
 		Removes the field named `field` from structure `o`.
 		Removes the field named `field` from structure `o`.
-		
+
 		This method is only guaranteed to work on anonymous structures.
 		This method is only guaranteed to work on anonymous structures.
-		
+
 		If `o` or `field` are null, the result is unspecified.
 		If `o` or `field` are null, the result is unspecified.
 	**/
 	**/
 	public static function deleteField( o : Dynamic, field : String ) : Bool;
 	public static function deleteField( o : Dynamic, field : String ) : Bool;
 
 
 	/**
 	/**
 		Copies the fields of structure `o`.
 		Copies the fields of structure `o`.
-		
+
 		This is only guaranteed to work on anonymous structures.
 		This is only guaranteed to work on anonymous structures.
-		
+
 		If `o` is null, the result is unspecified.
 		If `o` is null, the result is unspecified.
 	**/
 	**/
 	public static function copy<T>( o : T ) : T;
 	public static function copy<T>( o : T ) : T;

+ 5 - 5
std/Std.hx

@@ -32,20 +32,20 @@ extern class Std {
 		Tells if a value v is of the type t. Returns false if v or t are null.
 		Tells if a value v is of the type t. Returns false if v or t are null.
 	**/
 	**/
 	public static function is( v : Dynamic, t : Dynamic ) : Bool;
 	public static function is( v : Dynamic, t : Dynamic ) : Bool;
-	
+
 	/**
 	/**
 		Checks if object `value` is an instance of class `c`.
 		Checks if object `value` is an instance of class `c`.
-		
+
 		Compiles only if the class specified by `c` can be assigned to the type
 		Compiles only if the class specified by `c` can be assigned to the type
 		of `value`.
 		of `value`.
-		
+
 		This method checks if a downcast is possible. That is, if the runtime
 		This method checks if a downcast is possible. That is, if the runtime
 		type of `value` is assignable to the class specified by `c`, `value` is
 		type of `value` is assignable to the class specified by `c`, `value` is
 		returned. Otherwise null is returned.
 		returned. Otherwise null is returned.
-		
+
 		This method is not guaranteed to work with interfaces or core types such
 		This method is not guaranteed to work with interfaces or core types such
 		as String, Array and Date.
 		as String, Array and Date.
-		
+
 		If `value` is null, the result is null. If `c` is null, the result is
 		If `value` is null, the result is null. If `c` is null, the result is
 		unspecified.
 		unspecified.
 	**/
 	**/

+ 9 - 9
std/StdTypes.hx

@@ -28,7 +28,7 @@
 
 
 /**
 /**
 	The standard Float type, this is a double-precision IEEE 64bit float.
 	The standard Float type, this is a double-precision IEEE 64bit float.
-	
+
 	On static targets, null cannot be assigned to Float. If this is necessary,
 	On static targets, null cannot be assigned to Float. If this is necessary,
 	`Null<Float>` can be used instead.
 	`Null<Float>` can be used instead.
 **/
 **/
@@ -36,7 +36,7 @@
 
 
 /**
 /**
 	The standard Int type. Its precision depends on the platform.
 	The standard Int type. Its precision depends on the platform.
-	
+
 	On static targets, null cannot be assigned to Int. If this is necessary,
 	On static targets, null cannot be assigned to Int. If this is necessary,
 	`Null<Int>` can be used instead.
 	`Null<Int>` can be used instead.
 **/
 **/
@@ -56,7 +56,7 @@ typedef Null<T> = T
 
 
 /**
 /**
 	The standard Boolean type, which can either be true or false.
 	The standard Boolean type, which can either be true or false.
-	
+
 	On static targets, null cannot be assigned to Bool. If this is necessary,
 	On static targets, null cannot be assigned to Bool. If this is necessary,
 	`Null<Bool>` can be used instead.
 	`Null<Bool>` can be used instead.
 **/
 **/
@@ -65,7 +65,7 @@ typedef Null<T> = T
 
 
 /**
 /**
 	Dynamic is a special type which is compatible with all other types.
 	Dynamic is a special type which is compatible with all other types.
-	
+
 	Use of Dynamic should be minimized as it prevents several compiler
 	Use of Dynamic should be minimized as it prevents several compiler
 	checks and optimizations.
 	checks and optimizations.
 **/
 **/
@@ -80,25 +80,25 @@ typedef Null<T> = T
 	custom iterators.
 	custom iterators.
 **/
 **/
 typedef Iterator<T> = {
 typedef Iterator<T> = {
-	
+
 	/**
 	/**
 		Returns false if the iteration is complete, true otherwise.
 		Returns false if the iteration is complete, true otherwise.
-		
+
 		Usually iteration is considered to be complete if all elements of the
 		Usually iteration is considered to be complete if all elements of the
 		underlying data structure were handled through calls to next(). However,
 		underlying data structure were handled through calls to next(). However,
 		in custom iterators any logic may be used to determine the completion
 		in custom iterators any logic may be used to determine the completion
 		state.
 		state.
 	**/
 	**/
 	function hasNext() : Bool;
 	function hasNext() : Bool;
-	
+
 	/**
 	/**
 		Returns the current item of the Iterator and advances to the next one.
 		Returns the current item of the Iterator and advances to the next one.
-		
+
 		This method is not required to check hasNext() first. A call to this
 		This method is not required to check hasNext() first. A call to this
 		method while hasNext() is false yields unspecified behavior.
 		method while hasNext() is false yields unspecified behavior.
 	**/
 	**/
 	function next() : T;
 	function next() : T;
-	
+
 }
 }
 
 
 /**
 /**

+ 26 - 26
std/String.hx

@@ -21,12 +21,12 @@
  */
  */
 /**
 /**
 	The basic String class.
 	The basic String class.
-	
+
 	A haxe String is immutable, it is not possible to modify individual
 	A haxe String is immutable, it is not possible to modify individual
 	characters. No method of this class changes the state of `this` String.
 	characters. No method of this class changes the state of `this` String.
-	
+
 	Strings can be constructed using the string literal syntax "string value".
 	Strings can be constructed using the string literal syntax "string value".
-	
+
 	String can be concatenated by using the + operator. If an operand is not a
 	String can be concatenated by using the + operator. If an operand is not a
 	String, it is passed through Std.string() first.
 	String, it is passed through Std.string() first.
 **/
 **/
@@ -44,21 +44,21 @@ extern class String {
 
 
 	/**
 	/**
 		Returns a String where all characters of `this` String are upper case.
 		Returns a String where all characters of `this` String are upper case.
-		
+
 		Affects the characters `a-z`. Other characters remain unchanged.
 		Affects the characters `a-z`. Other characters remain unchanged.
 	**/
 	**/
 	function toUpperCase() : String;
 	function toUpperCase() : String;
 
 
 	/**
 	/**
 		Returns a String where all characters of `this` String are lower case.
 		Returns a String where all characters of `this` String are lower case.
-		
+
 		Affects the characters `A-Z`. Other characters remain unchanged.
 		Affects the characters `A-Z`. Other characters remain unchanged.
 	**/
 	**/
 	function toLowerCase() : String;
 	function toLowerCase() : String;
 
 
 	/**
 	/**
 		Returns the character at position `index` of `this` String.
 		Returns the character at position `index` of `this` String.
-		
+
 		If `index` is negative or exceeds `this.length`, the empty String ""
 		If `index` is negative or exceeds `this.length`, the empty String ""
 		is returned.
 		is returned.
 	**/
 	**/
@@ -66,9 +66,9 @@ extern class String {
 
 
 	/**
 	/**
 		Returns the character code at position `index` of `this` String.
 		Returns the character code at position `index` of `this` String.
-		
+
 		If `index` is negative or exceeds `this.length`, null is returned.
 		If `index` is negative or exceeds `this.length`, null is returned.
-		
+
 		To obtain the character code of a single character, "x".code can be used
 		To obtain the character code of a single character, "x".code can be used
 		instead to inline the character code at compile time. Note that this
 		instead to inline the character code at compile time. Note that this
 		only works on String literals of length 1.
 		only works on String literals of length 1.
@@ -78,12 +78,12 @@ extern class String {
 	/**
 	/**
 		Returns the position of the leftmost occurence of `str` within `this`
 		Returns the position of the leftmost occurence of `str` within `this`
 		String.
 		String.
-		
+
 		If `startIndex` is given, the search is performed within the substring
 		If `startIndex` is given, the search is performed within the substring
 		of `this` String starting from `startIndex`. Otherwise the search is
 		of `this` String starting from `startIndex`. Otherwise the search is
 		performed within `this` String. In either case, the returned position
 		performed within `this` String. In either case, the returned position
 		is relative to the beginning of `this` String.
 		is relative to the beginning of `this` String.
-		
+
 		If `str` cannot be found, -1 is returned.
 		If `str` cannot be found, -1 is returned.
 	**/
 	**/
 	function indexOf( str : String, ?startIndex : Int ) : Int;
 	function indexOf( str : String, ?startIndex : Int ) : Int;
@@ -91,31 +91,31 @@ extern class String {
 	/**
 	/**
 		Returns the position of the rightmost occurence of `str` within `this`
 		Returns the position of the rightmost occurence of `str` within `this`
 		String.
 		String.
-		
+
 		If `startIndex` is given, the search is performed within the substring
 		If `startIndex` is given, the search is performed within the substring
 		of `this` String from 0 to `startIndex`. Otherwise the search is
 		of `this` String from 0 to `startIndex`. Otherwise the search is
 		performed within `this` String. In either case, the returned position
 		performed within `this` String. In either case, the returned position
 		is relative to the beginning of `this` String.
 		is relative to the beginning of `this` String.
-		
+
 		If `str` cannot be found, -1 is returned.
 		If `str` cannot be found, -1 is returned.
 	**/
 	**/
 	function lastIndexOf( str : String, ?startIndex : Int ) : Int;
 	function lastIndexOf( str : String, ?startIndex : Int ) : Int;
 
 
 	/**
 	/**
 		Splits `this` String at each occurence of `delimiter`.
 		Splits `this` String at each occurence of `delimiter`.
-		
+
 		If `this` String is the empty String "", the result is not consistent
 		If `this` String is the empty String "", the result is not consistent
 		across targets and may either be `[]` (on Js, Cpp) or `[""]`.
 		across targets and may either be `[]` (on Js, Cpp) or `[""]`.
-		
+
 		If `delimiter` is the empty String "", `this` String is split into an
 		If `delimiter` is the empty String "", `this` String is split into an
 		Array of `this.length` elements, where the elements correspond to the
 		Array of `this.length` elements, where the elements correspond to the
 		characters of `this` String.
 		characters of `this` String.
-		
+
 		If `delimiter` is not found within `this` String, the result is an Array
 		If `delimiter` is not found within `this` String, the result is an Array
 		with one element, which equals `this` String.
 		with one element, which equals `this` String.
-		
+
 		If `delimiter` is null, the result is unspecified.
 		If `delimiter` is null, the result is unspecified.
-		
+
 		Otherwise, `this` String is split into parts at each occurence of
 		Otherwise, `this` String is split into parts at each occurence of
 		`delimiter`. If `this` String starts (or ends) with [delimiter}, the
 		`delimiter`. If `this` String starts (or ends) with [delimiter}, the
 		result Array contains a leading (or trailing) empty String "" element.
 		result Array contains a leading (or trailing) empty String "" element.
@@ -125,31 +125,31 @@ extern class String {
 
 
 	/**
 	/**
 		Returns `len` characters of `this` String, starting at position `pos`.
 		Returns `len` characters of `this` String, starting at position `pos`.
-		
+
 		If `len` is omitted, all characters from position `pos` to the end of
 		If `len` is omitted, all characters from position `pos` to the end of
 		`this` String are included.
 		`this` String are included.
-		
+
 		If `pos` is negative, its value is calculated from the end of `this`
 		If `pos` is negative, its value is calculated from the end of `this`
 		String by `this.length + pos`. If this yields a negative value, 0 is
 		String by `this.length + pos`. If this yields a negative value, 0 is
 		used instead.
 		used instead.
-		
+
 		If the calculated position + `len` exceeds `this.length`, the characters
 		If the calculated position + `len` exceeds `this.length`, the characters
 		from that position to the end of `this` String are returned.
 		from that position to the end of `this` String are returned.
-		
+
 		If `len` is negative, the result is unspecified.
 		If `len` is negative, the result is unspecified.
 	**/
 	**/
 	function substr( pos : Int, ?len : Int ) : String;
 	function substr( pos : Int, ?len : Int ) : String;
 
 
 	/**
 	/**
 		Returns the part of `this` String from `startIndex` to `endIndex`.
 		Returns the part of `this` String from `startIndex` to `endIndex`.
-		
+
 		If `startIndex` or `endIndex` are negative, 0 is used instead.
 		If `startIndex` or `endIndex` are negative, 0 is used instead.
-		
+
 		If `startIndex` exceeds `endIndex`, they are swapped.
 		If `startIndex` exceeds `endIndex`, they are swapped.
-		
+
 		If the (possibly swapped) `endIndex` is omitted or exceeds
 		If the (possibly swapped) `endIndex` is omitted or exceeds
 		`this.length`, `this.length` is used instead.
 		`this.length`, `this.length` is used instead.
-		
+
 		If the (possibly swapped) `startIndex` exceeds `this.length`, the empty
 		If the (possibly swapped) `startIndex` exceeds `this.length`, the empty
 		String "" is returned.
 		String "" is returned.
 	**/
 	**/
@@ -162,7 +162,7 @@ extern class String {
 
 
 	/**
 	/**
 		Returns the String corresponding to the character code `code`.
 		Returns the String corresponding to the character code `code`.
-		
+
 		If `code` is negative or has another invalid value, the result is
 		If `code` is negative or has another invalid value, the result is
 		unspecified.
 		unspecified.
 	**/
 	**/

+ 11 - 11
std/StringBuf.hx

@@ -22,10 +22,10 @@
 /**
 /**
 	A String buffer is an efficient way to build a big string by appending small
 	A String buffer is an efficient way to build a big string by appending small
 	elements together.
 	elements together.
-	
+
 	Its cross-platform implementation uses String concatenation internally, but
 	Its cross-platform implementation uses String concatenation internally, but
 	StringBuf may be optimized for different targets.
 	StringBuf may be optimized for different targets.
-	
+
 	Unlike String, an instance of StringBuf is not immutable in the sense that
 	Unlike String, an instance of StringBuf is not immutable in the sense that
 	it can be passed as argument to functions which modify it by appending more
 	it can be passed as argument to functions which modify it by appending more
 	values. However, the internal buffer cannot be modified.
 	values. However, the internal buffer cannot be modified.
@@ -33,7 +33,7 @@
 class StringBuf {
 class StringBuf {
 
 
 	var b:String = "";
 	var b:String = "";
-	
+
 	/**
 	/**
 		The length of `this` StringBuf in characters.
 		The length of `this` StringBuf in characters.
 	**/
 	**/
@@ -41,7 +41,7 @@ class StringBuf {
 
 
 	/**
 	/**
 		Creates a new StringBuf instance.
 		Creates a new StringBuf instance.
-		
+
 		This may involve initialization of the internal buffer.
 		This may involve initialization of the internal buffer.
 	**/
 	**/
 	public function new() {}
 	public function new() {}
@@ -52,11 +52,11 @@ class StringBuf {
 
 
 	/**
 	/**
 		Appends the representation of `x` to `this` StringBuf.
 		Appends the representation of `x` to `this` StringBuf.
-		
+
 		The exact representation of `x` may vary per platform. To get more
 		The exact representation of `x` may vary per platform. To get more
 		consistent behavior, this function should be called with
 		consistent behavior, this function should be called with
 		Std.string(x).
 		Std.string(x).
-		
+
 		If `x` is null, the String "null" is appended.
 		If `x` is null, the String "null" is appended.
 	**/
 	**/
 	public inline function add<T>( x : T ) : Void {
 	public inline function add<T>( x : T ) : Void {
@@ -65,7 +65,7 @@ class StringBuf {
 
 
 	/**
 	/**
 		Appends the character identified by `c` to `this` StringBuf.
 		Appends the character identified by `c` to `this` StringBuf.
-		
+
 		If `c` is negative or has another invalid value, the result is
 		If `c` is negative or has another invalid value, the result is
 		unspecified.
 		unspecified.
 	**/
 	**/
@@ -75,13 +75,13 @@ class StringBuf {
 
 
 	/**
 	/**
 		Appends a substring of `s` to `this` StringBuf.
 		Appends a substring of `s` to `this` StringBuf.
-		
+
 		This function expects `pos` and `len` to describe a valid substring of
 		This function expects `pos` and `len` to describe a valid substring of
 		`s`, or else the result is unspecified. To get more robust behavior,
 		`s`, or else the result is unspecified. To get more robust behavior,
 		`this.add(s.substr(pos,len))` can be used instead.
 		`this.add(s.substr(pos,len))` can be used instead.
-		
+
 		If `s` or `pos` are null, the result is unspecified.
 		If `s` or `pos` are null, the result is unspecified.
-		
+
 		If `len` is omitted or null, the substring ranges from `pos` to the end
 		If `len` is omitted or null, the substring ranges from `pos` to the end
 		of `s`.
 		of `s`.
 	**/
 	**/
@@ -91,7 +91,7 @@ class StringBuf {
 
 
 	/**
 	/**
 		Returns the content of `this` StringBuf as String.
 		Returns the content of `this` StringBuf as String.
-		
+
 		The buffer is not emptied by this operation.
 		The buffer is not emptied by this operation.
 	**/
 	**/
 	public inline function toString() : String {
 	public inline function toString() : String {

+ 6 - 6
std/StringTools.hx

@@ -33,7 +33,7 @@ class StringTools {
 	/**
 	/**
 		Encode an URL by using the standard format.
 		Encode an URL by using the standard format.
 	**/
 	**/
-	#if !java inline #end public static function urlEncode( s : String ) : String untyped {
+	#if (!java && !cpp) inline #end public static function urlEncode( s : String ) : String untyped {
 		#if flash9
 		#if flash9
 			return __global__["encodeURIComponent"](s);
 			return __global__["encodeURIComponent"](s);
 		#elseif flash
 		#elseif flash
@@ -58,7 +58,7 @@ class StringTools {
 	/**
 	/**
 		Decode an URL using the standard format.
 		Decode an URL using the standard format.
 	**/
 	**/
-	#if !java inline #end public static function urlDecode( s : String ) : String untyped {
+	#if (!java && !cpp) inline #end public static function urlDecode( s : String ) : String untyped {
 		#if flash9
 		#if flash9
 			return __global__["decodeURIComponent"](s.split("+").join(" "));
 			return __global__["decodeURIComponent"](s.split("+").join(" "));
 		#elseif flash
 		#elseif flash
@@ -84,13 +84,13 @@ class StringTools {
 		Escapes HTML special characters of the string `s`.
 		Escapes HTML special characters of the string `s`.
 
 
 		The following replacements are made:
 		The following replacements are made:
-			
+
 		- `&` becomes `&amp`;
 		- `&` becomes `&amp`;
 		- `<` becomes `&lt`;
 		- `<` becomes `&lt`;
 		- `>` becomes `&gt`;
 		- `>` becomes `&gt`;
-		
+
 		If `quotes` is true, the following characters are also replaced:
 		If `quotes` is true, the following characters are also replaced:
-		
+
 		- `"` becomes `&quot`;
 		- `"` becomes `&quot`;
 		- `'` becomes `&#039`;
 		- `'` becomes `&#039`;
 	**/
 	**/
@@ -106,7 +106,7 @@ class StringTools {
 		holds: htmlUnescape(htmlEscape(s)) == s
 		holds: htmlUnescape(htmlEscape(s)) == s
 
 
 		The replacements follow:
 		The replacements follow:
-			
+
 		- `&amp;` becomes `&`
 		- `&amp;` becomes `&`
 		- `&lt;` becomes `<`
 		- `&lt;` becomes `<`
 		- `&gt;` becomes `>`
 		- `&gt;` becomes `>`

+ 59 - 59
std/Type.hx

@@ -36,7 +36,7 @@ enum ValueType {
 
 
 /**
 /**
 	The haxe Reflection API allows retrieval of type information at runtime.
 	The haxe Reflection API allows retrieval of type information at runtime.
-	
+
 	This class complements the more lightweight Reflect class, with a focus on
 	This class complements the more lightweight Reflect class, with a focus on
 	class and enum instances.
 	class and enum instances.
 **/
 **/
@@ -44,21 +44,21 @@ extern class Type {
 
 
 	/**
 	/**
 		Returns the class of `o`, if `o` is a class instance.
 		Returns the class of `o`, if `o` is a class instance.
-		
+
 		If `o` is null or of a different type, null is returned.
 		If `o` is null or of a different type, null is returned.
-		
+
 		In general, type parameter information cannot be obtained at runtime.
 		In general, type parameter information cannot be obtained at runtime.
 	**/
 	**/
 	public static function getClass<T>( o : T ) : Class<T>;
 	public static function getClass<T>( o : T ) : Class<T>;
 
 
 	/**
 	/**
 		Returns the enum of enum instance `o`.
 		Returns the enum of enum instance `o`.
-		
+
 		An enum instance is the result of using an enum constructor. Given an
 		An enum instance is the result of using an enum constructor. Given an
 		`enum Color { Red; }`, `getEnum(Red)` returns `Enum<Color>`.
 		`enum Color { Red; }`, `getEnum(Red)` returns `Enum<Color>`.
-		
+
 		If `o` is null, null is returned.
 		If `o` is null, null is returned.
-		
+
 		In general, type parameter information cannot be obtained at runtime.
 		In general, type parameter information cannot be obtained at runtime.
 	**/
 	**/
 	public static function getEnum( o : EnumValue ) : Enum<Dynamic>;
 	public static function getEnum( o : EnumValue ) : Enum<Dynamic>;
@@ -66,11 +66,11 @@ extern class Type {
 
 
 	/**
 	/**
 		Returns the super-class of class `c`.
 		Returns the super-class of class `c`.
-		
+
 		If `c` has no super class, null is returned.
 		If `c` has no super class, null is returned.
-		
+
 		If `c` is null, the result is unspecified.
 		If `c` is null, the result is unspecified.
-		
+
 		In general, type parameter information cannot be obtained at runtime.
 		In general, type parameter information cannot be obtained at runtime.
 	**/
 	**/
 	public static function getSuperClass( c : Class<Dynamic> ) : Class<Dynamic>;
 	public static function getSuperClass( c : Class<Dynamic> ) : Class<Dynamic>;
@@ -78,63 +78,63 @@ extern class Type {
 
 
 	/**
 	/**
 		Returns the name of class `c`, including its path.
 		Returns the name of class `c`, including its path.
-		
+
 		If `c` is inside a package, the package structure is returned dot-
 		If `c` is inside a package, the package structure is returned dot-
 		separated, with another dot separating the class name:
 		separated, with another dot separating the class name:
 		`pack1.pack2.(...).packN.ClassName`
 		`pack1.pack2.(...).packN.ClassName`
 		If `c` is a sub-type of a haxe module, that module is not part of the
 		If `c` is a sub-type of a haxe module, that module is not part of the
 		package structure.
 		package structure.
-			
+
 		If `c` has no package, the class name is returned.
 		If `c` has no package, the class name is returned.
-		
+
 		If `c` is null, the result is unspecified.
 		If `c` is null, the result is unspecified.
-		
+
 		The class name does not include any type parameters.
 		The class name does not include any type parameters.
 	**/
 	**/
 	public static function getClassName( c : Class<Dynamic> ) : String;
 	public static function getClassName( c : Class<Dynamic> ) : String;
 
 
 	/**
 	/**
 		Returns the name of enum `e`, including its path.
 		Returns the name of enum `e`, including its path.
-		
+
 		If `e` is inside a package, the package structure is returned dot-
 		If `e` is inside a package, the package structure is returned dot-
 		separated, with another dot separating the enum name:
 		separated, with another dot separating the enum name:
 		`pack1.pack2.(...).packN.EnumName`
 		`pack1.pack2.(...).packN.EnumName`
 		If `e` is a sub-type of a haxe module, that module is not part of the
 		If `e` is a sub-type of a haxe module, that module is not part of the
 		package structure.
 		package structure.
-			
+
 		If `e` has no package, the enum name is returned.
 		If `e` has no package, the enum name is returned.
-		
+
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
-		
+
 		The enum name does not include any type parameters.
 		The enum name does not include any type parameters.
 	**/
 	**/
 	public static function getEnumName( e : Enum<Dynamic> ) : String;
 	public static function getEnumName( e : Enum<Dynamic> ) : String;
 
 
 	/**
 	/**
 		Resolves a class by name.
 		Resolves a class by name.
-		
+
 		If `name` is the path of an existing class, that class is returned.
 		If `name` is the path of an existing class, that class is returned.
-		
+
 		Otherwise null is returned.
 		Otherwise null is returned.
-		
+
 		If `name` is null or the path to a different type, the result is
 		If `name` is null or the path to a different type, the result is
 		unspecified.
 		unspecified.
-		
+
 		The class name must not include any type parameters.
 		The class name must not include any type parameters.
 	**/
 	**/
 	public static function resolveClass( name : String ) : Class<Dynamic>;
 	public static function resolveClass( name : String ) : Class<Dynamic>;
 
 
 	/**
 	/**
 		Resolves an enum by name.
 		Resolves an enum by name.
-		
+
 		If `name` is the path of an existing enum, that enum is returned.
 		If `name` is the path of an existing enum, that enum is returned.
-		
+
 		Otherwise null is returned.
 		Otherwise null is returned.
-		
+
 		If `name` is null the result is unspecified.
 		If `name` is null the result is unspecified.
-		
+
 		If `name` is the path to a different type, null is returned.
 		If `name` is the path to a different type, null is returned.
-		
+
 		The enum name must not include any type parameters.
 		The enum name must not include any type parameters.
 	**/
 	**/
 	public static function resolveEnum( name : String ) : Enum<Dynamic>;
 	public static function resolveEnum( name : String ) : Enum<Dynamic>;
@@ -142,27 +142,27 @@ extern class Type {
 	/**
 	/**
 		Creates an instance of class `cl`, using `args` as arguments to the
 		Creates an instance of class `cl`, using `args` as arguments to the
 		class constructor.
 		class constructor.
-		
+
 		This function guarantees that the class constructor is called.
 		This function guarantees that the class constructor is called.
-		
+
 		Default values of constructors arguments are not guaranteed to be
 		Default values of constructors arguments are not guaranteed to be
 		taken into account.
 		taken into account.
-		
+
 		If `cl` or `args` are null, or if the number of elements in `args` does
 		If `cl` or `args` are null, or if the number of elements in `args` does
 		not match the expected number of constructor arguments, or if any
 		not match the expected number of constructor arguments, or if any
 		argument has an invalid type,  or if `cl` has no own constructor, the
 		argument has an invalid type,  or if `cl` has no own constructor, the
 		result is unspecified.
 		result is unspecified.
-		
+
 		In particular, default values of constructor arguments are not
 		In particular, default values of constructor arguments are not
 		guaranteed to be taken into account.
 		guaranteed to be taken into account.
 	**/
 	**/
 	public static function createInstance<T>( cl : Class<T>, args : Array<Dynamic> ) : T;
 	public static function createInstance<T>( cl : Class<T>, args : Array<Dynamic> ) : T;
-	
+
 	/**
 	/**
 		Creates an instance of class `cl`.
 		Creates an instance of class `cl`.
-		
+
 		This function guarantees that the class constructor is not called.
 		This function guarantees that the class constructor is not called.
-		
+
 		If `cl` is null, the result is unspecified.
 		If `cl` is null, the result is unspecified.
 	**/
 	**/
 	public static function createEmptyInstance<T>( cl : Class<T> ) : T;
 	public static function createEmptyInstance<T>( cl : Class<T> ) : T;
@@ -170,7 +170,7 @@ extern class Type {
 	/**
 	/**
 		Creates an instance of enum `e` by calling its constructor `constr` with
 		Creates an instance of enum `e` by calling its constructor `constr` with
 		arguments `params`.
 		arguments `params`.
-		
+
 		If `e` or `constr` is null, or if enum `e` has no constructor named
 		If `e` or `constr` is null, or if enum `e` has no constructor named
 		`constr`, or if the number of elements in `params` does not match the
 		`constr`, or if the number of elements in `params` does not match the
 		expected number of constructor arguments, or if any argument has an
 		expected number of constructor arguments, or if any argument has an
@@ -181,10 +181,10 @@ extern class Type {
 	/**
 	/**
 		Creates an instance of enum `e` by calling its constructor number
 		Creates an instance of enum `e` by calling its constructor number
 		`index` with arguments `params`.
 		`index` with arguments `params`.
-		
+
 		The constructor indices are preserved from haxe syntax, so the first
 		The constructor indices are preserved from haxe syntax, so the first
 		declared is index 0, the next index 1 etc.
 		declared is index 0, the next index 1 etc.
-		
+
 		If `e` or `constr` is null, or if enum `e` has no constructor named
 		If `e` or `constr` is null, or if enum `e` has no constructor named
 		`constr`, or if the number of elements in `params` does not match the
 		`constr`, or if the number of elements in `params` does not match the
 		expected number of constructor arguments, or if any argument has an
 		expected number of constructor arguments, or if any argument has an
@@ -194,45 +194,45 @@ extern class Type {
 
 
 	/**
 	/**
 		Returns a list of the instance fields of class `c`.
 		Returns a list of the instance fields of class `c`.
-		
+
 		This only includes fields which are known at compile-time. In
 		This only includes fields which are known at compile-time. In
 		particular, using getInstanceFields(getClass(obj)) will not include
 		particular, using getInstanceFields(getClass(obj)) will not include
 		any fields which were added to obj at runtime.
 		any fields which were added to obj at runtime.
-		
+
 		The order of the fields in the returned Array is unspecified.
 		The order of the fields in the returned Array is unspecified.
-		
+
 		If `c` is null, the result is unspecified.
 		If `c` is null, the result is unspecified.
-		
+
 		(As3) This method only returns instance fields that are public.
 		(As3) This method only returns instance fields that are public.
 	**/
 	**/
 	public static function getInstanceFields( c : Class<Dynamic> ) : Array<String>;
 	public static function getInstanceFields( c : Class<Dynamic> ) : Array<String>;
 
 
 	/**
 	/**
 		Returns a list of static fields of class `c`.
 		Returns a list of static fields of class `c`.
-		
+
 		This does not include static fields of parent classes.
 		This does not include static fields of parent classes.
-		
+
 		The order of the fields in the returned Array is unspecified.
 		The order of the fields in the returned Array is unspecified.
-		
+
 		If `c` is null, the result is unspecified.
 		If `c` is null, the result is unspecified.
-		
+
 		(As3) This method only returns class fields that are public.
 		(As3) This method only returns class fields that are public.
 	**/
 	**/
 	public static function getClassFields( c : Class<Dynamic> ) : Array<String>;
 	public static function getClassFields( c : Class<Dynamic> ) : Array<String>;
 
 
 	/**
 	/**
 		Returns a list of the names of all constructors of enum `e`.
 		Returns a list of the names of all constructors of enum `e`.
-		
+
 		The order of the constructor names in the returned Array is preserved
 		The order of the constructor names in the returned Array is preserved
 		from the original syntax.
 		from the original syntax.
-		
+
 		If `c` is null, the result is unspecified.
 		If `c` is null, the result is unspecified.
 	**/
 	**/
 	public static function getEnumConstructs( e : Enum<Dynamic> ) : Array<String>;
 	public static function getEnumConstructs( e : Enum<Dynamic> ) : Array<String>;
 
 
 	/**
 	/**
 		Returns the runtime type of value `v`.
 		Returns the runtime type of value `v`.
-		
+
 		The result corresponds to the type `v` has at runtime, which may vary
 		The result corresponds to the type `v` has at runtime, which may vary
 		per platform. Assumptions regarding this should be minimized to avoid
 		per platform. Assumptions regarding this should be minimized to avoid
 		surprises.
 		surprises.
@@ -241,41 +241,41 @@ extern class Type {
 
 
 	/**
 	/**
 		Recursively compares two enum instances `a` and `b` by value.
 		Recursively compares two enum instances `a` and `b` by value.
-		
+
 		Unlike `a == b`, this function performs a deep equality check on the
 		Unlike `a == b`, this function performs a deep equality check on the
 		arguments of the constructors, if exists.
 		arguments of the constructors, if exists.
-		
+
 		If `a` or `b` are null, the result is unspecified.
 		If `a` or `b` are null, the result is unspecified.
 	**/
 	**/
 	public static function enumEq<T:EnumValue>( a : T, b : T ) : Bool;
 	public static function enumEq<T:EnumValue>( a : T, b : T ) : Bool;
 
 
 	/**
 	/**
 		Returns the constructor name of enum instance `e`.
 		Returns the constructor name of enum instance `e`.
-		
+
 		The result String does not contain any constructor arguments.
 		The result String does not contain any constructor arguments.
-		
+
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
 	public static function enumConstructor( e : EnumValue ) : String;
 	public static function enumConstructor( e : EnumValue ) : String;
 
 
 	/**
 	/**
 		Returns a list of the constructor arguments of enum instance `e`.
 		Returns a list of the constructor arguments of enum instance `e`.
-		
+
 		If `e` has no arguments, the result is [].
 		If `e` has no arguments, the result is [].
-		
+
 		Otherwise the result are the values that were used as arguments to `e`,
 		Otherwise the result are the values that were used as arguments to `e`,
 		in the order of their declaration.
 		in the order of their declaration.
-		
+
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
 	public static function enumParameters( e : EnumValue ) : Array<Dynamic>;
 	public static function enumParameters( e : EnumValue ) : Array<Dynamic>;
 
 
 	/**
 	/**
 		Returns the index of enum instance `e`.
 		Returns the index of enum instance `e`.
-		
+
 		This corresponds to the original syntactic position of `e`. The index of
 		This corresponds to the original syntactic position of `e`. The index of
 		the first declared constructor is 0, the next one is 1 etc.
 		the first declared constructor is 0, the next one is 1 etc.
-		
+
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
 	public static function enumIndex( e : EnumValue ) : Int;
 	public static function enumIndex( e : EnumValue ) : Int;
@@ -283,14 +283,14 @@ extern class Type {
 	/**
 	/**
 		Returns a list of all constructors of enum `e` that require no
 		Returns a list of all constructors of enum `e` that require no
 		arguments.
 		arguments.
-		
+
 		This may return the empty Array [] if all constructors of `e` require
 		This may return the empty Array [] if all constructors of `e` require
 		arguments.
 		arguments.
-		
+
 		Otherwise an instance of `e` constructed through each of its non-
 		Otherwise an instance of `e` constructed through each of its non-
 		argument constructors is returned, in the order of the constructor
 		argument constructors is returned, in the order of the constructor
 		declaration.
 		declaration.
-		
+
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
 	public static function allEnums<T>( e : Enum<T> ) : Array<T>;
 	public static function allEnums<T>( e : Enum<T> ) : Array<T>;

+ 24 - 36
std/UInt.hx

@@ -38,7 +38,7 @@ abstract UInt(Int) from Int to Int {
 	}
 	}
 
 
 	@:op(A / B) private static inline function div(a:UInt, b:UInt):Float {
 	@:op(A / B) private static inline function div(a:UInt, b:UInt):Float {
-		return a.toInt() / b.toInt();
+		return a.toFloat() / b.toFloat();
 	}
 	}
 
 
 	@:op(A * B) private static inline function mul(a:UInt, b:UInt):UInt {
 	@:op(A * B) private static inline function mul(a:UInt, b:UInt):UInt {
@@ -50,41 +50,19 @@ abstract UInt(Int) from Int to Int {
 	}
 	}
 
 
 	@:op(A > B) private static inline function gt(a:UInt, b:UInt):Bool {
 	@:op(A > B) private static inline function gt(a:UInt, b:UInt):Bool {
-		if (a.toInt() < 0) {
-			if (b.toInt() >= 0) {
-				return false;
-			}
-			else {
-				return a.toInt() > b.toInt();
-			}
-		}
-		else {
-			if (b.toInt() >= 0) {
-				return a.toInt() > b.toInt();
-			}
-			else {
-				return true;
-			}
-		}
+		var aNeg = a.toInt() < 0;
+		var bNeg = b.toInt() < 0;
+		return
+			if( aNeg != bNeg ) aNeg;
+			else a.toInt() > b.toInt();
 	}
 	}
 
 
 	@:op(A >= B) private static inline function gte(a:UInt, b:UInt):Bool {
 	@:op(A >= B) private static inline function gte(a:UInt, b:UInt):Bool {
-		if (a.toInt() < 0) {
-			if (b.toInt() >= 0) {
-				return false;
-			}
-			else {
-				return a.toInt() >= b.toInt();
-			}
-		}
-		else {
-			if (b.toInt() >= 0) {
-				return a.toInt() >= b.toInt();
-			}
-			else {
-				return true;
-			}
-		}
+		var aNeg = a.toInt() < 0;
+		var bNeg = b.toInt() < 0;
+		return
+			if( aNeg != bNeg ) aNeg;
+			else a.toInt() >= b.toInt();
 	}
 	}
 
 
 	@:op(A < B) private static inline function lt(a:UInt, b:UInt):Bool {
 	@:op(A < B) private static inline function lt(a:UInt, b:UInt):Bool {
@@ -120,9 +98,9 @@ abstract UInt(Int) from Int to Int {
 	}
 	}
 
 
 	@:op(A % B) private static inline function mod(a:UInt, b:UInt):UInt {
 	@:op(A % B) private static inline function mod(a:UInt, b:UInt):UInt {
-		return a.toInt() % b.toInt();
+		return Std.int( a.toFloat() % b.toFloat() );
 	}
 	}
-	
+
 	@:commutative @:op(A + B) private static inline function addWithFloat(a:UInt, b:Float):Float {
 	@:commutative @:op(A + B) private static inline function addWithFloat(a:UInt, b:Float):Float {
 		return a.toFloat() + b;
 		return a.toFloat() + b;
 	}
 	}
@@ -151,6 +129,14 @@ abstract UInt(Int) from Int to Int {
 		return a.toFloat() > b;
 		return a.toFloat() > b;
 	}
 	}
 
 
+	@:commutative @:op(A == B) private static inline function equalsFloat(a:UInt, b:Float):Bool {
+        return a.toFloat() == b;
+    }
+
+    @:commutative @:op(A != B) private static inline function notEqualsFloat(a:UInt, b:Float):Bool {
+        return a.toFloat() != b;
+    }
+
 	@:op(A >= B) private static inline function gteFloat(a:UInt, b:Float):Bool {
 	@:op(A >= B) private static inline function gteFloat(a:UInt, b:Float):Bool {
 		return a.toFloat() >= b;
 		return a.toFloat() >= b;
 	}
 	}
@@ -224,7 +210,9 @@ abstract UInt(Int) from Int to Int {
 			return 4294967296.0 + int;
 			return 4294967296.0 + int;
 		}
 		}
 		else {
 		else {
-			return int;
+			// + 0.0 here to make sure we promote to Float on some platforms
+			// In particular, PHP was having issues when comparing to Int in the == op.
+			return int + 0.0;
 		}
 		}
 	}
 	}
 }
 }

+ 17 - 0
std/cpp/Pointer.hx

@@ -0,0 +1,17 @@
+package cpp;
+
+
+extern class Pointer<T> implements ArrayAccess<T>
+{
+	public static function fromArray<T>(array:Array<T>, inIdx:Int):Pointer<T>;
+
+	public function inc():Void;
+	public function dec():Void;
+	public function add(inT:Int):Void;
+
+   // ptr actually returns the pointer, so the ->member sysntax will work
+   // Use [0] for a reference to the item
+	public function ptr():T;
+
+}
+

+ 1 - 1
std/cpp/_std/Reflect.hx

@@ -79,7 +79,7 @@
 		return t ==  __global__.vtObject || t==__global__.vtClass || t==__global__.vtString ||
 		return t ==  __global__.vtObject || t==__global__.vtClass || t==__global__.vtString ||
 				t==__global__.vtArray;
 				t==__global__.vtArray;
 	}
 	}
-	
+
 	public static function isEnumValue( v : Dynamic ) : Bool untyped {
 	public static function isEnumValue( v : Dynamic ) : Bool untyped {
 		return v!=null && v.__GetType() == __global__.vtEnum;
 		return v!=null && v.__GetType() == __global__.vtEnum;
 	}
 	}

+ 10 - 10
std/cpp/vm/Debugger.hx

@@ -215,7 +215,7 @@ class Debugger
     {
     {
         return untyped __global__.__hxcpp_dbg_getClasses();
         return untyped __global__.__hxcpp_dbg_getClasses();
     }
     }
-    
+
     /**
     /**
      * Returns a ThreadInfo object describing every thread that existed at the
      * Returns a ThreadInfo object describing every thread that existed at the
      * moment that the call was made, except for the debugger thread.
      * moment that the call was made, except for the debugger thread.
@@ -224,7 +224,7 @@ class Debugger
     {
     {
         return untyped __global__.__hxcpp_dbg_getThreadInfos();
         return untyped __global__.__hxcpp_dbg_getThreadInfos();
     }
     }
-    
+
     /**
     /**
      * Returns a ThreadInfo object describing a single thread, or null if
      * Returns a ThreadInfo object describing a single thread, or null if
      * there is no such thread or the thread queried about was the debugger
      * there is no such thread or the thread queried about was the debugger
@@ -236,18 +236,18 @@ class Debugger
         return untyped __global__.__hxcpp_dbg_getThreadInfo
         return untyped __global__.__hxcpp_dbg_getThreadInfo
             (threadNumber, unsafe);
             (threadNumber, unsafe);
     }
     }
-    
+
     /**
     /**
      * Adds a new file:line breakpoint.  The breakpoint number of the newly
      * Adds a new file:line breakpoint.  The breakpoint number of the newly
      * added breakpoint is returned.
      * added breakpoint is returned.
      **/
      **/
-    public static function addFileLineBreakpoint(file : String, 
+    public static function addFileLineBreakpoint(file : String,
                                                  line : Int) : Int
                                                  line : Int) : Int
     {
     {
         return untyped __global__.__hxcpp_dbg_addFileLineBreakpoint
         return untyped __global__.__hxcpp_dbg_addFileLineBreakpoint
             (file, line);
             (file, line);
     }
     }
-    
+
     /**
     /**
      * Adds a new class:function breakpoint.  The breakpoint number of the
      * Adds a new class:function breakpoint.  The breakpoint number of the
      * newly added breakpoint is returned.
      * newly added breakpoint is returned.
@@ -272,7 +272,7 @@ class Debugger
                 (cast (number, Int));
                 (cast (number, Int));
         }
         }
     }
     }
-    
+
     /**
     /**
      * Breaks all threads except the debugger thread (which should be the same
      * Breaks all threads except the debugger thread (which should be the same
      * as the calling thread!).
      * as the calling thread!).
@@ -285,7 +285,7 @@ class Debugger
     {
     {
         untyped __global__.__hxcpp_dbg_breakNow(wait);
         untyped __global__.__hxcpp_dbg_breakNow(wait);
     }
     }
-    
+
     /**
     /**
      * Continue execution of all stopped threads.  If specialThreadNumber
      * Continue execution of all stopped threads.  If specialThreadNumber
      * is a valid thread number, then it will be continued past
      * is a valid thread number, then it will be continued past
@@ -302,14 +302,14 @@ class Debugger
     /**
     /**
      * Single steps the given thread.
      * Single steps the given thread.
      **/
      **/
-    public static function stepThread(threadNumber : Int, 
+    public static function stepThread(threadNumber : Int,
                                       stepType : Int,
                                       stepType : Int,
                                       stepCount : Int = 1)
                                       stepCount : Int = 1)
     {
     {
         untyped __global__.__hxcpp_dbg_stepThread
         untyped __global__.__hxcpp_dbg_stepThread
             (threadNumber, stepType, stepCount);
             (threadNumber, stepType, stepCount);
     }
     }
-    
+
     /**
     /**
      * Returns the list of local variables (including "this", function
      * Returns the list of local variables (including "this", function
      * arguments, and local variables) visible to the given thread at the
      * arguments, and local variables) visible to the given thread at the
@@ -336,7 +336,7 @@ class Debugger
      * requested value does not exist.  If the thread is actively running
      * requested value does not exist.  If the thread is actively running
      * and unsafe is not true, returns THREAD_NOT_STOPPED.
      * and unsafe is not true, returns THREAD_NOT_STOPPED.
      **/
      **/
-    public static function getStackVariableValue(threadNumber : Int, 
+    public static function getStackVariableValue(threadNumber : Int,
                                                  stackFrameNumber : Int,
                                                  stackFrameNumber : Int,
                                                  name : String,
                                                  name : String,
                                                  unsafe : Bool) : Dynamic
                                                  unsafe : Bool) : Dynamic

+ 5 - 5
std/cpp/vm/WeakRef.hx

@@ -36,16 +36,16 @@ class WeakRef<T>
       else
       else
 			ref = untyped __global__.__hxcpp_weak_ref_create(inObject);
 			ref = untyped __global__.__hxcpp_weak_ref_create(inObject);
 	}
 	}
-	
-	
+
+
 	public function get():T
 	public function get():T
 	{
 	{
 		if (hardRef)
 		if (hardRef)
 			return ref;
 			return ref;
-		
+
 		return  untyped __global__.__hxcpp_weak_ref_get(ref);
 		return  untyped __global__.__hxcpp_weak_ref_get(ref);
 	}
 	}
-	
+
 	public function set(inObject:T):T
 	public function set(inObject:T):T
 	{
 	{
 		if (hardRef)
 		if (hardRef)
@@ -54,7 +54,7 @@ class WeakRef<T>
 			ref = untyped __global__.__hxcpp_weak_ref_create(inObject);
 			ref = untyped __global__.__hxcpp_weak_ref_create(inObject);
 		return inObject;
 		return inObject;
 	}
 	}
-	
+
 	public function toString():String
 	public function toString():String
 	{
 	{
 		return "WeakRef(" + get() + ")";
 		return "WeakRef(" + get() + ")";

+ 2 - 2
std/cs/Out.hx

@@ -22,9 +22,9 @@
 package cs;
 package cs;
 
 
 /**
 /**
-	This type represents "out" types for C# function parameters. 
+	This type represents "out" types for C# function parameters.
 	It only has effect on function parameters, and conversion to/from the referenced type is automatic.
 	It only has effect on function parameters, and conversion to/from the referenced type is automatic.
-	
+
 	Note: Using this type should be considered a bad practice unless overriding a native function is needed.
 	Note: Using this type should be considered a bad practice unless overriding a native function is needed.
 **/
 **/
 typedef Out<T> = T;
 typedef Out<T> = T;

+ 2 - 2
std/cs/Ref.hx

@@ -22,9 +22,9 @@
 package cs;
 package cs;
 
 
 /**
 /**
-	This type represents "ref" types for C# function parameters. 
+	This type represents "ref" types for C# function parameters.
 	It only has effect on function parameters, and conversion to/from the referenced type is automatic.
 	It only has effect on function parameters, and conversion to/from the referenced type is automatic.
-	
+
 	Note: Using this type should be considered a bad practice unless overriding a native function is needed.
 	Note: Using this type should be considered a bad practice unless overriding a native function is needed.
 **/
 **/
 typedef Ref<T> = T;
 typedef Ref<T> = T;

+ 3 - 3
std/cs/StringBuilder.hx

@@ -23,15 +23,15 @@ package cs;
 
 
 //FIXME this class is here due to seemingly a bug in type resolution inside _std packages.
 //FIXME this class is here due to seemingly a bug in type resolution inside _std packages.
 //Once this bug is fixed, it will be moved back to the cs.system.text package
 //Once this bug is fixed, it will be moved back to the cs.system.text package
-@:native('System.Text.StringBuilder') extern class StringBuilder 
+@:native('System.Text.StringBuilder') extern class StringBuilder
 {
 {
 	var Length(default,never):Int;
 	var Length(default,never):Int;
 
 
 	function new():Void;
 	function new():Void;
-	
+
 	@:overload(function(char:cs.StdTypes.Char16):cs.StringBuilder {})
 	@:overload(function(char:cs.StdTypes.Char16):cs.StringBuilder {})
 	@:overload(function(str:String, startIndex:Int, len:Int):cs.StringBuilder {})
 	@:overload(function(str:String, startIndex:Int, len:Int):cs.StringBuilder {})
 	function Append(obj:Dynamic):StringBuilder;
 	function Append(obj:Dynamic):StringBuilder;
-	
+
 	function ToString():String;
 	function ToString():String;
 }
 }

+ 3 - 3
std/cs/_std/sys/net/Host.hx

@@ -12,11 +12,11 @@ import haxe.io.BytesInput;
 /**
 /**
 	A given IP host name.
 	A given IP host name.
 **/
 **/
-@:coreapi 
+@:coreapi
 class Host {
 class Host {
 	public var hostEntry(default, null) : IPHostEntry;
 	public var hostEntry(default, null) : IPHostEntry;
 	public var ipAddress(default, null) : IPAddress;
 	public var ipAddress(default, null) : IPAddress;
-	
+
 	/**
 	/**
 		The actual IP corresponding to the host.
 		The actual IP corresponding to the host.
 	**/
 	**/
@@ -24,7 +24,7 @@ class Host {
 	private function get_ip() : Int {
 	private function get_ip() : Int {
 		return new BytesInput(Bytes.ofData( ipAddress.GetAddressBytes() )).readInt32();
 		return new BytesInput(Bytes.ofData( ipAddress.GetAddressBytes() )).readInt32();
 	}
 	}
-	
+
 	/**
 	/**
 		Creates a new Host : the name can be an IP in the form "127.0.0.1" or an host name such as "google.com", in which case
 		Creates a new Host : the name can be an IP in the form "127.0.0.1" or an host name such as "google.com", in which case
 		the corresponding IP address is resolved using DNS. An exception occur if the host name could not be found.
 		the corresponding IP address is resolved using DNS. An exception occur if the host name could not be found.

+ 4 - 4
std/cs/_std/sys/net/Socket.hx

@@ -17,10 +17,10 @@ import haxe.io.Output;
 /**
 /**
 	A TCP socket class : allow you to both connect to a given server and exchange messages or start your own server and wait for connections.
 	A TCP socket class : allow you to both connect to a given server and exchange messages or start your own server and wait for connections.
 **/
 **/
-@:coreapi 
+@:coreapi
 class Socket {
 class Socket {
 	private var sock : cs.system.net.sockets.Socket = null;
 	private var sock : cs.system.net.sockets.Socket = null;
-	
+
 	/**
 	/**
 		The stream on which you can read available data. By default the stream is blocking until the requested data is available,
 		The stream on which you can read available data. By default the stream is blocking until the requested data is available,
 		use [setBlocking(false)] or [setTimeout] to prevent infinite waiting.
 		use [setBlocking(false)] or [setTimeout] to prevent infinite waiting.
@@ -156,14 +156,14 @@ class Socket {
 			Thread.Sleep(5);
 			Thread.Sleep(5);
 		}
 		}
 	}
 	}
-	
+
 	/**
 	/**
 		Change the blocking mode of the socket. A blocking socket is the default behavior. A non-blocking socket will abort blocking operations immediatly by throwing a haxe.io.Error.Blocking value.
 		Change the blocking mode of the socket. A blocking socket is the default behavior. A non-blocking socket will abort blocking operations immediatly by throwing a haxe.io.Error.Blocking value.
 	**/
 	**/
 	public function setBlocking( b : Bool ) : Void {
 	public function setBlocking( b : Bool ) : Void {
 		sock.Blocking = b;
 		sock.Blocking = b;
 	}
 	}
-	
+
 	/**
 	/**
 		Allows the socket to immediatly send the data when written to its output : this will cause less ping but might increase the number of packets / data size, especially when doing a lot of small writes.
 		Allows the socket to immediatly send the data when written to its output : this will cause less ping but might increase the number of packets / data size, especially when doing a lot of small writes.
 	**/
 	**/

+ 7 - 0
std/cs/internal/Exceptions.hx

@@ -22,6 +22,13 @@
 package cs.internal;
 package cs.internal;
 import cs.system.Exception;
 import cs.system.Exception;
 
 
+@:nativeGen @:keep @:native("haxe.lang.Exceptions") class Exceptions {
+
+	@:allow(haxe.CallStack)
+	@:meta(System.ThreadStaticAttribute)
+	static var exception:cs.system.Exception;
+}
+
 //should NOT be usable inside haxe code
 //should NOT be usable inside haxe code
 @:nativeGen @:keep @:native("haxe.lang.HaxeException") private class HaxeException extends Exception
 @:nativeGen @:keep @:native("haxe.lang.HaxeException") private class HaxeException extends Exception
 {
 {

+ 12 - 12
std/cs/internal/FieldLookup.hx

@@ -22,12 +22,12 @@
 package cs.internal;
 package cs.internal;
 
 
 @:native('haxe.lang.FieldLookup')
 @:native('haxe.lang.FieldLookup')
-@:keep @:static private class FieldLookup 
+@:keep @:static private class FieldLookup
 {
 {
 
 
 	@:private private static var fieldIds:Array<Int>;
 	@:private private static var fieldIds:Array<Int>;
 	@:private private static var fields:Array<String>;
 	@:private private static var fields:Array<String>;
-	
+
 	//s cannot be null here
 	//s cannot be null here
 	private static inline function doHash(s:String):Int
 	private static inline function doHash(s:String):Int
 	{
 	{
@@ -36,17 +36,17 @@ package cs.internal;
 		{
 		{
 			acc = (( 223 * (acc >> 1) + s.charCodeAt(i) ) << 1);
 			acc = (( 223 * (acc >> 1) + s.charCodeAt(i) ) << 1);
 		}
 		}
-		
+
 		return acc >>> 1; //always positive
 		return acc >>> 1; //always positive
 	}
 	}
-	
+
 	public static function lookupHash(key:Int):String
 	public static function lookupHash(key:Int):String
 	{
 	{
 		//start of binary search algorithm
 		//start of binary search algorithm
 		var ids = fieldIds;
 		var ids = fieldIds;
 		var min = 0;
 		var min = 0;
 		var max = ids.length;
 		var max = ids.length;
-		
+
 		while (min < max)
 		while (min < max)
 		{
 		{
 			var mid = min + Std.int((max - min) / 2);
 			var mid = min + Std.int((max - min) / 2);
@@ -63,18 +63,18 @@ package cs.internal;
 		//if not found, it's definately an error
 		//if not found, it's definately an error
 		throw "Field not found for hash " + key;
 		throw "Field not found for hash " + key;
 	}
 	}
-	
+
 	public static function hash(s:String):Int
 	public static function hash(s:String):Int
 	{
 	{
 		if (s == null) return 0;
 		if (s == null) return 0;
-		
+
 		var key = doHash(s);
 		var key = doHash(s);
-		
+
 		//start of binary search algorithm
 		//start of binary search algorithm
 		var ids = fieldIds;
 		var ids = fieldIds;
 		var min = 0;
 		var min = 0;
 		var max = ids.length;
 		var max = ids.length;
-		
+
 		while (min < max)
 		while (min < max)
 		{
 		{
 			var mid = Std.int(min + (max - min) / 2); //overflow safe
 			var mid = Std.int(min + (max - min) / 2); //overflow safe
@@ -96,12 +96,12 @@ package cs.internal;
 		fields.insert(min, s);
 		fields.insert(min, s);
 		return key;
 		return key;
 	}
 	}
-	
+
 	public static function findHash(hash:Int, hashs:Array<Int>):Int
 	public static function findHash(hash:Int, hashs:Array<Int>):Int
 	{
 	{
 		var min = 0;
 		var min = 0;
 		var max = hashs.length;
 		var max = hashs.length;
-		
+
 		while (min < max)
 		while (min < max)
 		{
 		{
 			var mid = Std.int((max + min) / 2); //overflow safe
 			var mid = Std.int((max + min) / 2); //overflow safe
@@ -118,5 +118,5 @@ package cs.internal;
 		//if not found, return a negative value of where it should be inserted
 		//if not found, return a negative value of where it should be inserted
 		return ~min;
 		return ~min;
 	}
 	}
-	
+
 }
 }

+ 5 - 5
std/cs/internal/Iterator.hx

@@ -23,16 +23,16 @@ package cs.internal;
 
 
 @:keep @:native('haxe.lang.Iterator') interface Iterator<T>
 @:keep @:native('haxe.lang.Iterator') interface Iterator<T>
 {
 {
-	
+
 	public function hasNext():Bool;
 	public function hasNext():Bool;
-	
+
 	public function next():T;
 	public function next():T;
-	
+
 }
 }
 
 
 @:keep @:native('haxe.lang.Iterable') interface Iterable<T>
 @:keep @:native('haxe.lang.Iterable') interface Iterable<T>
 {
 {
-	
+
 	public function iterator():Iterator<T>;
 	public function iterator():Iterator<T>;
-	
+
 }
 }

+ 11 - 11
std/cs/io/NativeInput.hx

@@ -29,22 +29,22 @@ import haxe.io.Input;
 class NativeInput extends Input
 class NativeInput extends Input
 {
 {
 	public var canSeek(get_canSeek, null):Bool;
 	public var canSeek(get_canSeek, null):Bool;
-	
+
 	var stream:cs.system.io.Stream;
 	var stream:cs.system.io.Stream;
 	public function new(stream)
 	public function new(stream)
 	{
 	{
 		this.stream = stream;
 		this.stream = stream;
 		if (!stream.CanRead) throw "Write-only stream";
 		if (!stream.CanRead) throw "Write-only stream";
 	}
 	}
-	
-	override public function readByte():Int 
+
+	override public function readByte():Int
 	{
 	{
 		var ret = stream.ReadByte();
 		var ret = stream.ReadByte();
 		if (ret == -1) throw new Eof();
 		if (ret == -1) throw new Eof();
 		return ret;
 		return ret;
 	}
 	}
-	
-	override public function readBytes(s:Bytes, pos:Int, len:Int):Int 
+
+	override public function readBytes(s:Bytes, pos:Int, len:Int):Int
 	{
 	{
 		if( pos < 0 || len < 0 || pos + len > s.length )
 		if( pos < 0 || len < 0 || pos + len > s.length )
 			throw Error.OutsideBounds;
 			throw Error.OutsideBounds;
@@ -53,17 +53,17 @@ class NativeInput extends Input
 			throw new Eof();
 			throw new Eof();
 		return ret;
 		return ret;
 	}
 	}
-	
+
 	override public function close():Void
 	override public function close():Void
 	{
 	{
 		stream.Close();
 		stream.Close();
 	}
 	}
-	
+
 	private function get_canSeek():Bool
 	private function get_canSeek():Bool
 	{
 	{
 		return stream.CanSeek;
 		return stream.CanSeek;
 	}
 	}
-	
+
 	public function seek( p : Int, pos : sys.io.FileSeek ) : Void
 	public function seek( p : Int, pos : sys.io.FileSeek ) : Void
 	{
 	{
 		var p = switch(pos)
 		var p = switch(pos)
@@ -72,15 +72,15 @@ class NativeInput extends Input
 			case SeekCur: cs.system.io.SeekOrigin.Current;
 			case SeekCur: cs.system.io.SeekOrigin.Current;
 			case SeekEnd: cs.system.io.SeekOrigin.End;
 			case SeekEnd: cs.system.io.SeekOrigin.End;
 		};
 		};
-		
+
 		stream.Seek(cast(p, Int64), p);
 		stream.Seek(cast(p, Int64), p);
 	}
 	}
-	
+
 	public function tell() : Int
 	public function tell() : Int
 	{
 	{
 		return cast(stream.Position, Int);
 		return cast(stream.Position, Int);
 	}
 	}
-	
+
 	public function eof() : Bool
 	public function eof() : Bool
 	{
 	{
 		return stream.Position == stream.Length;
 		return stream.Position == stream.Length;

+ 1 - 1
std/flash/Lib.hx

@@ -73,7 +73,7 @@ class Lib {
 	public inline static function as<T>( v : Dynamic, c : Class<T> ) : Null<T> {
 	public inline static function as<T>( v : Dynamic, c : Class<T> ) : Null<T> {
 		return untyped __as__(v,c);
 		return untyped __as__(v,c);
 	}
 	}
-	
+
 	public static function redirectTraces() {
 	public static function redirectTraces() {
 		if (flash.external.ExternalInterface.available)
 		if (flash.external.ExternalInterface.available)
 			haxe.Log.trace = traceToConsole;
 			haxe.Log.trace = traceToConsole;

+ 1 - 1
std/flash/_std/Reflect.hx

@@ -102,7 +102,7 @@
 		}
 		}
 		return (t == "string");
 		return (t == "string");
 	}
 	}
-	
+
 	public static function isEnumValue( v : Dynamic ) : Bool {
 	public static function isEnumValue( v : Dynamic ) : Bool {
 		#if as3
 		#if as3
 		return try Type.getEnum(v) != null catch ( e: Dynamic) false;
 		return try Type.getEnum(v) != null catch ( e: Dynamic) false;

+ 1 - 1
std/flash/_std/Xml.hx

@@ -384,7 +384,7 @@ extern enum XmlType {
 		if( nodeType != Xml.Element && nodeType != Xml.Document )
 		if( nodeType != Xml.Element && nodeType != Xml.Document )
 			throw "bad nodeType";
 			throw "bad nodeType";
 		if (x.parent != null)
 		if (x.parent != null)
-			x.parent.removeChild(x);			
+			x.parent.removeChild(x);
 		var children:XMLList = _node.children();
 		var children:XMLList = _node.children();
 		if( pos < children.length() )
 		if( pos < children.length() )
 			_node.insertChildBefore(children[pos], x._node);
 			_node.insertChildBefore(children[pos], x._node);

+ 4 - 4
std/flash/_std/haxe/ds/ObjectMap.hx

@@ -6,7 +6,7 @@ class ObjectMap<K:{},V> extends flash.utils.Dictionary implements Map.IMap<K,V>
 	public function new() {
 	public function new() {
 		super(false);
 		super(false);
 	}
 	}
-	
+
 	public inline function get( key : K ) : Null<V> {
 	public inline function get( key : K ) : Null<V> {
 		return untyped this[key];
 		return untyped this[key];
 	}
 	}
@@ -26,7 +26,7 @@ class ObjectMap<K:{},V> extends flash.utils.Dictionary implements Map.IMap<K,V>
 	}
 	}
 
 
 	#if as3
 	#if as3
-	
+
  	public function keys() : Iterator<K> {
  	public function keys() : Iterator<K> {
 		return untyped __keys__(this).iterator();
 		return untyped __keys__(this).iterator();
  	}
  	}
@@ -38,7 +38,7 @@ class ObjectMap<K:{},V> extends flash.utils.Dictionary implements Map.IMap<K,V>
 		return ret.iterator();
 		return ret.iterator();
  	}
  	}
 	#else
 	#else
-	
+
 	public function keys() : Iterator<K> {
 	public function keys() : Iterator<K> {
 		return NativePropertyIterator.iterator(this);
 		return NativePropertyIterator.iterator(this);
 	}
 	}
@@ -46,7 +46,7 @@ class ObjectMap<K:{},V> extends flash.utils.Dictionary implements Map.IMap<K,V>
 	public function iterator() : Iterator<V> {
 	public function iterator() : Iterator<V> {
 		return NativeValueIterator.iterator(this);
 		return NativeValueIterator.iterator(this);
 	}
 	}
-	
+
 	#end
 	#end
 
 
 	public function toString() : String {
 	public function toString() : String {

+ 4 - 4
std/flash/_std/haxe/ds/WeakMap.hx

@@ -6,7 +6,7 @@ class WeakMap<K:{},V> extends flash.utils.Dictionary implements Map.IMap<K,V> {
 	public function new() {
 	public function new() {
 		super(true);
 		super(true);
 	}
 	}
-	
+
 	public inline function get( key : K ) : Null<V> {
 	public inline function get( key : K ) : Null<V> {
 		return untyped this[key];
 		return untyped this[key];
 	}
 	}
@@ -26,7 +26,7 @@ class WeakMap<K:{},V> extends flash.utils.Dictionary implements Map.IMap<K,V> {
 	}
 	}
 
 
 	#if as3
 	#if as3
-	
+
  	public function keys() : Iterator<K> {
  	public function keys() : Iterator<K> {
 		return untyped __keys__(this).iterator();
 		return untyped __keys__(this).iterator();
  	}
  	}
@@ -38,7 +38,7 @@ class WeakMap<K:{},V> extends flash.utils.Dictionary implements Map.IMap<K,V> {
 		return ret.iterator();
 		return ret.iterator();
  	}
  	}
 	#else
 	#else
-	
+
 	public function keys() : Iterator<K> {
 	public function keys() : Iterator<K> {
 		return NativePropertyIterator.iterator(this);
 		return NativePropertyIterator.iterator(this);
 	}
 	}
@@ -46,7 +46,7 @@ class WeakMap<K:{},V> extends flash.utils.Dictionary implements Map.IMap<K,V> {
 	public function iterator() : Iterator<V> {
 	public function iterator() : Iterator<V> {
 		return NativeValueIterator.iterator(this);
 		return NativeValueIterator.iterator(this);
 	}
 	}
-	
+
 	#end
 	#end
 
 
 	public function toString() : String {
 	public function toString() : String {

+ 1 - 1
std/flash/_std/haxe/zip/Compress.hx

@@ -38,7 +38,7 @@ class Compress {
 	public function close() : Void {
 	public function close() : Void {
 	}
 	}
 
 
-	public static function run( s : haxe.io.Bytes, level : Int ) : haxe.io.Bytes {		
+	public static function run( s : haxe.io.Bytes, level : Int ) : haxe.io.Bytes {
 		if( s.length == 0 ) {
 		if( s.length == 0 ) {
 			// Flash returns 0 bytes for 0 length compress (which can't be decoded on other platforms...)
 			// Flash returns 0 bytes for 0 length compress (which can't be decoded on other platforms...)
 			var b = haxe.io.Bytes.alloc(8);
 			var b = haxe.io.Bytes.alloc(8);

+ 1 - 1
std/flash8/_std/Reflect.hx

@@ -92,7 +92,7 @@
 		var t = __typeof__(v);
 		var t = __typeof__(v);
 		return (t == "string" || (t == "object" && v.__enum__ == null) || (t == "function" && v.__name__ != null));
 		return (t == "string" || (t == "object" && v.__enum__ == null) || (t == "function" && v.__name__ != null));
 	}
 	}
-	
+
 	public static function isEnumValue( v : Dynamic ) : Bool {
 	public static function isEnumValue( v : Dynamic ) : Bool {
 		return v.__enum__ != null;
 		return v.__enum__ != null;
 	}
 	}

+ 1 - 1
std/flash8/_std/Std.hx

@@ -29,7 +29,7 @@
 	public static function instance<T:{},S:T>( value : T, c : Class<S> ) : S {
 	public static function instance<T:{},S:T>( value : T, c : Class<S> ) : S {
 		return Std.is(value, c) ? cast value : null;
 		return Std.is(value, c) ? cast value : null;
 	}
 	}
-	
+
 	public static function string( s : Dynamic ) : String {
 	public static function string( s : Dynamic ) : String {
 		return untyped flash.Boot.__string_rec(s,"");
 		return untyped flash.Boot.__string_rec(s,"");
 	}
 	}

+ 12 - 12
std/flash8/_std/haxe/ds/ObjectMap.hx

@@ -24,38 +24,38 @@ package haxe.ds;
 
 
 @:coreApi
 @:coreApi
 class ObjectMap <K:{ }, V> implements Map.IMap<K,V> {
 class ObjectMap <K:{ }, V> implements Map.IMap<K,V> {
-	
+
 	static var count = 0;
 	static var count = 0;
-	
+
 	static inline function assignId(obj: { } ):Int {
 	static inline function assignId(obj: { } ):Int {
 		return untyped obj.__id__ = ++count;
 		return untyped obj.__id__ = ++count;
 	}
 	}
-	
+
 	static inline function getId(obj: { } ):Int {
 	static inline function getId(obj: { } ):Int {
 		return untyped obj.__id__;
 		return untyped obj.__id__;
 	}
 	}
-	
+
 	var h: { };
 	var h: { };
-	
+
 	public function new():Void {
 	public function new():Void {
 		h = untyped __new__(_global["Object"]);
 		h = untyped __new__(_global["Object"]);
 		untyped h.__keys__ = untyped __new__(_global["Object"]);
 		untyped h.__keys__ = untyped __new__(_global["Object"]);
 	}
 	}
-	
+
 	public function set(key:K, value:V):Void untyped {
 	public function set(key:K, value:V):Void untyped {
 		var id = "$" + (key.__id__ != null ? key.__id__ : assignId(key));
 		var id = "$" + (key.__id__ != null ? key.__id__ : assignId(key));
 		h[id] = value;
 		h[id] = value;
 		h.__keys__[id] = key;
 		h.__keys__[id] = key;
 	}
 	}
-	
+
 	public inline function get(key:K):Null<V> {
 	public inline function get(key:K):Null<V> {
 		return untyped h["$" +getId(key)];
 		return untyped h["$" +getId(key)];
 	}
 	}
-	
+
 	public inline function exists(key:K):Bool {
 	public inline function exists(key:K):Bool {
 		return untyped h["hasOwnProperty"]("$" +getId(key));
 		return untyped h["hasOwnProperty"]("$" +getId(key));
 	}
 	}
-	
+
 	public function remove( key : K ) : Bool {
 	public function remove( key : K ) : Bool {
 		var key = "$" + getId(key);
 		var key = "$" + getId(key);
 		if( untyped !h["hasOwnProperty"](key) ) return false;
 		if( untyped !h["hasOwnProperty"](key) ) return false;
@@ -63,7 +63,7 @@ class ObjectMap <K:{ }, V> implements Map.IMap<K,V> {
 		untyped __delete__(h.__keys__,key);
 		untyped __delete__(h.__keys__,key);
 		return true;
 		return true;
 	}
 	}
-	
+
 	public function keys() : Iterator<K> {
 	public function keys() : Iterator<K> {
 		var a = [];
 		var a = [];
 		untyped {
 		untyped {
@@ -75,7 +75,7 @@ class ObjectMap <K:{ }, V> implements Map.IMap<K,V> {
 		}
 		}
 		return a.iterator();
 		return a.iterator();
 	}
 	}
-	
+
 	public function iterator() : Iterator<V> {
 	public function iterator() : Iterator<V> {
 		return untyped {
 		return untyped {
 			ref : h,
 			ref : h,
@@ -84,7 +84,7 @@ class ObjectMap <K:{ }, V> implements Map.IMap<K,V> {
 			next : function() { var i = __this__.it[__unprotect__("next")](); return __this__.ref["$" +i]; }
 			next : function() { var i = __this__.it[__unprotect__("next")](); return __this__.ref["$" +i]; }
 		};
 		};
 	}
 	}
-	
+
 	public function toString() : String {
 	public function toString() : String {
 		var s = new StringBuf();
 		var s = new StringBuf();
 		s.add("{");
 		s.add("{");

+ 23 - 1
std/haxe/CallStack.hx

@@ -99,6 +99,8 @@ class CallStack {
 			stack.shift();
 			stack.shift();
 			stack.pop();
 			stack.pop();
 			return stack;
 			return stack;
+		#elseif cs
+			return makeStack(new cs.system.diagnostics.StackTrace(1, true));
 		#else
 		#else
 			return []; // Unsupported
 			return []; // Unsupported
 		#end
 		#end
@@ -155,6 +157,8 @@ class CallStack {
 			stack.shift();
 			stack.shift();
 			stack.pop();
 			stack.pop();
 			return stack;
 			return stack;
+		#elseif cs
+			return makeStack(new cs.system.diagnostics.StackTrace(cs.internal.Exceptions.exception, true));
 		#else
 		#else
 			return []; // Unsupported
 			return []; // Unsupported
 		#end
 		#end
@@ -199,7 +203,7 @@ class CallStack {
 	}
 	}
 
 
 	#if cpp @:noStack #end /* Do not mess up the exception stack */
 	#if cpp @:noStack #end /* Do not mess up the exception stack */
-	private static function makeStack(s) {
+	private static function makeStack(s #if cs : cs.system.diagnostics.StackTrace #end) {
 		#if neko
 		#if neko
 			var a = new Array();
 			var a = new Array();
 			var l = untyped __dollar__asize(s);
 			var l = untyped __dollar__asize(s);
@@ -278,6 +282,24 @@ class CallStack {
 			} else {
 			} else {
 				return cast s;
 				return cast s;
 			}
 			}
+		#elseif cs
+			var stack = [];
+			for (i in 0...s.FrameCount)
+			{
+				var frame = s.GetFrame(i);
+				var m = frame.GetMethod();
+
+				var method = StackItem.Method(m.ReflectedType.ToString(), m.Name);
+
+				var fileName = frame.GetFileName();
+				var lineNumber = frame.GetFileLineNumber();
+
+				if (fileName != null || lineNumber >= 0)
+					stack.push(FilePos(method, fileName, lineNumber));
+				else
+					stack.push(method);
+			}
+			return stack;
 		#else
 		#else
 			return null;
 			return null;
 		#end
 		#end

+ 2 - 2
std/haxe/Constraints.hx

@@ -24,7 +24,7 @@ package haxe;
 
 
 /**
 /**
 	This type unifies with any function type.
 	This type unifies with any function type.
-	
+
 	It is intended to be used as a type parameter constraint. If used as a real
 	It is intended to be used as a type parameter constraint. If used as a real
 	type, the underlying type will be `Dynamic`.
 	type, the underlying type will be `Dynamic`.
 **/
 **/
@@ -33,7 +33,7 @@ abstract Function(Dynamic) { }
 /**
 /**
 	This type unifies with an enum instance if all constructors of the enum
 	This type unifies with an enum instance if all constructors of the enum
 	require no arguments.
 	require no arguments.
-	
+
 	It is intended to be used as a type parameter constraint. If used as a real
 	It is intended to be used as a type parameter constraint. If used as a real
 	type, the underlying type will be `Dynamic`.
 	type, the underlying type will be `Dynamic`.
 **/
 **/

+ 7 - 7
std/haxe/EnumFlags.hx

@@ -25,7 +25,7 @@ package haxe;
 	A typed interface for bit flags. This is not a real object, only a typed
 	A typed interface for bit flags. This is not a real object, only a typed
 	interface for an actual Int. Each flag can be tested/set with the
 	interface for an actual Int. Each flag can be tested/set with the
 	corresponding enum instance. Up to 32 flags can be stored that way.
 	corresponding enum instance. Up to 32 flags can be stored that way.
-	
+
 	Enum constructor indices are preserved from haxe syntax, so the first
 	Enum constructor indices are preserved from haxe syntax, so the first
 	declared is index 0, the next index 1 etc. The methods are optimized if the
 	declared is index 0, the next index 1 etc. The methods are optimized if the
 	enum instance is passed directly, e.g. as has(EnumCtor). Otherwise
 	enum instance is passed directly, e.g. as has(EnumCtor). Otherwise
@@ -42,10 +42,10 @@ abstract EnumFlags<T:EnumValue>(Int) {
 
 
 	/**
 	/**
 		Checks if the index of enum instance `v` is set.
 		Checks if the index of enum instance `v` is set.
-		
+
 		This method is optimized if `v` is an enum instance expression such as
 		This method is optimized if `v` is an enum instance expression such as
 		SomeEnum.SomeCtor.
 		SomeEnum.SomeCtor.
-		
+
 		If `v` is null, the result is unspecified.
 		If `v` is null, the result is unspecified.
 	**/
 	**/
 	public inline function has( v : T ) : Bool {
 	public inline function has( v : T ) : Bool {
@@ -54,10 +54,10 @@ abstract EnumFlags<T:EnumValue>(Int) {
 
 
 	/**
 	/**
 		Sets the index of enum instance `v`.
 		Sets the index of enum instance `v`.
-		
+
 		This method is optimized if `v` is an enum instance expression such as
 		This method is optimized if `v` is an enum instance expression such as
 		SomeEnum.SomeCtor.
 		SomeEnum.SomeCtor.
-		
+
 		If `v` is null, the result is unspecified.
 		If `v` is null, the result is unspecified.
 	**/
 	**/
 	public inline function set( v : T ) : Void {
 	public inline function set( v : T ) : Void {
@@ -66,10 +66,10 @@ abstract EnumFlags<T:EnumValue>(Int) {
 
 
 	/**
 	/**
 		Unsets the index of enum instance `v`.
 		Unsets the index of enum instance `v`.
-		
+
 		This method is optimized if `v` is an enum instance expression such as
 		This method is optimized if `v` is an enum instance expression such as
 		SomeEnum.SomeCtor.
 		SomeEnum.SomeCtor.
-		
+
 		If `v` is null, the result is unspecified.
 		If `v` is null, the result is unspecified.
 	**/
 	**/
 	public inline function unset( v : T ) : Void {
 	public inline function unset( v : T ) : Void {

+ 29 - 29
std/haxe/EnumTools.hx

@@ -25,27 +25,27 @@ package haxe;
 extern class EnumTools {
 extern class EnumTools {
 	/**
 	/**
 		Returns the name of enum `e`, including its path.
 		Returns the name of enum `e`, including its path.
-		
+
 		If `e` is inside a package, the package structure is returned dot-
 		If `e` is inside a package, the package structure is returned dot-
 		separated, with another dot separating the enum name:
 		separated, with another dot separating the enum name:
 			pack1.pack2.(...).packN.EnumName
 			pack1.pack2.(...).packN.EnumName
 		If `e` is a sub-type of a haxe module, that module is not part of the
 		If `e` is a sub-type of a haxe module, that module is not part of the
 		package structure.
 		package structure.
-			
+
 		If `e` has no package, the enum name is returned.
 		If `e` has no package, the enum name is returned.
-		
+
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
-		
+
 		The enum name does not include any type parameters.
 		The enum name does not include any type parameters.
 	**/
 	**/
 	static public inline function getName<T>(e:Enum<T>):String {
 	static public inline function getName<T>(e:Enum<T>):String {
 		return Type.getEnumName(e);
 		return Type.getEnumName(e);
 	}
 	}
-		
+
 	/**
 	/**
 		Creates an instance of enum `e` by calling its constructor `constr` with
 		Creates an instance of enum `e` by calling its constructor `constr` with
 		arguments `params`.
 		arguments `params`.
-		
+
 		If `e` or `constr` is null, or if enum `e` has no constructor named
 		If `e` or `constr` is null, or if enum `e` has no constructor named
 		`constr`, or if the number of elements in `params` does not match the
 		`constr`, or if the number of elements in `params` does not match the
 		expected number of constructor arguments, or if any argument has an
 		expected number of constructor arguments, or if any argument has an
@@ -54,14 +54,14 @@ extern class EnumTools {
 	static public inline function createByName<T>(e:Enum<T>, constr:String, ?params:Array<Dynamic>):T {
 	static public inline function createByName<T>(e:Enum<T>, constr:String, ?params:Array<Dynamic>):T {
 		return Type.createEnum(e, constr, params);
 		return Type.createEnum(e, constr, params);
 	}
 	}
-	
+
 	/**
 	/**
 		Creates an instance of enum `e` by calling its constructor number
 		Creates an instance of enum `e` by calling its constructor number
 		`index` with arguments `params`.
 		`index` with arguments `params`.
-		
+
 		The constructor indices are preserved from haxe syntax, so the first
 		The constructor indices are preserved from haxe syntax, so the first
 		declared is index 0, the next index 1 etc.
 		declared is index 0, the next index 1 etc.
-		
+
 		If `e` or `constr` is null, or if enum `e` has no constructor named
 		If `e` or `constr` is null, or if enum `e` has no constructor named
 		`constr`, or if the number of elements in `params` does not match the
 		`constr`, or if the number of elements in `params` does not match the
 		expected number of constructor arguments, or if any argument has an
 		expected number of constructor arguments, or if any argument has an
@@ -70,30 +70,30 @@ extern class EnumTools {
 	static public inline function createByIndex<T>(e:Enum<T>, index:Int, ?params:Array<Dynamic>):T {
 	static public inline function createByIndex<T>(e:Enum<T>, index:Int, ?params:Array<Dynamic>):T {
 		return Type.createEnumIndex(e, index, params);
 		return Type.createEnumIndex(e, index, params);
 	}
 	}
-		
+
 	/**
 	/**
 		Returns a list of all constructors of enum `e` that require no
 		Returns a list of all constructors of enum `e` that require no
 		arguments.
 		arguments.
-		
+
 		This may return the empty Array [] if all constructors of `e` require
 		This may return the empty Array [] if all constructors of `e` require
 		arguments.
 		arguments.
-		
+
 		Otherwise an instance of `e` constructed through each of its non-
 		Otherwise an instance of `e` constructed through each of its non-
 		argument constructors is returned, in the order of the constructor
 		argument constructors is returned, in the order of the constructor
 		declaration.
 		declaration.
-		
+
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
 	static public inline function createAll<T>(e:Enum<T>):Array<T> {
 	static public inline function createAll<T>(e:Enum<T>):Array<T> {
 		return Type.allEnums(e);
 		return Type.allEnums(e);
 	}
 	}
-		
+
 	/**
 	/**
 		Returns a list of the names of all constructors of enum `e`.
 		Returns a list of the names of all constructors of enum `e`.
-		
+
 		The order of the constructor names in the returned Array is preserved
 		The order of the constructor names in the returned Array is preserved
 		from the original syntax.
 		from the original syntax.
-		
+
 		If `c` is null, the result is unspecified.
 		If `c` is null, the result is unspecified.
 	**/
 	**/
 	static public inline function getConstructors<T>(e:Enum<T>):Array<String> {
 	static public inline function getConstructors<T>(e:Enum<T>):Array<String> {
@@ -102,50 +102,50 @@ extern class EnumTools {
 }
 }
 
 
 extern class EnumValueTools {
 extern class EnumValueTools {
-	
+
 	/**
 	/**
 		Recursively compares two enum instances `a` and `b` by value.
 		Recursively compares two enum instances `a` and `b` by value.
-		
+
 		Unlike `a == b`, this function performs a deep equality check on the
 		Unlike `a == b`, this function performs a deep equality check on the
 		arguments of the constructors, if exists.
 		arguments of the constructors, if exists.
-		
+
 		If `a` or `b` are null, the result is unspecified.
 		If `a` or `b` are null, the result is unspecified.
 	**/
 	**/
 	static public inline function equals<T:EnumValue>(a:T, b:T):Bool {
 	static public inline function equals<T:EnumValue>(a:T, b:T):Bool {
 		return Type.enumEq(a, b);
 		return Type.enumEq(a, b);
 	}
 	}
-		
+
 	/**
 	/**
 		Returns the constructor name of enum instance `e`.
 		Returns the constructor name of enum instance `e`.
-		
+
 		The result String does not contain any constructor arguments.
 		The result String does not contain any constructor arguments.
-		
+
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
 	static public inline function getName(e:EnumValue):String {
 	static public inline function getName(e:EnumValue):String {
 		return Type.enumConstructor(e);
 		return Type.enumConstructor(e);
 	}
 	}
-		
+
 	/**
 	/**
 		Returns a list of the constructor arguments of enum instance `e`.
 		Returns a list of the constructor arguments of enum instance `e`.
-		
+
 		If `e` has no arguments, the result is [].
 		If `e` has no arguments, the result is [].
-		
+
 		Otherwise the result are the values that were used as arguments to `e`,
 		Otherwise the result are the values that were used as arguments to `e`,
 		in the order of their declaration.
 		in the order of their declaration.
-		
+
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
 	static public inline function getParameters(e:EnumValue):Array<Dynamic> {
 	static public inline function getParameters(e:EnumValue):Array<Dynamic> {
 		return Type.enumParameters(e);
 		return Type.enumParameters(e);
 	}
 	}
-		
+
 	/**
 	/**
 		Returns the index of enum instance `e`.
 		Returns the index of enum instance `e`.
-		
+
 		This corresponds to the original syntactic position of `e`. The index of
 		This corresponds to the original syntactic position of `e`. The index of
 		the first declared constructor is 0, the next one is 1 etc.
 		the first declared constructor is 0, the next one is 1 etc.
-		
+
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
 	static public inline function getIndex(e:EnumValue):Int {
 	static public inline function getIndex(e:EnumValue):Int {

+ 6 - 6
std/haxe/Http.hx

@@ -41,7 +41,7 @@ private typedef AbstractSocket = {
 /**
 /**
 	This class can be used to handle Http requests consistently across
 	This class can be used to handle Http requests consistently across
 	platforms. There are two intended usages:
 	platforms. There are two intended usages:
-	
+
 	- call haxe.Http.requestUrl(url) and receive the result as a String (not
 	- call haxe.Http.requestUrl(url) and receive the result as a String (not
 	available on flash)
 	available on flash)
 	- create a new haxe.Http(url), register your callbacks for onData, onError
 	- create a new haxe.Http(url), register your callbacks for onData, onError
@@ -89,7 +89,7 @@ class Http {
 		this.url = url;
 		this.url = url;
 		headers = new List<{ header:String, value:String }>();
 		headers = new List<{ header:String, value:String }>();
 		params = new List<{ param:String, value:String }>();
 		params = new List<{ param:String, value:String }>();
-		
+
 		#if js
 		#if js
 		async = true;
 		async = true;
 		#elseif sys
 		#elseif sys
@@ -117,7 +117,7 @@ class Http {
 		headers.push({ header:header, value:value });
 		headers.push({ header:header, value:value });
 		return this;
 		return this;
 	}
 	}
-	
+
 	/**
 	/**
 		Sets the parameter identified as `param` to value `value`.
 		Sets the parameter identified as `param` to value `value`.
 
 
@@ -135,7 +135,7 @@ class Http {
 		params.push({ param:param, value:value });
 		params.push({ param:param, value:value });
 		return this;
 		return this;
 	}
 	}
-	
+
 	#if !flash8
 	#if !flash8
 	/**
 	/**
 		Sets the post data of `this` Http request to `data`.
 		Sets the post data of `this` Http request to `data`.
@@ -160,9 +160,9 @@ class Http {
 	#elseif flash9
 	#elseif flash9
 	var req:flash.net.URLLoader;
 	var req:flash.net.URLLoader;
 	#end
 	#end
-	
+
 	/**
 	/**
-		Cancels `this` Http request if `request` has been called and a response 
+		Cancels `this` Http request if `request` has been called and a response
 		has not yet been received.
 		has not yet been received.
 	**/
 	**/
 	public function cancel()
 	public function cancel()

+ 28 - 28
std/haxe/Int64.hx

@@ -21,7 +21,7 @@
  */
  */
 package haxe;
 package haxe;
 
 
-class Int64 { 
+class Int64 {
 
 
 	var high : Int;
 	var high : Int;
 	var low : Int;
 	var low : Int;
@@ -33,10 +33,10 @@ class Int64 {
 
 
 	#if php
 	#if php
 	/*
 	/*
-		private function to correctly handle 32-bit integer overflow on php 
+		private function to correctly handle 32-bit integer overflow on php
 		see: http://stackoverflow.com/questions/300840/force-php-integer-overflow
 		see: http://stackoverflow.com/questions/300840/force-php-integer-overflow
 	*/
 	*/
-	private static function i32php(value:Int):Int { 
+	private static function i32php(value:Int):Int {
 			value = (value & untyped __php__("0xFFFFFFFF"));
 			value = (value & untyped __php__("0xFFFFFFFF"));
  		    if ( (value & untyped __php__("0x80000000"))!=0 )
  		    if ( (value & untyped __php__("0x80000000"))!=0 )
 		        value = -(((~value) & untyped __php__("0xFFFFFFFF")) + 1);
 		        value = -(((~value) & untyped __php__("0xFFFFFFFF")) + 1);
@@ -48,7 +48,7 @@ class Int64 {
 		private function to correctly handle 32-bit ushr on php
 		private function to correctly handle 32-bit ushr on php
 		see: https://github.com/HaxeFoundation/haxe/commit/1a878aa90708040a41b0dd59f518d83b09ede209
 		see: https://github.com/HaxeFoundation/haxe/commit/1a878aa90708040a41b0dd59f518d83b09ede209
 	*/
 	*/
-	private static inline function ushr32(v:Int,n:Int):Int { 
+	private static inline function ushr32(v:Int,n:Int):Int {
 		#if php
 		#if php
 		 	return (v >> n) & (untyped __php__("0x7fffffff") >> (n-1));
 		 	return (v >> n) & (untyped __php__("0x7fffffff") >> (n-1));
 		#else
 		#else
@@ -60,7 +60,7 @@ class Int64 {
 		#if (js || flash8)
 		#if (js || flash8)
 			return i | 0;
 			return i | 0;
 		#elseif php
 		#elseif php
-			return i32php(i); // handle overflow of 32-bit integers correctly 
+			return i32php(i); // handle overflow of 32-bit integers correctly
 		#else
 		#else
 			return i;
 			return i;
 		#end
 		#end
@@ -76,7 +76,7 @@ class Int64 {
 		return a * b;
 		return a * b;
 		#end
 		#end
 	}
 	}
-	
+
 	#if as3 public #end function toString() {
 	#if as3 public #end function toString() {
 		if ((high|low) == 0 )
 		if ((high|low) == 0 )
 			return "0";
 			return "0";
@@ -90,15 +90,15 @@ class Int64 {
 		var ten = ofInt(10);
 		var ten = ofInt(10);
 		while( !isZero(i) ) {
 		while( !isZero(i) ) {
 			var r = divMod(i, ten);
 			var r = divMod(i, ten);
-			str = r.modulus.low + str; 
-			i = r.quotient; 
+			str = r.modulus.low + str;
+			i = r.quotient;
 		}
 		}
 		if( neg ) str = "-" + str;
 		if( neg ) str = "-" + str;
 		return str;
 		return str;
 	}
 	}
 
 
 	public static inline function make( high : Int, low : Int ) : Int64 {
 	public static inline function make( high : Int, low : Int ) : Int64 {
-		return new Int64(high, low); 
+		return new Int64(high, low);
 	}
 	}
 
 
 	public static inline function ofInt( x : Int ) : Int64 {
 	public static inline function ofInt( x : Int ) : Int64 {
@@ -111,7 +111,7 @@ class Int64 {
 				return -toInt(neg(x));
 				return -toInt(neg(x));
 			throw "Overflow";
 			throw "Overflow";
 		}
 		}
-		return x.low; 
+		return x.low;
 	}
 	}
 
 
 	public static function getLow( x : Int64 ) : Int {
 	public static function getLow( x : Int64 ) : Int {
@@ -140,8 +140,8 @@ class Int64 {
 
 
 	public static function mul( a : Int64, b : Int64 ) : Int64 {
 	public static function mul( a : Int64, b : Int64 ) : Int64 {
 		var mask = 0xFFFF;
 		var mask = 0xFFFF;
-		var al = a.low & mask, ah = ushr32(a.low , 16); 
-		var bl = b.low & mask, bh = ushr32(b.low , 16); 
+		var al = a.low & mask, ah = ushr32(a.low , 16);
+		var bl = b.low & mask, bh = ushr32(b.low , 16);
 		var p00 = al * bl;
 		var p00 = al * bl;
 		var p10 = ah * bl;
 		var p10 = ah * bl;
 		var p01 = al * bh;
 		var p01 = al * bh;
@@ -159,35 +159,35 @@ class Int64 {
 		var quotient = new Int64(0, 0);
 		var quotient = new Int64(0, 0);
 		var mask = new Int64(0, 1);
 		var mask = new Int64(0, 1);
 		divisor = new Int64(divisor.high, divisor.low);
 		divisor = new Int64(divisor.high, divisor.low);
-		while( divisor.high >= 0 ) { 
+		while( divisor.high >= 0 ) {
 			var cmp = ucompare(divisor, modulus);
 			var cmp = ucompare(divisor, modulus);
-			divisor.high = i32( i32(divisor.high << 1) | ushr32(divisor.low , 31) ); 
-			divisor.low = i32(divisor.low << 1); 
-			mask.high = i32( i32(mask.high << 1) | ushr32(mask.low , 31) ); 
+			divisor.high = i32( i32(divisor.high << 1) | ushr32(divisor.low , 31) );
+			divisor.low = i32(divisor.low << 1);
+			mask.high = i32( i32(mask.high << 1) | ushr32(mask.low , 31) );
 			mask.low = i32(mask.low << 1);
 			mask.low = i32(mask.low << 1);
 			if( cmp >= 0 ) break;
 			if( cmp >= 0 ) break;
 		}
 		}
-		while( i32(mask.low | mask.high) != 0 ) { 
+		while( i32(mask.low | mask.high) != 0 ) {
 			if( ucompare(modulus, divisor) >= 0 ) {
 			if( ucompare(modulus, divisor) >= 0 ) {
-				quotient.high= i32(quotient.high | mask.high); 
-				quotient.low= i32(quotient.low | mask.low); 
+				quotient.high= i32(quotient.high | mask.high);
+				quotient.low= i32(quotient.low | mask.low);
 				modulus = sub(modulus,divisor);
 				modulus = sub(modulus,divisor);
 			}
 			}
-			mask.low = i32( ushr32(mask.low , 1) | i32(mask.high << 31) ); 
-			mask.high = ushr32(mask.high , 1); 
+			mask.low = i32( ushr32(mask.low , 1) | i32(mask.high << 31) );
+			mask.high = ushr32(mask.high , 1);
 
 
-			divisor.low = i32( ushr32(divisor.low , 1) | i32(divisor.high << 31) ); 
-			divisor.high = ushr32(divisor.high , 1); 
+			divisor.low = i32( ushr32(divisor.low , 1) | i32(divisor.high << 31) );
+			divisor.high = ushr32(divisor.high , 1);
 		}
 		}
 		return { quotient : quotient, modulus : modulus };
 		return { quotient : quotient, modulus : modulus };
 	}
 	}
 
 
-	public static function div( a : Int64, b : Int64 ) : Int64 { 
+	public static function div( a : Int64, b : Int64 ) : Int64 {
 		if(b.high==0) // handle special cases of 0 and 1
 		if(b.high==0) // handle special cases of 0 and 1
 			switch(b.low) {
 			switch(b.low) {
 			case 0:	throw "divide by zero";
 			case 0:	throw "divide by zero";
 			case 1: return new Int64(a.high,a.low);
 			case 1: return new Int64(a.high,a.low);
-			} 
+			}
 		var sign = ((a.high<0) || (b.high<0)) && (!( (a.high<0) && (b.high<0))); // make sure we get the correct sign
 		var sign = ((a.high<0) || (b.high<0)) && (!( (a.high<0) && (b.high<0))); // make sure we get the correct sign
 		if( a.high < 0 ) a = neg(a);
 		if( a.high < 0 ) a = neg(a);
 		if( b.high < 0 ) b = neg(b);
 		if( b.high < 0 ) b = neg(b);
@@ -233,8 +233,8 @@ class Int64 {
 	}
 	}
 
 
 	public static inline function neg( a : Int64 ) : Int64 {
 	public static inline function neg( a : Int64 ) : Int64 {
-		var high = i32(~a.high); 
-		var low = i32(-a.low); 
+		var high = i32(~a.high);
+		var low = i32(-a.low);
 		if( low == 0 )
 		if( low == 0 )
 			high++;
 			high++;
 		return new Int64(high,low);
 		return new Int64(high,low);
@@ -253,7 +253,7 @@ class Int64 {
 	}
 	}
 
 
 	public static inline function compare( a : Int64, b : Int64 ) : Int {
 	public static inline function compare( a : Int64, b : Int64 ) : Int {
-		var v = i32(a.high - b.high); 
+		var v = i32(a.high - b.high);
 		return if( v != 0 ) v else uicompare(a.low,b.low);
 		return if( v != 0 ) v else uicompare(a.low,b.low);
 	}
 	}
 
 

+ 1 - 1
std/haxe/Log.hx

@@ -68,7 +68,7 @@ class Log {
 				untyped __call__('_hx_trace', v + extra, infos);
 				untyped __call__('_hx_trace', v + extra, infos);
 			}
 			}
 			else
 			else
-				untyped __call__('_hx_trace', v, infos);		
+				untyped __call__('_hx_trace', v, infos);
 		#elseif cpp
 		#elseif cpp
 			if (infos!=null && infos.customParams!=null) {
 			if (infos!=null && infos.customParams!=null) {
 				var extra:String = "";
 				var extra:String = "";

+ 2 - 2
std/haxe/PosInfos.hx

@@ -24,11 +24,11 @@ package haxe;
 /**
 /**
 	PosInfos is a magic type which can be used to generate position information
 	PosInfos is a magic type which can be used to generate position information
 	into the output for debugging use.
 	into the output for debugging use.
-	
+
 	If a function has a final optional argument of this type, i.e.
 	If a function has a final optional argument of this type, i.e.
 	(..., ?pos:haxe.PosInfos), each call to that function which does not assign
 	(..., ?pos:haxe.PosInfos), each call to that function which does not assign
 	a value to that argument has its position added as call argument.
 	a value to that argument has its position added as call argument.
-	
+
 	This can be used to track positions of calls in e.g. a unit testing
 	This can be used to track positions of calls in e.g. a unit testing
 	framework.
 	framework.
 **/
 **/

+ 3 - 2
std/haxe/Serializer.hx

@@ -26,7 +26,7 @@ package haxe;
 	from which the Unserializer class can recreate the original representation.
 	from which the Unserializer class can recreate the original representation.
 
 
 	This class can be used in two ways:
 	This class can be used in two ways:
-	
+
 	- create a new Serializer() instance, call its serialize() method with
 	- create a new Serializer() instance, call its serialize() method with
 		any argument and finally retrieve the String representation from
 		any argument and finally retrieve the String representation from
 		toString()
 		toString()
@@ -413,7 +413,8 @@ class Serializer {
 			#elseif flash9
 			#elseif flash9
 			if( useEnumIndex ) {
 			if( useEnumIndex ) {
 				buf.add(":");
 				buf.add(":");
-				buf.add(v.index);
+				var i : Int = v.index;
+				buf.add(i);
 			} else
 			} else
 				serializeString(v.tag);
 				serializeString(v.tag);
 			buf.add(":");
 			buf.add(":");

+ 16 - 16
std/haxe/Timer.hx

@@ -24,14 +24,14 @@ package haxe;
 /**
 /**
 	The Timer class allows you to create asynchronous timers on platforms that
 	The Timer class allows you to create asynchronous timers on platforms that
 	support events.
 	support events.
-	
+
 	The intended usage is to create an instance of the Timer class with a given
 	The intended usage is to create an instance of the Timer class with a given
 	interval, set its run() method to a custom function to be invoked and
 	interval, set its run() method to a custom function to be invoked and
 	eventually call stop() to stop the Timer.
 	eventually call stop() to stop the Timer.
 
 
-	Note that a running Timer may or may not prevent the program to exit 
+	Note that a running Timer may or may not prevent the program to exit
 	automatically when main() returns.
 	automatically when main() returns.
-	
+
 	It is also possible to extend this class and override its run() method in
 	It is also possible to extend this class and override its run() method in
 	the child class.
 	the child class.
 **/
 **/
@@ -47,13 +47,13 @@ class Timer {
 
 
 	/**
 	/**
 		Creates a new timer that will run every `time_ms` milliseconds.
 		Creates a new timer that will run every `time_ms` milliseconds.
-		
+
 		After creating the Timer instance, it calls `this].run` repeatedly,
 		After creating the Timer instance, it calls `this].run` repeatedly,
 		with delays of `time_ms` milliseconds, until `this.stop` is called.
 		with delays of `time_ms` milliseconds, until `this.stop` is called.
-		
+
 		The first invocation occurs after `time_ms` milliseconds, not
 		The first invocation occurs after `time_ms` milliseconds, not
 		immediately.
 		immediately.
-		
+
 		The accuracy of this may be platform-dependent.
 		The accuracy of this may be platform-dependent.
 	**/
 	**/
 	public function new( time_ms : Int ){
 	public function new( time_ms : Int ){
@@ -74,10 +74,10 @@ class Timer {
 
 
 	/**
 	/**
 		Stops `this` Timer.
 		Stops `this` Timer.
-		
+
 		After calling this method, no additional invocations of `this.run`
 		After calling this method, no additional invocations of `this.run`
 		will occur.
 		will occur.
-		
+
 		It is not possible to restart `this` Timer once stopped.
 		It is not possible to restart `this` Timer once stopped.
 	**/
 	**/
 	public function stop() {
 	public function stop() {
@@ -101,12 +101,12 @@ class Timer {
 
 
 	/**
 	/**
 		This method is invoked repeatedly on `this` Timer.
 		This method is invoked repeatedly on `this` Timer.
-		
+
 		It can be overridden in a subclass, or rebound directly to a custom
 		It can be overridden in a subclass, or rebound directly to a custom
 		function:
 		function:
 			var timer = new haxe.Timer(1000); // 1000ms delay
 			var timer = new haxe.Timer(1000); // 1000ms delay
 			timer.run = function() { ... }
 			timer.run = function() { ... }
-			
+
 		Once bound, it can still be rebound to different functions until `this`
 		Once bound, it can still be rebound to different functions until `this`
 		Timer is stopped through a call to `this.stop`.
 		Timer is stopped through a call to `this.stop`.
 	**/
 	**/
@@ -116,11 +116,11 @@ class Timer {
 
 
 	/**
 	/**
 		Invokes `f` after `time_ms` milliseconds.
 		Invokes `f` after `time_ms` milliseconds.
-		
+
 		This is a convenience function for creating a new Timer instance with
 		This is a convenience function for creating a new Timer instance with
 		`time_ms` as argument, binding its run() method to `f` and then stopping
 		`time_ms` as argument, binding its run() method to `f` and then stopping
 		`this` Timer upon the first invocation.
 		`this` Timer upon the first invocation.
-		
+
 		If `f` is null, the result is unspecified.
 		If `f` is null, the result is unspecified.
 	**/
 	**/
 	public static function delay( f : Void -> Void, time_ms : Int ) {
 	public static function delay( f : Void -> Void, time_ms : Int ) {
@@ -136,13 +136,13 @@ class Timer {
 
 
 	/**
 	/**
 		Measures the time it takes to execute `f`, in seconds with fractions.
 		Measures the time it takes to execute `f`, in seconds with fractions.
-		
+
 		This is a convenience function for calculating the difference between
 		This is a convenience function for calculating the difference between
 		Timer.stamp() before and after the invocation of `f`.
 		Timer.stamp() before and after the invocation of `f`.
-		
+
 		The difference is passed as argument to Log.trace(), with "s" appended
 		The difference is passed as argument to Log.trace(), with "s" appended
 		to denote the unit. The optional `pos` argument is passed through.
 		to denote the unit. The optional `pos` argument is passed through.
-		
+
 		If `f` is null, the result is unspecified.
 		If `f` is null, the result is unspecified.
 	**/
 	**/
 	public static function measure<T>( f : Void -> T, ?pos : PosInfos ) : T {
 	public static function measure<T>( f : Void -> T, ?pos : PosInfos ) : T {
@@ -154,7 +154,7 @@ class Timer {
 
 
 	/**
 	/**
 		Returns a timestamp, in seconds with fractions.
 		Returns a timestamp, in seconds with fractions.
-		
+
 		The value itself might differ depending on platforms, only differences
 		The value itself might differ depending on platforms, only differences
 		between two values make sense.
 		between two values make sense.
 	**/
 	**/

+ 25 - 25
std/haxe/Ucs2.hx

@@ -40,10 +40,10 @@ abstract Ucs2(String) {
 	@:extern inline function get_length() {
 	@:extern inline function get_length() {
 		return this.length;
 		return this.length;
 	}
 	}
-	
+
 	/**
 	/**
 		Returns a Ucs2 where all characters of `this` Ucs2 are upper case.
 		Returns a Ucs2 where all characters of `this` Ucs2 are upper case.
-		
+
 		Affects the characters `a-z`. Other characters remain unchanged.
 		Affects the characters `a-z`. Other characters remain unchanged.
 	**/
 	**/
 	@:extern public inline function toUpperCase() : Ucs2 {
 	@:extern public inline function toUpperCase() : Ucs2 {
@@ -52,7 +52,7 @@ abstract Ucs2(String) {
 
 
 	/**
 	/**
 		Returns a Ucs2 where all characters of `this` Ucs2 are lower case.
 		Returns a Ucs2 where all characters of `this` Ucs2 are lower case.
-		
+
 		Affects the characters `A-Z`. Other characters remain unchanged.
 		Affects the characters `A-Z`. Other characters remain unchanged.
 	**/
 	**/
 	@:extern public inline function toLowerCase() : Ucs2 {
 	@:extern public inline function toLowerCase() : Ucs2 {
@@ -61,7 +61,7 @@ abstract Ucs2(String) {
 
 
 	/**
 	/**
 		Returns the character at position `index` of `this` Ucs2.
 		Returns the character at position `index` of `this` Ucs2.
-		
+
 		If `index` is negative or exceeds `this.length`, the empty Ucs2 ""
 		If `index` is negative or exceeds `this.length`, the empty Ucs2 ""
 		is returned.
 		is returned.
 	**/
 	**/
@@ -71,9 +71,9 @@ abstract Ucs2(String) {
 
 
 	/**
 	/**
 		Returns the character code at position `index` of `this` Ucs2.
 		Returns the character code at position `index` of `this` Ucs2.
-		
+
 		If `index` is negative or exceeds `this.length`, null is returned.
 		If `index` is negative or exceeds `this.length`, null is returned.
-		
+
 		To obtain the character code of a single character, "x".code can be used
 		To obtain the character code of a single character, "x".code can be used
 		instead to @:extern public inline the character code at compile time. Note that this
 		instead to @:extern public inline the character code at compile time. Note that this
 		only works on Ucs2 literals of length 1.
 		only works on Ucs2 literals of length 1.
@@ -85,12 +85,12 @@ abstract Ucs2(String) {
 	/**
 	/**
 		Returns the position of the leftmost occurence of `str` within `this`
 		Returns the position of the leftmost occurence of `str` within `this`
 		Ucs2.
 		Ucs2.
-		
+
 		If `startIndex` is given, the search is performed within the substring
 		If `startIndex` is given, the search is performed within the substring
 		of `this` Ucs2 starting from `startIndex`. Otherwise the search is
 		of `this` Ucs2 starting from `startIndex`. Otherwise the search is
 		performed within `this` Ucs2. In either case, the returned position
 		performed within `this` Ucs2. In either case, the returned position
 		is relative to the beginning of `this` Ucs2.
 		is relative to the beginning of `this` Ucs2.
-		
+
 		If `str` cannot be found, -1 is returned.
 		If `str` cannot be found, -1 is returned.
 	**/
 	**/
 	@:extern public inline function indexOf( str : Ucs2, ?startIndex : Int ) : Int {
 	@:extern public inline function indexOf( str : Ucs2, ?startIndex : Int ) : Int {
@@ -100,12 +100,12 @@ abstract Ucs2(String) {
 	/**
 	/**
 		Returns the position of the rightmost occurence of `str` within `this`
 		Returns the position of the rightmost occurence of `str` within `this`
 		Ucs2.
 		Ucs2.
-		
+
 		If `startIndex` is given, the search is performed within the substring
 		If `startIndex` is given, the search is performed within the substring
 		of `this` Ucs2 from 0 to `startIndex`. Otherwise the search is
 		of `this` Ucs2 from 0 to `startIndex`. Otherwise the search is
 		performed within `this` Ucs2. In either case, the returned position
 		performed within `this` Ucs2. In either case, the returned position
 		is relative to the beginning of `this` Ucs2.
 		is relative to the beginning of `this` Ucs2.
-		
+
 		If `str` cannot be found, -1 is returned.
 		If `str` cannot be found, -1 is returned.
 	**/
 	**/
 	@:extern public inline function lastIndexOf( str : Ucs2, ?startIndex : Int ) : Int {
 	@:extern public inline function lastIndexOf( str : Ucs2, ?startIndex : Int ) : Int {
@@ -114,19 +114,19 @@ abstract Ucs2(String) {
 
 
 	/**
 	/**
 		Splits `this` Ucs2 at each occurence of `delimiter`.
 		Splits `this` Ucs2 at each occurence of `delimiter`.
-		
+
 		If `this` Ucs2 is the empty Ucs2 "", the result is not consistent
 		If `this` Ucs2 is the empty Ucs2 "", the result is not consistent
 		across targets and may either be `[]` (on Js, Cpp) or `[""]`.
 		across targets and may either be `[]` (on Js, Cpp) or `[""]`.
-		
+
 		If `delimiter` is the empty Ucs2 "", `this` Ucs2 is split into an
 		If `delimiter` is the empty Ucs2 "", `this` Ucs2 is split into an
 		Array of `this.length` elements, where the elements correspond to the
 		Array of `this.length` elements, where the elements correspond to the
 		characters of `this` Ucs2.
 		characters of `this` Ucs2.
-		
+
 		If `delimiter` is not found within `this` Ucs2, the result is an Array
 		If `delimiter` is not found within `this` Ucs2, the result is an Array
 		with one element, which equals `this` Ucs2.
 		with one element, which equals `this` Ucs2.
-		
+
 		If `delimiter` is null, the result is unspecified.
 		If `delimiter` is null, the result is unspecified.
-		
+
 		Otherwise, `this` Ucs2 is split into parts at each occurence of
 		Otherwise, `this` Ucs2 is split into parts at each occurence of
 		`delimiter`. If `this` Ucs2 starts (or ends) with [delimiter}, the
 		`delimiter`. If `this` Ucs2 starts (or ends) with [delimiter}, the
 		result Array contains a leading (or trailing) empty Ucs2 "" element.
 		result Array contains a leading (or trailing) empty Ucs2 "" element.
@@ -138,17 +138,17 @@ abstract Ucs2(String) {
 
 
 	/**
 	/**
 		Returns `len` characters of `this` Ucs2, starting at position `pos`.
 		Returns `len` characters of `this` Ucs2, starting at position `pos`.
-		
+
 		If `len` is omitted, all characters from position `pos` to the end of
 		If `len` is omitted, all characters from position `pos` to the end of
 		`this` Ucs2 are included.
 		`this` Ucs2 are included.
-		
+
 		If `pos` is negative, its value is calculated from the end of `this`
 		If `pos` is negative, its value is calculated from the end of `this`
 		Ucs2 by `this.length + pos`. If this yields a negative value, 0 is
 		Ucs2 by `this.length + pos`. If this yields a negative value, 0 is
 		used instead.
 		used instead.
-		
+
 		If the calculated position + `len` exceeds `this.length`, the characters
 		If the calculated position + `len` exceeds `this.length`, the characters
 		from that position to the end of `this` Ucs2 are returned.
 		from that position to the end of `this` Ucs2 are returned.
-		
+
 		If `len` is negative, the result is unspecified.
 		If `len` is negative, the result is unspecified.
 	**/
 	**/
 	@:extern public inline function substr( pos : Int, ?len : Int ) : Ucs2 {
 	@:extern public inline function substr( pos : Int, ?len : Int ) : Ucs2 {
@@ -157,14 +157,14 @@ abstract Ucs2(String) {
 
 
 	/**
 	/**
 		Returns the part of `this` Ucs2 from `startIndex` to `endIndex`.
 		Returns the part of `this` Ucs2 from `startIndex` to `endIndex`.
-		
+
 		If `startIndex` or `endIndex` are negative, 0 is used instead.
 		If `startIndex` or `endIndex` are negative, 0 is used instead.
-		
+
 		If `startIndex` exceeds `endIndex`, they are swapped.
 		If `startIndex` exceeds `endIndex`, they are swapped.
-		
+
 		If the (possibly swapped) `endIndex` is omitted or exceeds
 		If the (possibly swapped) `endIndex` is omitted or exceeds
 		`this.length`, `this.length` is used instead.
 		`this.length`, `this.length` is used instead.
-		
+
 		If the (possibly swapped) `startIndex` exceeds `this.length`, the empty
 		If the (possibly swapped) `startIndex` exceeds `this.length`, the empty
 		Ucs2 "" is returned.
 		Ucs2 "" is returned.
 	**/
 	**/
@@ -181,12 +181,12 @@ abstract Ucs2(String) {
 
 
 	/**
 	/**
 		Returns the Ucs2 corresponding to the character code `code`.
 		Returns the Ucs2 corresponding to the character code `code`.
-		
+
 		If `code` is negative or has another invalid value, the result is
 		If `code` is negative or has another invalid value, the result is
 		unspecified.
 		unspecified.
 	**/
 	**/
 	@:extern public static inline function fromCharCode( code : Int ) : Ucs2 {
 	@:extern public static inline function fromCharCode( code : Int ) : Ucs2 {
 		return new Ucs2(String.fromCharCode(code));
 		return new Ucs2(String.fromCharCode(code));
 	}
 	}
-	
+
 }
 }

+ 2 - 2
std/haxe/Unserializer.hx

@@ -32,7 +32,7 @@ typedef TypeResolver = {
 	a serialization String and creates objects from the contained data.
 	a serialization String and creates objects from the contained data.
 
 
 	This class can be used in two ways:
 	This class can be used in two ways:
-	
+
 	- create a new Unserializer() instance with a given serialization
 	- create a new Unserializer() instance with a given serialization
 		String, then call its unserialize() method until all values are
 		String, then call its unserialize() method until all values are
 		extracted
 		extracted
@@ -48,7 +48,7 @@ class Unserializer {
 		default, the haxe Type Api is used.
 		default, the haxe Type Api is used.
 
 
 		A type resolver must provide two methods:
 		A type resolver must provide two methods:
-		
+
 		1. resolveClass(name:String):Class<Dynamic> is called to determine a
 		1. resolveClass(name:String):Class<Dynamic> is called to determine a
 				Class from a class name
 				Class from a class name
 		2. resolveEnum(name:String):Enum<Dynamic> is called to determine an
 		2. resolveEnum(name:String):Enum<Dynamic> is called to determine an

+ 2 - 2
std/haxe/crypto/Adler32.hx

@@ -53,7 +53,7 @@ class Adler32 {
 	public function toString() {
 	public function toString() {
 		return StringTools.hex(a2,8) + StringTools.hex(a1,8);
 		return StringTools.hex(a2,8) + StringTools.hex(a1,8);
 	}
 	}
-	
+
 	public static function read( i : haxe.io.Input ) {
 	public static function read( i : haxe.io.Input ) {
 		var a = new Adler32();
 		var a = new Adler32();
 		var a2a = i.readByte();
 		var a2a = i.readByte();
@@ -70,6 +70,6 @@ class Adler32 {
 		a.update(b,0,b.length);
 		a.update(b,0,b.length);
 		return a.get();
 		return a.get();
 	}
 	}
-	
+
 
 
 }
 }

+ 2 - 2
std/haxe/crypto/Base64.hx

@@ -28,7 +28,7 @@ class Base64 {
 
 
 	public static var CHARS(default,null) = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 	public static var CHARS(default,null) = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 	public static var BYTES(default,null) = haxe.io.Bytes.ofString(CHARS);
 	public static var BYTES(default,null) = haxe.io.Bytes.ofString(CHARS);
-	
+
 	public static function encode( bytes : haxe.io.Bytes, complement = true ) : String {
 	public static function encode( bytes : haxe.io.Bytes, complement = true ) : String {
 		var str = new BaseCode(BYTES).encodeBytes(bytes).toString();
 		var str = new BaseCode(BYTES).encodeBytes(bytes).toString();
 		if( complement )
 		if( complement )
@@ -36,7 +36,7 @@ class Base64 {
 				str += "=";
 				str += "=";
 		return str;
 		return str;
 	}
 	}
-	
+
 	public static function decode( str : String, complement = true ) : haxe.io.Bytes {
 	public static function decode( str : String, complement = true ) : haxe.io.Bytes {
 		if( complement )
 		if( complement )
 			while( str.charCodeAt(str.length-1) == "=".code )
 			while( str.charCodeAt(str.length-1) == "=".code )

+ 5 - 5
std/haxe/crypto/Crc32.hx

@@ -24,11 +24,11 @@ package haxe.crypto;
 class Crc32 {
 class Crc32 {
 
 
 	var crc : Int;
 	var crc : Int;
-	
+
 	public function new() {
 	public function new() {
 		crc = 0xFFFFFFFF;
 		crc = 0xFFFFFFFF;
 	}
 	}
-	
+
 	public function byte( b : Int ) {
 	public function byte( b : Int ) {
 		var tmp = (crc ^ b) & 0xFF;
 		var tmp = (crc ^ b) & 0xFF;
 		for( j in 0...8 ) {
 		for( j in 0...8 ) {
@@ -39,7 +39,7 @@ class Crc32 {
 		}
 		}
 		crc = (crc >>> 8) ^ tmp;
 		crc = (crc >>> 8) ^ tmp;
 	}
 	}
-	
+
 	public function update( b : haxe.io.Bytes, pos, len ) {
 	public function update( b : haxe.io.Bytes, pos, len ) {
 		var b = b.getData();
 		var b = b.getData();
 		for( i in pos...pos+len ) {
 		for( i in pos...pos+len ) {
@@ -53,11 +53,11 @@ class Crc32 {
 			crc = (crc >>> 8) ^ tmp;
 			crc = (crc >>> 8) ^ tmp;
 		}
 		}
 	}
 	}
-	
+
 	public function get() {
 	public function get() {
 		return crc ^ 0xFFFFFFFF;
 		return crc ^ 0xFFFFFFFF;
 	}
 	}
-	
+
 	/**
 	/**
 		Calculates the CRC32 of the given data bytes
 		Calculates the CRC32 of the given data bytes
 	**/
 	**/

+ 12 - 12
std/haxe/ds/ArraySort.hx

@@ -28,22 +28,22 @@ package haxe.ds;
 	of equal elements has to be retained on all targets.
 	of equal elements has to be retained on all targets.
 **/
 **/
 class ArraySort {
 class ArraySort {
-	
+
 	/**
 	/**
 		Sorts Array `a` according to the comparison function `cmp`, where
 		Sorts Array `a` according to the comparison function `cmp`, where
 		`cmp(x,y)` returns 0 if `x == y`, a positive Int if `x > y` and a
 		`cmp(x,y)` returns 0 if `x == y`, a positive Int if `x > y` and a
 		negative Int if `x < y`.
 		negative Int if `x < y`.
-		
+
 		This operation modifies Array `a` in place.
 		This operation modifies Array `a` in place.
-		
+
 		This operation is stable: The order of equal elements is preserved.
 		This operation is stable: The order of equal elements is preserved.
-		
+
 		If `a` or `cmp` are null, the result is unspecified.
 		If `a` or `cmp` are null, the result is unspecified.
 	**/
 	**/
 	static public function sort<T>(a:Array<T>, cmp:T -> T -> Int) {
 	static public function sort<T>(a:Array<T>, cmp:T -> T -> Int) {
 		rec(a, cmp, 0, a.length);
 		rec(a, cmp, 0, a.length);
 	}
 	}
-	
+
 	static function rec<T>(a:Array<T>, cmp, from, to) {
 	static function rec<T>(a:Array<T>, cmp, from, to) {
 		var middle = (from + to) >> 1;
 		var middle = (from + to) >> 1;
 		if (to - from < 12) {
 		if (to - from < 12) {
@@ -64,7 +64,7 @@ class ArraySort {
 		rec(a, cmp, middle, to);
 		rec(a, cmp, middle, to);
 		doMerge(a, cmp, from, middle, to, middle - from, to - middle);
 		doMerge(a, cmp, from, middle, to, middle - from, to - middle);
 	}
 	}
-	
+
 	static function doMerge<T>(a:Array<T>, cmp, from, pivot, to, len1, len2) {
 	static function doMerge<T>(a:Array<T>, cmp, from, pivot, to, len1, len2) {
 		var first_cut, second_cut, len11, len22, new_mid;
 		var first_cut, second_cut, len11, len22, new_mid;
 		if (len1 == 0 || len2 == 0)
 		if (len1 == 0 || len2 == 0)
@@ -90,7 +90,7 @@ class ArraySort {
 		doMerge(a, cmp, from, first_cut, new_mid, len11, len22);
 		doMerge(a, cmp, from, first_cut, new_mid, len11, len22);
 		doMerge(a, cmp, new_mid, second_cut, to, len1 - len11, len2 - len22);
 		doMerge(a, cmp, new_mid, second_cut, to, len1 - len11, len2 - len22);
 	}
 	}
-	
+
 	static function rotate<T>(a:Array<T>, cmp, from, mid, to) {
 	static function rotate<T>(a:Array<T>, cmp, from, mid, to) {
 		var n;
 		var n;
 		if (from == mid || mid == to) return;
 		if (from == mid || mid == to) return;
@@ -108,7 +108,7 @@ class ArraySort {
 			a[p1] = val;
 			a[p1] = val;
 		}
 		}
 	}
 	}
-	
+
 	static function gcd(m, n) {
 	static function gcd(m, n) {
 		while (n != 0) {
 		while (n != 0) {
 			var t = m % n;
 			var t = m % n;
@@ -117,7 +117,7 @@ class ArraySort {
 		}
 		}
 		return m;
 		return m;
 	}
 	}
-	
+
 	static function upper<T>(a:Array<T>, cmp, from, to, val) {
 	static function upper<T>(a:Array<T>, cmp, from, to, val) {
 		var len = to - from, half, mid;
 		var len = to - from, half, mid;
 		while (len > 0) {
 		while (len > 0) {
@@ -132,7 +132,7 @@ class ArraySort {
 		}
 		}
 		return from;
 		return from;
 	}
 	}
-	
+
 	static function lower<T>(a:Array<T>, cmp, from, to, val) {
 	static function lower<T>(a:Array<T>, cmp, from, to, val) {
 		var len = to - from, half, mid;
 		var len = to - from, half, mid;
 		while (len > 0) {
 		while (len > 0) {
@@ -146,13 +146,13 @@ class ArraySort {
 		}
 		}
 		return from;
 		return from;
 	}
 	}
-	
+
 	static function swap<T>(a:Array<T>, i, j) {
 	static function swap<T>(a:Array<T>, i, j) {
 		var tmp = a[i];
 		var tmp = a[i];
 		a[i] = a[j];
 		a[i] = a[j];
 		a[j] = tmp;
 		a[j] = tmp;
 	}
 	}
-	
+
 	static inline function compare<T>(a:Array<T>, cmp, i, j) {
 	static inline function compare<T>(a:Array<T>, cmp, i, j) {
 		return cmp(a[i], a[j]);
 		return cmp(a[i], a[j]);
 	}
 	}

+ 33 - 33
std/haxe/ds/BalancedTree.hx

@@ -26,36 +26,36 @@ package haxe.ds;
 	BalancedTree allows key-value mapping with arbitrary keys, as long as they
 	BalancedTree allows key-value mapping with arbitrary keys, as long as they
 	can be ordered. By default, `Reflect.compare` is used in the `compare`
 	can be ordered. By default, `Reflect.compare` is used in the `compare`
 	method, which can be overridden in subclasses.
 	method, which can be overridden in subclasses.
-	
+
 	Operations have a logarithmic average and worst-case cost.
 	Operations have a logarithmic average and worst-case cost.
-	
+
 	Iteration over keys and values, using `keys` and `iterator` respectively,
 	Iteration over keys and values, using `keys` and `iterator` respectively,
 	are in-order.
 	are in-order.
 **/
 **/
 class BalancedTree<K,V> {
 class BalancedTree<K,V> {
 	var root:TreeNode<K,V>;
 	var root:TreeNode<K,V>;
-	
+
 	/**
 	/**
 		Creates a new BalancedTree, which is initially empty.
 		Creates a new BalancedTree, which is initially empty.
 	**/
 	**/
 	public function new() { }
 	public function new() { }
-	
+
 	/**
 	/**
 		Binds `key` to `value`.
 		Binds `key` to `value`.
-		
+
 		If `key` is already bound to a value, that binding disappears.
 		If `key` is already bound to a value, that binding disappears.
-		
+
 		If `key` is null, the result is unspecified.
 		If `key` is null, the result is unspecified.
 	**/
 	**/
 	public function set(key:K, value:V) {
 	public function set(key:K, value:V) {
 		root = setLoop(key, value, root);
 		root = setLoop(key, value, root);
 	}
 	}
-	
+
 	/**
 	/**
 		Returns the value `key` is bound to.
 		Returns the value `key` is bound to.
-		
+
 		If `key` is not bound to any value, `null` is returned.
 		If `key` is not bound to any value, `null` is returned.
-		
+
 		If `key` is null, the result is unspecified.
 		If `key` is null, the result is unspecified.
 	**/
 	**/
 	public function get(key:K):Null<V> {
 	public function get(key:K):Null<V> {
@@ -68,15 +68,15 @@ class BalancedTree<K,V> {
 		}
 		}
 		return null;
 		return null;
 	}
 	}
-	
+
 	/**
 	/**
 		Removes the current binding of `key`.
 		Removes the current binding of `key`.
-		
+
 		If `key` has no binding, `this` BalancedTree is unchanged and false is
 		If `key` has no binding, `this` BalancedTree is unchanged and false is
 		returned.
 		returned.
-		
+
 		Otherwise the binding of `key` is removed and true is returned.
 		Otherwise the binding of `key` is removed and true is returned.
-		
+
 		If `key` is null, the result is unspecified.
 		If `key` is null, the result is unspecified.
 	**/
 	**/
 	public function remove(key:K) {
 	public function remove(key:K) {
@@ -88,12 +88,12 @@ class BalancedTree<K,V> {
 			return false;
 			return false;
 		}
 		}
 	}
 	}
-	
+
 	/**
 	/**
 		Tells if `key` is bound to a value.
 		Tells if `key` is bound to a value.
-		
+
 		This method returns true even if `key` is bound to null.
 		This method returns true even if `key` is bound to null.
-		
+
 		If `key` is null, the result is unspecified.
 		If `key` is null, the result is unspecified.
 	**/
 	**/
 	public function exists(key:K) {
 	public function exists(key:K) {
@@ -106,10 +106,10 @@ class BalancedTree<K,V> {
 		}
 		}
 		return false;
 		return false;
 	}
 	}
-	
+
 	/**
 	/**
 		Iterates over the bound values of `this` BalancedTree.
 		Iterates over the bound values of `this` BalancedTree.
-		
+
 		This operation is performed in-order.
 		This operation is performed in-order.
 	**/
 	**/
 	public function iterator():Iterator<V> {
 	public function iterator():Iterator<V> {
@@ -117,10 +117,10 @@ class BalancedTree<K,V> {
 		iteratorLoop(root, ret);
 		iteratorLoop(root, ret);
 		return ret.iterator();
 		return ret.iterator();
 	}
 	}
-	
+
 	/**
 	/**
 		Iterates over the keys of `this` BalancedTree.
 		Iterates over the keys of `this` BalancedTree.
-		
+
 		This operation is performed in-order.
 		This operation is performed in-order.
 	**/
 	**/
 	public function keys():Iterator<K> {
 	public function keys():Iterator<K> {
@@ -128,7 +128,7 @@ class BalancedTree<K,V> {
 		keysLoop(root, ret);
 		keysLoop(root, ret);
 		return ret.iterator();
 		return ret.iterator();
 	}
 	}
-	
+
 	function setLoop(k:K, v:V, node:TreeNode<K,V>) {
 	function setLoop(k:K, v:V, node:TreeNode<K,V>) {
 		if (node == null) return new TreeNode<K,V>(null, k, v, null);
 		if (node == null) return new TreeNode<K,V>(null, k, v, null);
 		var c = compare(k, node.key);
 		var c = compare(k, node.key);
@@ -141,7 +141,7 @@ class BalancedTree<K,V> {
 			balance(node.left, node.key, node.value, nr);
 			balance(node.left, node.key, node.value, nr);
 		}
 		}
 	}
 	}
-		
+
 	function removeLoop(k:K, node:TreeNode<K,V>) {
 	function removeLoop(k:K, node:TreeNode<K,V>) {
 		if (node == null) throw "Not_found";
 		if (node == null) throw "Not_found";
 		var c = compare(k, node.key);
 		var c = compare(k, node.key);
@@ -149,7 +149,7 @@ class BalancedTree<K,V> {
 		else if (c < 0) balance(removeLoop(k, node.left), node.key, node.value, node.right);
 		else if (c < 0) balance(removeLoop(k, node.left), node.key, node.value, node.right);
 		else balance(node.left, node.key, node.value, removeLoop(k, node.right));
 		else balance(node.left, node.key, node.value, removeLoop(k, node.right));
 	}
 	}
-	
+
 	function iteratorLoop(node:TreeNode<K,V>, acc:Array<V>) {
 	function iteratorLoop(node:TreeNode<K,V>, acc:Array<V>) {
 		if (node != null) {
 		if (node != null) {
 			iteratorLoop(node.left, acc);
 			iteratorLoop(node.left, acc);
@@ -157,7 +157,7 @@ class BalancedTree<K,V> {
 			iteratorLoop(node.right, acc);
 			iteratorLoop(node.right, acc);
 		}
 		}
 	}
 	}
-	
+
 	function keysLoop(node:TreeNode<K,V>, acc:Array<K>) {
 	function keysLoop(node:TreeNode<K,V>, acc:Array<K>) {
 		if (node != null) {
 		if (node != null) {
 			keysLoop(node.left, acc);
 			keysLoop(node.left, acc);
@@ -165,25 +165,25 @@ class BalancedTree<K,V> {
 			keysLoop(node.right, acc);
 			keysLoop(node.right, acc);
 		}
 		}
 	}
 	}
-	
+
 	function merge(t1, t2) {
 	function merge(t1, t2) {
 		if (t1 == null) return t2;
 		if (t1 == null) return t2;
 		if (t2 == null) return t1;
 		if (t2 == null) return t1;
 		var t = minBinding(t2);
 		var t = minBinding(t2);
 		return balance(t1, t.key, t.value, removeMinBinding(t2));
 		return balance(t1, t.key, t.value, removeMinBinding(t2));
 	}
 	}
-	
+
 	function minBinding(t:TreeNode<K,V>) {
 	function minBinding(t:TreeNode<K,V>) {
 		return if (t == null) throw "Not_found";
 		return if (t == null) throw "Not_found";
 		else if (t.left == null) t;
 		else if (t.left == null) t;
 		else minBinding(t.left);
 		else minBinding(t.left);
 	}
 	}
-	
+
 	function removeMinBinding(t:TreeNode<K,V>) {
 	function removeMinBinding(t:TreeNode<K,V>) {
 		return if (t.left == null) t.right;
 		return if (t.left == null) t.right;
 		else balance(removeMinBinding(t.left), t.key, t.value, t.right);
 		else balance(removeMinBinding(t.left), t.key, t.value, t.right);
 	}
 	}
-		
+
 	function balance(l:TreeNode<K,V>, k:K, v:V, r:TreeNode<K,V>):TreeNode<K,V> {
 	function balance(l:TreeNode<K,V>, k:K, v:V, r:TreeNode<K,V>):TreeNode<K,V> {
 		var hl = l.get_height();
 		var hl = l.get_height();
 		var hr = r.get_height();
 		var hr = r.get_height();
@@ -197,11 +197,11 @@ class BalancedTree<K,V> {
 			new TreeNode<K,V>(l, k, v, r, (hl > hr ? hl : hr) + 1);
 			new TreeNode<K,V>(l, k, v, r, (hl > hr ? hl : hr) + 1);
 		}
 		}
 	}
 	}
-	
+
 	function compare(k1:K, k2:K) {
 	function compare(k1:K, k2:K) {
 		return Reflect.compare(k1, k2);
 		return Reflect.compare(k1, k2);
 	}
 	}
-	
+
 	public function toString() {
 	public function toString() {
 		return '{${root.toString()}}';
 		return '{${root.toString()}}';
 	}
 	}
@@ -216,7 +216,7 @@ class TreeNode<K,V> {
 	public
 	public
 	#end
 	#end
 	var _height : Int;
 	var _height : Int;
-	
+
 	public function new(l, k, v, r, h = -1) {
 	public function new(l, k, v, r, h = -1) {
 		left = l;
 		left = l;
 		key = k;
 		key = k;
@@ -227,9 +227,9 @@ class TreeNode<K,V> {
 		else
 		else
 			_height = h;
 			_height = h;
 	}
 	}
-	
+
 	@:extern public inline function get_height() return this == null ? 0 : _height;
 	@:extern public inline function get_height() return this == null ? 0 : _height;
-	
+
 	public function toString() {
 	public function toString() {
 		return (left == null ? "" : left.toString() + ", ") + '$key=$value' + (right == null ? "" : ", " +right.toString());
 		return (left == null ? "" : left.toString() + ", ") + '$key=$value' + (right == null ? "" : ", " +right.toString());
 	}
 	}

+ 4 - 4
std/haxe/ds/EnumValueMap.hx

@@ -24,12 +24,12 @@ package haxe.ds;
 
 
 /**
 /**
 	EnumValueMap allows mapping of enum value keys to arbitrary values.
 	EnumValueMap allows mapping of enum value keys to arbitrary values.
-	
+
 	Keys are compared by value and recursively over their parameters. If any
 	Keys are compared by value and recursively over their parameters. If any
 	parameter is not an enum value, `Reflect.compare` is used to compare them.
 	parameter is not an enum value, `Reflect.compare` is used to compare them.
 **/
 **/
 class EnumValueMap<K:EnumValue, V> extends haxe.ds.BalancedTree<K, V> implements Map.IMap<K,V> {
 class EnumValueMap<K:EnumValue, V> extends haxe.ds.BalancedTree<K, V> implements Map.IMap<K,V> {
-	
+
 	override function compare(k1:EnumValue, k2:EnumValue):Int {
 	override function compare(k1:EnumValue, k2:EnumValue):Int {
 		var d = k1.getIndex() - k2.getIndex();
 		var d = k1.getIndex() - k2.getIndex();
 		if (d != 0) return d;
 		if (d != 0) return d;
@@ -38,7 +38,7 @@ class EnumValueMap<K:EnumValue, V> extends haxe.ds.BalancedTree<K, V> implements
 		if (p1.length == 0 && p2.length == 0) return 0;
 		if (p1.length == 0 && p2.length == 0) return 0;
 		return compareArgs(p1, p2);
 		return compareArgs(p1, p2);
 	}
 	}
-	
+
 	function compareArgs(a1:Array<Dynamic>, a2:Array<Dynamic>):Int {
 	function compareArgs(a1:Array<Dynamic>, a2:Array<Dynamic>):Int {
 		var ld = a1.length - a2.length;
 		var ld = a1.length - a2.length;
 		if (ld != 0) return ld;
 		if (ld != 0) return ld;
@@ -48,7 +48,7 @@ class EnumValueMap<K:EnumValue, V> extends haxe.ds.BalancedTree<K, V> implements
 		}
 		}
 		return 0;
 		return 0;
 	}
 	}
-	
+
 	function compareArg(v1:Dynamic, v2:Dynamic):Int {
 	function compareArg(v1:Dynamic, v2:Dynamic):Int {
 		return if (Reflect.isEnumValue(v1) && Reflect.isEnumValue(v2)) {
 		return if (Reflect.isEnumValue(v1) && Reflect.isEnumValue(v2)) {
 			compare(v1, v2);
 			compare(v1, v2);

+ 7 - 7
std/haxe/ds/GenericStack.hx

@@ -44,13 +44,13 @@ private class GenericStackIterator<T> extends cpp.FastIterator<T> {
 
 
 /**
 /**
 	A stack of elements.
 	A stack of elements.
-	
+
 	This class is generic, which means one type is generated for each type
 	This class is generic, which means one type is generated for each type
 	parameter T on static targets. For example:
 	parameter T on static targets. For example:
-		
+
 	- `new GenericStack<Int>()` generates `GenericStack_Int`
 	- `new GenericStack<Int>()` generates `GenericStack_Int`
 	- `new GenericStack<String>()` generates `GenericStack_String`
 	- `new GenericStack<String>()` generates `GenericStack_String`
-	
+
 	The generated name is an implementation detail and should not be relied
 	The generated name is an implementation detail and should not be relied
 	upon.
 	upon.
 **/
 **/
@@ -76,7 +76,7 @@ class GenericStack<T> {
 
 
 	/**
 	/**
 		Returns the topmost stack element without removing it.
 		Returns the topmost stack element without removing it.
-		
+
 		If the stack is empty, null is returned.
 		If the stack is empty, null is returned.
 	**/
 	**/
 	public inline function first() : Null<T> {
 	public inline function first() : Null<T> {
@@ -85,7 +85,7 @@ class GenericStack<T> {
 
 
 	/**
 	/**
 		Returns the topmost stack element and removes it.
 		Returns the topmost stack element and removes it.
-		
+
 		If the stack is empty, null is returned.
 		If the stack is empty, null is returned.
 	**/
 	**/
 	public inline function pop() : Null<T> {
 	public inline function pop() : Null<T> {
@@ -108,10 +108,10 @@ class GenericStack<T> {
 	/**
 	/**
 		Removes the first element which is equal to `v` according to the `==`
 		Removes the first element which is equal to `v` according to the `==`
 		operator.
 		operator.
-		
+
 		This method traverses the stack until it finds a matching element and
 		This method traverses the stack until it finds a matching element and
 		unlinks it, returning true.
 		unlinks it, returning true.
-		
+
 		If no matching element is found, false is returned.
 		If no matching element is found, false is returned.
 	**/
 	**/
 	public function remove( v : T ) : Bool {
 	public function remove( v : T ) : Bool {

+ 2 - 2
std/haxe/ds/IntMap.hx

@@ -23,7 +23,7 @@ package haxe.ds;
 
 
 /**
 /**
 	IntMap allows mapping of Int keys to arbitrary values.
 	IntMap allows mapping of Int keys to arbitrary values.
-	
+
 	See `Map` for documentation details.
 	See `Map` for documentation details.
 **/
 **/
 extern class IntMap<T> implements Map.IMap<Int,T> {
 extern class IntMap<T> implements Map.IMap<Int,T> {
@@ -37,7 +37,7 @@ extern class IntMap<T> implements Map.IMap<Int,T> {
 		See `Map.set`
 		See `Map.set`
 	**/
 	**/
 	public function set( key : Int, value : T ) : Void;
 	public function set( key : Int, value : T ) : Void;
-	
+
 	/**
 	/**
 		See `Map.get`
 		See `Map.get`
 	**/
 	**/

+ 5 - 5
std/haxe/ds/ListSort.hx

@@ -29,15 +29,15 @@ package haxe.ds;
 class ListSort {
 class ListSort {
 
 
 	// Note : we prefer [inline] over [@:generic] here since we want to inline the comparison function as well
 	// Note : we prefer [inline] over [@:generic] here since we want to inline the comparison function as well
-	
+
 	/**
 	/**
 		Sorts List `lst` according to the comparison function `cmp`, where
 		Sorts List `lst` according to the comparison function `cmp`, where
 		`cmp(x,y)` returns 0 if `x == y`, a positive Int if `x > y` and a
 		`cmp(x,y)` returns 0 if `x == y`, a positive Int if `x > y` and a
 		negative Int if `x < y`.
 		negative Int if `x < y`.
-		
+
 		This operation modifies List `a` in place and returns its head once modified.
 		This operation modifies List `a` in place and returns its head once modified.
 		The `prev` of the head is set to the tail of the sorted list.
 		The `prev` of the head is set to the tail of the sorted list.
-		
+
 		If `list` or `cmp` are null, the result is unspecified.
 		If `list` or `cmp` are null, the result is unspecified.
 	**/
 	**/
 	public static inline function sort<T:{prev:T,next:T}>(list:T, cmp : T -> T -> Int) : T {
 	public static inline function sort<T:{prev:T,next:T}>(list:T, cmp : T -> T -> Int) : T {
@@ -93,7 +93,7 @@ class ListSort {
 		return list;
 		return list;
 	}
 	}
 
 
-	
+
 	/**
 	/**
 		Same as [sort] but on single linked list.
 		Same as [sort] but on single linked list.
 	**/
 	**/
@@ -146,5 +146,5 @@ class ListSort {
 		}
 		}
 		return list;
 		return list;
 	}
 	}
-	
+
 }
 }

+ 16 - 16
std/haxe/ds/ObjectMap.hx

@@ -24,51 +24,51 @@ package haxe.ds;
 
 
 /**
 /**
 	ObjectMap allows mapping of object keys to arbitrary values.
 	ObjectMap allows mapping of object keys to arbitrary values.
-	
+
 	On static targets, the keys are considered to be strong references. Refer
 	On static targets, the keys are considered to be strong references. Refer
 	to `haxe.ds.WeakMap` for a weak reference version.
 	to `haxe.ds.WeakMap` for a weak reference version.
-	
+
 	See `Map` for documentation details.
 	See `Map` for documentation details.
 **/
 **/
 extern class ObjectMap < K: { }, V > implements Map.IMap<K,V> {
 extern class ObjectMap < K: { }, V > implements Map.IMap<K,V> {
-	
+
 	/**
 	/**
 		Creates a new ObjectMap.
 		Creates a new ObjectMap.
 	**/
 	**/
 	public function new():Void;
 	public function new():Void;
-	
+
 	/**
 	/**
 		See `Map.set`
 		See `Map.set`
 	**/
 	**/
 	public function set(key:K, value:V):Void;
 	public function set(key:K, value:V):Void;
-	
+
 	/**
 	/**
 		See `Map.get`
 		See `Map.get`
-	**/	
+	**/
 	public function get(key:K):Null<V>;
 	public function get(key:K):Null<V>;
-	
+
 	/**
 	/**
 		See `Map.exists`
 		See `Map.exists`
-	**/	
+	**/
 	public function exists(key:K):Bool;
 	public function exists(key:K):Bool;
-	
+
 	/**
 	/**
 		See `Map.remove`
 		See `Map.remove`
-	**/	
+	**/
 	public function remove(key:K):Bool;
 	public function remove(key:K):Bool;
-	
+
 	/**
 	/**
 		See `Map.keys`
 		See `Map.keys`
-	**/	
+	**/
 	public function keys():Iterator<K>;
 	public function keys():Iterator<K>;
-	
+
 	/**
 	/**
 		See `Map.iterator`
 		See `Map.iterator`
-	**/	
+	**/
 	public function iterator():Iterator<V>;
 	public function iterator():Iterator<V>;
-	
+
 	/**
 	/**
 		See `Map.toString`
 		See `Map.toString`
-	**/	
+	**/
 	public function toString():String;
 	public function toString():String;
 }
 }

+ 1 - 1
std/haxe/ds/StringMap.hx

@@ -24,7 +24,7 @@ package haxe.ds;
 
 
 /**
 /**
 	StringMap allows mapping of String keys to arbitrary values.
 	StringMap allows mapping of String keys to arbitrary values.
-	
+
 	See `Map` for documentation details.
 	See `Map` for documentation details.
 **/
 **/
 extern class StringMap<T> implements Map.IMap<String,T> {
 extern class StringMap<T> implements Map.IMap<String,T> {

+ 4 - 5
std/haxe/ds/Vector.hx

@@ -37,13 +37,12 @@ private typedef VectorData<T> = #if flash10
 	A Vector is a storage of fixed size. It can be faster than Array on some
 	A Vector is a storage of fixed size. It can be faster than Array on some
 	targets, and is never slower.
 	targets, and is never slower.
 **/
 **/
-@:arrayAccess
 abstract Vector<T>(VectorData<T>) {
 abstract Vector<T>(VectorData<T>) {
 	/**
 	/**
 		Creates a new Vector of length `length`.
 		Creates a new Vector of length `length`.
 
 
 		Initially `this` Vector contains `length` neutral elements:
 		Initially `this` Vector contains `length` neutral elements:
-			
+
 		- always null on dynamic targets
 		- always null on dynamic targets
 		- 0, 0.0 or false for Int, Float and Bool respectively on static targets
 		- 0, 0.0 or false for Int, Float and Bool respectively on static targets
 		- null for other types on static targets
 		- null for other types on static targets
@@ -75,7 +74,7 @@ abstract Vector<T>(VectorData<T>) {
 		If `index` is negative or exceeds `this.length`, the result is
 		If `index` is negative or exceeds `this.length`, the result is
 		unspecified.
 		unspecified.
 	**/
 	**/
-	public inline function get(index:Int):Null<T> {
+	@:arrayAccess public inline function get(index:Int):Null<T> {
 		return this[index];
 		return this[index];
 	}
 	}
 
 
@@ -85,7 +84,7 @@ abstract Vector<T>(VectorData<T>) {
 		If `index` is negative or exceeds `this.length`, the result is
 		If `index` is negative or exceeds `this.length`, the result is
 		unspecified.
 		unspecified.
 	**/
 	**/
-	public inline function set(index:Int, val:T):T {
+	@:arrayAccess public inline function set(index:Int, val:T):T {
 		return this[index] = val;
 		return this[index] = val;
 	}
 	}
 
 
@@ -143,7 +142,7 @@ abstract Vector<T>(VectorData<T>) {
 			a[i] = get(i);
 			a[i] = get(i);
 		return a;
 		return a;
 	}
 	}
-		
+
 	/**
 	/**
 		Extracts the data of `this` Vector.
 		Extracts the data of `this` Vector.
 
 

+ 18 - 18
std/haxe/ds/WeakMap.hx

@@ -24,64 +24,64 @@ package haxe.ds;
 
 
 /**
 /**
 	WeakMap allows mapping of object keys to arbitrary values.
 	WeakMap allows mapping of object keys to arbitrary values.
-	
+
 	The keys are considered to be weak references on static targets.
 	The keys are considered to be weak references on static targets.
-	
+
 	See `Map` for documentation details.
 	See `Map` for documentation details.
 **/
 **/
 class WeakMap<K: { },V> implements Map.IMap<K,V> {
 class WeakMap<K: { },V> implements Map.IMap<K,V> {
-	
+
 	/**
 	/**
 		Creates a new WeakMap.
 		Creates a new WeakMap.
-	**/	
+	**/
 	public function new():Void {
 	public function new():Void {
 		throw "Not implemented for this platform";
 		throw "Not implemented for this platform";
 	}
 	}
-	
+
 	/**
 	/**
 		See `Map.set`
 		See `Map.set`
-	**/	
+	**/
 	public function set(key:K, value:V):Void {
 	public function set(key:K, value:V):Void {
 	}
 	}
-	
+
 	/**
 	/**
 		See `Map.get`
 		See `Map.get`
-	**/		
+	**/
 	public function get(key:K):Null<V> {
 	public function get(key:K):Null<V> {
 		return null;
 		return null;
 	}
 	}
-	
+
 	/**
 	/**
 		See `Map.exists`
 		See `Map.exists`
-	**/		
+	**/
 	public function exists(key:K):Bool {
 	public function exists(key:K):Bool {
 		return false;
 		return false;
 	}
 	}
-	
+
 	/**
 	/**
 		See `Map.remove`
 		See `Map.remove`
-	**/		
+	**/
 	public function remove(key:K):Bool {
 	public function remove(key:K):Bool {
 		return false;
 		return false;
 	}
 	}
-	
+
 	/**
 	/**
 		See `Map.keys`
 		See `Map.keys`
-	**/		
+	**/
 	public function keys():Iterator<K> {
 	public function keys():Iterator<K> {
 		return null;
 		return null;
 	}
 	}
-	
+
 	/**
 	/**
 		See `Map.iterator`
 		See `Map.iterator`
-	**/		
+	**/
 	public function iterator():Iterator<V> {
 	public function iterator():Iterator<V> {
 		return null;
 		return null;
 	}
 	}
-	
+
 	/**
 	/**
 		See `Map.toString`
 		See `Map.toString`
-	**/		
+	**/
 	public function toString():String {
 	public function toString():String {
 		return null;
 		return null;
 	}
 	}

+ 1 - 1
std/haxe/format/JsonPrinter.hx

@@ -10,7 +10,7 @@ class JsonPrinter {
 
 
 	var buf : #if flash9 flash.utils.ByteArray #else StringBuf #end;
 	var buf : #if flash9 flash.utils.ByteArray #else StringBuf #end;
 	var replacer : Dynamic -> Dynamic -> Dynamic;
 	var replacer : Dynamic -> Dynamic -> Dynamic;
-	
+
 	function new(replacer:Dynamic -> Dynamic -> Dynamic) {
 	function new(replacer:Dynamic -> Dynamic -> Dynamic) {
 		this.replacer = replacer;
 		this.replacer = replacer;
 
 

+ 14 - 7
std/haxe/io/Bytes.hx

@@ -95,7 +95,7 @@ class Bytes {
 			b1[i+pos] = b2[i+srcpos];
 			b1[i+pos] = b2[i+srcpos];
 		#end
 		#end
 	}
 	}
-	
+
 	public function fill( pos : Int, len : Int, value : Int ) {
 	public function fill( pos : Int, len : Int, value : Int ) {
 		#if flash9
 		#if flash9
 		var v4 = value&0xFF;
 		var v4 = value&0xFF;
@@ -103,7 +103,7 @@ class Bytes {
 		v4 |= v4<<16;
 		v4 |= v4<<16;
 		b.position = pos;
 		b.position = pos;
 		for( i in 0...len>>2 )
 		for( i in 0...len>>2 )
-			b.writeUnsignedInt(v4);		
+			b.writeUnsignedInt(v4);
 		pos += len&~3;
 		pos += len&~3;
 		for( i in 0...len&3 )
 		for( i in 0...len&3 )
 			set(pos++,value);
 			set(pos++,value);
@@ -204,7 +204,7 @@ class Bytes {
 		var fcc = String.fromCharCode;
 		var fcc = String.fromCharCode;
 		var i = pos;
 		var i = pos;
 		var max = pos+len;
 		var max = pos+len;
-		// utf8-encode
+		// utf8-decode and utf16-encode
 		while( i < max ) {
 		while( i < max ) {
 			var c = b[i++];
 			var c = b[i++];
 			if( c < 0x80 ) {
 			if( c < 0x80 ) {
@@ -218,7 +218,10 @@ class Bytes {
 			} else {
 			} else {
 				var c2 = b[i++];
 				var c2 = b[i++];
 				var c3 = b[i++];
 				var c3 = b[i++];
-				s += fcc( ((c & 0x0F) << 18) | ((c2 & 0x7F) << 12) | ((c3 << 6) & 0x7F) | (b[i++] & 0x7F) );
+				var u = ((c & 0x0F) << 18) | ((c2 & 0x7F) << 12) | ((c3 & 0x7F) << 6) | (b[i++] & 0x7F);
+				// surrogate pair
+				s += fcc( (u >> 10) + 0xD7C0 );
+				s += fcc( (u & 0x3FF) | 0xDC00 );
 			}
 			}
 		}
 		}
 		return s;
 		return s;
@@ -315,9 +318,13 @@ class Bytes {
 		catch (e:Dynamic) throw e;
 		catch (e:Dynamic) throw e;
 		#else
 		#else
 		var a = new Array();
 		var a = new Array();
-		// utf8-decode
-		for( i in 0...s.length ) {
-			var c : Int = StringTools.fastCodeAt(s,i);
+		// utf16-decode and utf8-encode
+		var i = 0;
+		while( i < s.length ) {
+			var c : Int = StringTools.fastCodeAt(s,i++);
+			// surrogate pair
+			if( 0xD800 <= c && c <= 0xDBFF )
+			       c = (c - 0xD7C0 << 10) | (StringTools.fastCodeAt(s,i++) & 0x3FF);
 			if( c <= 0x7F )
 			if( c <= 0x7F )
 				a.push(c);
 				a.push(c);
 			else if( c <= 0x7FF ) {
 			else if( c <= 0x7FF ) {

+ 7 - 4
std/haxe/io/BytesInput.hx

@@ -28,7 +28,7 @@ class BytesInput extends Input {
 	var len : Int;
 	var len : Int;
 	var totlen : Int;
 	var totlen : Int;
 	#end
 	#end
-	
+
 	/** The current position in the stream in bytes. */
 	/** The current position in the stream in bytes. */
 	public var position(get,set) : Int;
 	public var position(get,set) : Int;
 
 
@@ -56,7 +56,7 @@ class BytesInput extends Input {
 		this.totlen = len;
 		this.totlen = len;
 		#end
 		#end
 	}
 	}
-	
+
 	inline function get_position() : Int {
 	inline function get_position() : Int {
 		#if flash9
 		#if flash9
 		return b.position;
 		return b.position;
@@ -72,15 +72,18 @@ class BytesInput extends Input {
 		return totlen;
 		return totlen;
 		#end
 		#end
 	}
 	}
-	
+
 	function set_position( p : Int ) : Int {
 	function set_position( p : Int ) : Int {
+		if( p < 0 ) p = 0;
+		else if( p > length ) p = length;
 		#if flash9
 		#if flash9
 		return b.position = p;
 		return b.position = p;
 		#else
 		#else
+		len = totlen - p;
 		return pos = p;
 		return pos = p;
 		#end
 		#end
 	}
 	}
-	
+
 	public override function readByte() : Int {
 	public override function readByte() : Int {
 		#if flash9
 		#if flash9
 			return try b.readUnsignedByte() catch( e : Dynamic ) throw new Eof();
 			return try b.readUnsignedByte() catch( e : Dynamic ) throw new Eof();

+ 3 - 3
std/haxe/macro/Compiler.hx

@@ -26,7 +26,7 @@ import haxe.macro.Expr;
 	All these methods can be called for compiler configuration macros.
 	All these methods can be called for compiler configuration macros.
 **/
 **/
 class Compiler {
 class Compiler {
-	
+
 	macro static public function getDefine( key : String ) {
 	macro static public function getDefine( key : String ) {
 		return macro $v{haxe.macro.Context.definedValue(key)};
 		return macro $v{haxe.macro.Context.definedValue(key)};
 	}
 	}
@@ -39,7 +39,7 @@ class Compiler {
 	public static function allowPackage( v : String ) {
 	public static function allowPackage( v : String ) {
 		untyped load("allow_package", 1)(v.__s);
 		untyped load("allow_package", 1)(v.__s);
 	}
 	}
-	
+
 	public static function define( flag : String, ?value : String ) untyped {
 	public static function define( flag : String, ?value : String ) untyped {
 		var v = flag + (value == null ? "" : "= " + value);
 		var v = flag + (value == null ? "" : "= " + value);
 		load("define", 1)(v.__s);
 		load("define", 1)(v.__s);
@@ -233,7 +233,7 @@ class Compiler {
 
 
 	/**
 	/**
 		Mark a class (or array of classes) with the metadata @:keep.
 		Mark a class (or array of classes) with the metadata @:keep.
-		
+
 		Note that this does not imply inclusion of the class(es): If a class is
 		Note that this does not imply inclusion of the class(es): If a class is
 		neither referenced nor added via [Compiler.include], it will not be part
 		neither referenced nor added via [Compiler.include], it will not be part
 		of the output even if @:keep was added.
 		of the output even if @:keep was added.

+ 6 - 6
std/haxe/macro/ComplexTypeTools.hx

@@ -30,25 +30,25 @@ import haxe.macro.Expr;
 	additional methods on haxe.macro.Expr.ComplexType instances.
 	additional methods on haxe.macro.Expr.ComplexType instances.
 **/
 **/
 class ComplexTypeTools {
 class ComplexTypeTools {
-	
+
 	/**
 	/**
 		Converts type [c] to a human-readable String representation.
 		Converts type [c] to a human-readable String representation.
-		
+
 		The result is guaranteed to be valid haxe code, but there may be
 		The result is guaranteed to be valid haxe code, but there may be
 		differences from the original lexical syntax.
 		differences from the original lexical syntax.
 	**/
 	**/
 	static public function toString( c : ComplexType ) : String
 	static public function toString( c : ComplexType ) : String
 		return new Printer().printComplexType(c);
 		return new Printer().printComplexType(c);
-		
+
 	#if macro
 	#if macro
-	
+
 	/**
 	/**
 		Returns a type corresponding to [c].
 		Returns a type corresponding to [c].
-		
+
 		If [c] is null, the result is null.
 		If [c] is null, the result is null.
 	**/
 	**/
 	static public function toType( c : ComplexType ) : Null<Type>
 	static public function toType( c : ComplexType ) : Null<Type>
 		return c == null ? null : haxe.macro.Context.typeof( { expr: ECheckType(macro null, c), pos: Context.currentPos() } );
 		return c == null ? null : haxe.macro.Context.typeof( { expr: ECheckType(macro null, c), pos: Context.currentPos() } );
-		
+
 	#end
 	#end
 }
 }

+ 5 - 5
std/haxe/macro/ExprTools.hx

@@ -211,7 +211,7 @@ class ExprTools {
 
 
 	/**
 	/**
 		Returns the value `e` represents.
 		Returns the value `e` represents.
-		
+
 		Supported expressions are:
 		Supported expressions are:
 			- `Int`, `Float` and `String` literals
 			- `Int`, `Float` and `String` literals
 			- identifiers `true`, `false` and `null`
 			- identifiers `true`, `false` and `null`
@@ -219,12 +219,12 @@ class ExprTools {
 			- array declarations if all their elements are values
 			- array declarations if all their elements are values
 			- unary operators `-`, `!` and `~` if the operand is a value
 			- unary operators `-`, `!` and `~` if the operand is a value
 			- binary operators except `=>`, `...` and assignments
 			- binary operators except `=>`, `...` and assignments
-			
+
 		Parentheses, metadata and the `untyped` keyword are ignored.
 		Parentheses, metadata and the `untyped` keyword are ignored.
-		
+
 		If any non-value is encountered, an exception of type `String` is
 		If any non-value is encountered, an exception of type `String` is
 		thrown.
 		thrown.
-		
+
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
 	static public function getValue(e:Expr):Dynamic {
 	static public function getValue(e:Expr):Dynamic {
@@ -279,7 +279,7 @@ class ExprTools {
 			case _: throw 'Unsupported expression: $e';
 			case _: throw 'Unsupported expression: $e';
 		}
 		}
 	}
 	}
-	
+
 	static inline function opt(e:Null<Expr>, f : Expr -> Expr):Expr
 	static inline function opt(e:Null<Expr>, f : Expr -> Expr):Expr
 		return e == null ? null : f(e);
 		return e == null ? null : f(e);
 
 

+ 16 - 16
std/haxe/macro/MacroStringTools.hx

@@ -30,62 +30,62 @@ import haxe.macro.Expr;
 **/
 **/
 class MacroStringTools {
 class MacroStringTools {
 	#if macro
 	#if macro
-	
-	
+
+
 	/**
 	/**
 		Formats `String` `s` using the usual interpolation rules.
 		Formats `String` `s` using the usual interpolation rules.
-		
+
 		The returned expression is a concatenation of string parts and escaped
 		The returned expression is a concatenation of string parts and escaped
 		elements.
 		elements.
 	**/
 	**/
 	static public function formatString(s:String, pos:Position) {
 	static public function formatString(s:String, pos:Position) {
 		return Context.load("format_string", 2)(untyped s.__s, pos);
 		return Context.load("format_string", 2)(untyped s.__s, pos);
 	}
 	}
-	
+
 	/**
 	/**
 		Tells if `e` is a format string, i.e. uses single quotes `'` as
 		Tells if `e` is a format string, i.e. uses single quotes `'` as
 		delimiters.
 		delimiters.
-		
+
 		This operation depends on the position of `e`.
 		This operation depends on the position of `e`.
 	**/
 	**/
 	static public function isFormatExpr(e:ExprOf<String>) {
 	static public function isFormatExpr(e:ExprOf<String>) {
 		return Context.load("is_fmt_string", 1)(e.pos);
 		return Context.load("is_fmt_string", 1)(e.pos);
 	}
 	}
-	
+
 	/**
 	/**
 		Converts an array of Strings `sl` to a field expression.
 		Converts an array of Strings `sl` to a field expression.
-		
+
 		If `sl` has no elements, the result is null.
 		If `sl` has no elements, the result is null.
-		
+
 		If `sl` has one element, the result is `EConst(CIdent(sl[0])`.
 		If `sl` has one element, the result is `EConst(CIdent(sl[0])`.
-		
+
 		Otherwise the result is a chain of `EField` nodes.
 		Otherwise the result is a chain of `EField` nodes.
-		
+
 		If `sl` is null, the result is unspecified.
 		If `sl` is null, the result is unspecified.
 	**/
 	**/
 	static public function toFieldExpr(sl:Array<String>):Expr {
 	static public function toFieldExpr(sl:Array<String>):Expr {
 		return Lambda.fold(sl, function(s, e) return e == null ? (macro $i{s}) : (macro $e.$s), null);
 		return Lambda.fold(sl, function(s, e) return e == null ? (macro $i{s}) : (macro $e.$s), null);
 	}
 	}
-	
+
 	/**
 	/**
 		Converts a path given by package `pack` and name `name` to a `String`
 		Converts a path given by package `pack` and name `name` to a `String`
 		separated by dots.
 		separated by dots.
-		
+
 		If `pack` has no elements, the result is `name`.
 		If `pack` has no elements, the result is `name`.
-		
+
 		If `pack` is null, the result is unspecified.
 		If `pack` is null, the result is unspecified.
-		
+
 		Otherwise the elements of `pack` are joined with a separating dot, with
 		Otherwise the elements of `pack` are joined with a separating dot, with
 		an appended dot separating the result from `name`.
 		an appended dot separating the result from `name`.
 	**/
 	**/
 	static public function toDotPath(pack:Array<String>, name:String):String {
 	static public function toDotPath(pack:Array<String>, name:String):String {
 		return if (pack.length == 0) name else pack.join(".") + "." +name;
 		return if (pack.length == 0) name else pack.join(".") + "." +name;
 	}
 	}
-	
+
 	static public function toComplex( path : String ) : ComplexType {
 	static public function toComplex( path : String ) : ComplexType {
 		var pack = path.split(".");
 		var pack = path.split(".");
 		return TPath( { pack : pack, name : pack.pop(), params : [] } );
 		return TPath( { pack : pack, name : pack.pop(), params : [] } );
 	}
 	}
-	
+
 	#end
 	#end
 }
 }

+ 6 - 6
std/haxe/macro/Printer.hx

@@ -115,7 +115,7 @@ class Printer {
 		case ADynamic: "dynamic";
 		case ADynamic: "dynamic";
 		case AMacro: "macro";
 		case AMacro: "macro";
 	}
 	}
-	
+
 	public function printField(field:Field) return
 	public function printField(field:Field) return
 		(field.doc != null && field.doc != "" ? "/**\n" + tabs + tabString + StringTools.replace(field.doc, "\n", "\n" + tabs + tabString) + "\n" + tabs + "**/\n" + tabs : "")
 		(field.doc != null && field.doc != "" ? "/**\n" + tabs + tabString + StringTools.replace(field.doc, "\n", "\n" + tabs + tabString) + "\n" + tabs + "**/\n" + tabs : "")
 		+ (field.meta != null && field.meta.length > 0 ? field.meta.map(printMetadata).join('\n$tabs') + '\n$tabs' : "")
 		+ (field.meta != null && field.meta.length > 0 ? field.meta.map(printMetadata).join('\n$tabs') + '\n$tabs' : "")
@@ -211,21 +211,21 @@ class Printer {
 	public function printExprs(el:Array<Expr>, sep:String) {
 	public function printExprs(el:Array<Expr>, sep:String) {
 		return el.map(printExpr).join(sep);
 		return el.map(printExpr).join(sep);
 	}
 	}
-	
+
 	function printExtension(tpl:Array<TypePath>, fields: Array<Field>) {
 	function printExtension(tpl:Array<TypePath>, fields: Array<Field>) {
 		return '{\n$tabs>' + tpl.map(printTypePath).join(',\n$tabs>') + ","
 		return '{\n$tabs>' + tpl.map(printTypePath).join(',\n$tabs>') + ","
 		    + (fields.length > 0 ? ('\n$tabs' + fields.map(printField).join(';\n$tabs') + ";\n}") : ("\n}"));
 		    + (fields.length > 0 ? ('\n$tabs' + fields.map(printField).join(';\n$tabs') + ";\n}") : ("\n}"));
 	}
 	}
-	
+
 	function printStructure(fields:Array<Field>) {
 	function printStructure(fields:Array<Field>) {
 		return fields.length == 0 ? "{ }" :
 		return fields.length == 0 ? "{ }" :
 			'{\n$tabs' + fields.map(printField).join(';\n$tabs') + ";\n}";
 			'{\n$tabs' + fields.map(printField).join(';\n$tabs') + ";\n}";
 	}
 	}
-	
+
 	public function printTypeDefinition(t:TypeDefinition, printPackage = true):String {
 	public function printTypeDefinition(t:TypeDefinition, printPackage = true):String {
 		var old = tabs;
 		var old = tabs;
 		tabs = tabString;
 		tabs = tabString;
-		
+
 		var str = t == null ? "#NULL" :
 		var str = t == null ? "#NULL" :
 			(printPackage && t.pack.length > 0 && t.pack[0] != "" ? "package " + t.pack.join(".") + ";\n" : "") +
 			(printPackage && t.pack.length > 0 && t.pack[0] != "" ? "package " + t.pack.join(".") + ";\n" : "") +
 			(t.meta != null && t.meta.length > 0 ? t.meta.map(printMetadata).join(" ") + " " : "") + (t.isExtern ? "extern " : "") + switch (t.kind) {
 			(t.meta != null && t.meta.length > 0 ? t.meta.map(printMetadata).join(" ") + " " : "") + (t.isExtern ? "extern " : "") + switch (t.kind) {
@@ -286,7 +286,7 @@ class Printer {
 					}].join("\n")
 					}].join("\n")
 					+ "\n}";
 					+ "\n}";
 			}
 			}
-		
+
 		tabs = old;
 		tabs = old;
 		return str;
 		return str;
 	}
 	}

+ 11 - 11
std/haxe/macro/Type.hx

@@ -144,42 +144,42 @@ typedef AbstractType = {>BaseType,
 typedef MetaAccess = {
 typedef MetaAccess = {
 	/**
 	/**
 		Return the wrapped `Metadata` array.
 		Return the wrapped `Metadata` array.
-		
+
 		Modifying this array has no effect on the origin of `this` MetaAccess.
 		Modifying this array has no effect on the origin of `this` MetaAccess.
 		The `add` and `remove` methods can be used for that.
 		The `add` and `remove` methods can be used for that.
 	**/
 	**/
 	function get() : Expr.Metadata;
 	function get() : Expr.Metadata;
-	
+
 	/**
 	/**
 		Adds the metadata specified by `name`, `params` and `pos` to the origin
 		Adds the metadata specified by `name`, `params` and `pos` to the origin
 		of `this` MetaAccess.
 		of `this` MetaAccess.
-		
+
 		Metadata names are not unique during compilation, so this method never
 		Metadata names are not unique during compilation, so this method never
 		overwrites a previous metadata.
 		overwrites a previous metadata.
-		
+
 		If a `Metadata` array is obtained through a call to `get`, a subsequent
 		If a `Metadata` array is obtained through a call to `get`, a subsequent
 		call to `add` has no effect on that array.
 		call to `add` has no effect on that array.
-		
+
 		If any argument is null, compilation fails with an error.
 		If any argument is null, compilation fails with an error.
 	**/
 	**/
 	function add( name : String, params : Array<Expr>, pos : Expr.Position ) : Void;
 	function add( name : String, params : Array<Expr>, pos : Expr.Position ) : Void;
-	
+
 	/**
 	/**
 		Removes all `name` metadata entries from the origin of `this`
 		Removes all `name` metadata entries from the origin of `this`
 		MetaAccess.
 		MetaAccess.
-		
+
 		This method might clear several metadata entries of the same name.
 		This method might clear several metadata entries of the same name.
-		
+
 		If a `Metadata` array is obtained through a call to `get`, a subsequent
 		If a `Metadata` array is obtained through a call to `get`, a subsequent
 		call to `remove` has no effect on that array.
 		call to `remove` has no effect on that array.
-		
+
 		If `name` is null, compilation fails with an error.
 		If `name` is null, compilation fails with an error.
 	**/
 	**/
 	function remove( name : String ) : Void;
 	function remove( name : String ) : Void;
-	
+
 	/**
 	/**
 		Tells if the origin of `this` MetaAccess has a `name` metadata entry.
 		Tells if the origin of `this` MetaAccess has a `name` metadata entry.
-		
+
 		If `name` is null, compilation fails with an error.
 		If `name` is null, compilation fails with an error.
 	**/
 	**/
 	function has( name : String ) : Bool;
 	function has( name : String ) : Bool;

+ 29 - 29
std/haxe/macro/TypeTools.hx

@@ -35,18 +35,18 @@ using Lambda;
 **/
 **/
 class TypeTools {
 class TypeTools {
 	#if macro
 	#if macro
-	
+
 	/**
 	/**
 		Follows all typedefs of `t` to reach the actual type.
 		Follows all typedefs of `t` to reach the actual type.
-		
+
 		If `once` is true, this function does not call itself recursively,
 		If `once` is true, this function does not call itself recursively,
 		otherwise it does. This can be useful in cases where intermediate
 		otherwise it does. This can be useful in cases where intermediate
 		typedefs might be of interest.
 		typedefs might be of interest.
-		
+
 		Affected types are monomorphs `TMono` and typedefs `TType(t,pl)`.
 		Affected types are monomorphs `TMono` and typedefs `TType(t,pl)`.
-		
+
 		If `t` is null, an internal exception is thrown.
 		If `t` is null, an internal exception is thrown.
-		
+
 		Usage example:
 		Usage example:
 			var t = Context.typeof(macro null); // TMono(<mono>)
 			var t = Context.typeof(macro null); // TMono(<mono>)
 			var ts = Context.typeof(macro "foo"); //TInst(String,[])
 			var ts = Context.typeof(macro "foo"); //TInst(String,[])
@@ -56,30 +56,30 @@ class TypeTools {
 	**/
 	**/
 	static public inline function follow( t : Type, ?once : Bool ) : Type
 	static public inline function follow( t : Type, ?once : Bool ) : Type
 		return Context.follow(t, once);
 		return Context.follow(t, once);
-		
+
 	/**
 	/**
 		Returns true if `t1` and `t2` unify, false otherwise.
 		Returns true if `t1` and `t2` unify, false otherwise.
 	**/
 	**/
 	static public inline function unify( t1 : Type, t2:Type ) : Bool
 	static public inline function unify( t1 : Type, t2:Type ) : Bool
 		return Context.unify(t1, t2);
 		return Context.unify(t1, t2);
-		
+
 	/**
 	/**
 		Returns a syntax-level type corresponding to Type `t`.
 		Returns a syntax-level type corresponding to Type `t`.
-		
+
 		This function is mostly inverse to `ComplexTypeTools.toType`, but may
 		This function is mostly inverse to `ComplexTypeTools.toType`, but may
 		lose some information on types that do not have a corresponding syntax
 		lose some information on types that do not have a corresponding syntax
 		version, such as monomorphs. In these cases, the result is null.
 		version, such as monomorphs. In these cases, the result is null.
-		
+
 		If `t` is null, an internal exception is thrown.
 		If `t` is null, an internal exception is thrown.
 	**/
 	**/
 	static public inline function toComplexType( t : Type ) : ComplexType
 	static public inline function toComplexType( t : Type ) : ComplexType
 		return Context.toComplexType(t);
 		return Context.toComplexType(t);
-		
+
 	/**
 	/**
 		Tries to extract the class instance stored inside `t`.
 		Tries to extract the class instance stored inside `t`.
-		
+
 		If `t` is a class instance `TInst(c,pl)`, c is returned.
 		If `t` is a class instance `TInst(c,pl)`, c is returned.
-		
+
 		If `t` is of a different type, an exception of type String is thrown.
 		If `t` is of a different type, an exception of type String is thrown.
 
 
 		If `t` is null, the result is null.
 		If `t` is null, the result is null.
@@ -88,12 +88,12 @@ class TypeTools {
 		case TInst(c, _): c.get();
 		case TInst(c, _): c.get();
 		case _: throw "Class instance expected";
 		case _: throw "Class instance expected";
 	}
 	}
-	
+
 	/**
 	/**
 		Tries to extract the enum instance stored inside `t`.
 		Tries to extract the enum instance stored inside `t`.
-		
+
 		If `t` is an enum instance `TEnum(e,pl)`, e is returned.
 		If `t` is an enum instance `TEnum(e,pl)`, e is returned.
-		
+
 		If `t` is of a different type, an exception of type String is thrown.
 		If `t` is of a different type, an exception of type String is thrown.
 
 
 		If `t` is null, the result is null.
 		If `t` is null, the result is null.
@@ -106,16 +106,16 @@ class TypeTools {
 	/**
 	/**
 		Applies the type parameters `typeParameters` to type `t` with the given
 		Applies the type parameters `typeParameters` to type `t` with the given
 		types `concreteTypes`.
 		types `concreteTypes`.
-		
+
 		This function replaces occurences of type parameters in `t` if they are
 		This function replaces occurences of type parameters in `t` if they are
 		part of `typeParameters`. The array index of such a type parameter is
 		part of `typeParameters`. The array index of such a type parameter is
 		then used to lookup the concrete type in `concreteTypes`.
 		then used to lookup the concrete type in `concreteTypes`.
-		
+
 		If `typeParameters.length` is not equal to `concreteTypes.length`, an
 		If `typeParameters.length` is not equal to `concreteTypes.length`, an
 		exception of type `String` is thrown.
 		exception of type `String` is thrown.
-		
+
 		If `typeParameters.length` is 0, `t` is returned unchanged.
 		If `typeParameters.length` is 0, `t` is returned unchanged.
-		
+
 		If either argument is `null`, the result is unspecified.
 		If either argument is `null`, the result is unspecified.
 	**/
 	**/
 	static public function applyTypeParameters(t:Type, typeParameters:Array<TypeParameter>, concreteTypes:Array<Type>):Type {
 	static public function applyTypeParameters(t:Type, typeParameters:Array<TypeParameter>, concreteTypes:Array<Type>):Type {
@@ -125,19 +125,19 @@ class TypeTools {
 			return t;
 			return t;
 		return Context.load("apply_params", 3)(typeParameters.map(function(tp) return {name:untyped tp.name.__s, t:tp.t}), concreteTypes, t);
 		return Context.load("apply_params", 3)(typeParameters.map(function(tp) return {name:untyped tp.name.__s, t:tp.t}), concreteTypes, t);
 	}
 	}
-	
+
 	/**
 	/**
 		Transforms `t` by calling `f` on each of its subtypes.
 		Transforms `t` by calling `f` on each of its subtypes.
-		
+
 		If `t` is a compound type, `f` is called on each of its components.
 		If `t` is a compound type, `f` is called on each of its components.
-		
+
 		Otherwise `t` is returned unchanged.
 		Otherwise `t` is returned unchanged.
-		
+
 		The following types are considered compound:
 		The following types are considered compound:
 			- TInst, TEnum, TType and TAbstract with type parameters
 			- TInst, TEnum, TType and TAbstract with type parameters
 			- TFun
 			- TFun
 			- TAnonymous
 			- TAnonymous
-			
+
 		If `t` or `f` are null, the result is unspecified.
 		If `t` or `f` are null, the result is unspecified.
 	**/
 	**/
 	static public function map(t:Type, f:Type -> Type):Type {
 	static public function map(t:Type, f:Type -> Type):Type {
@@ -173,23 +173,23 @@ class TypeTools {
 				ft == ft2 ? t : ft2;
 				ft == ft2 ? t : ft2;
 		}
 		}
 	}
 	}
-	
+
 	/**
 	/**
 		Converts type `t` to a human-readable String representation.
 		Converts type `t` to a human-readable String representation.
 	**/
 	**/
 	static public function toString( t : Type ) : String return new String(Context.load("s_type", 1)(t));
 	static public function toString( t : Type ) : String return new String(Context.load("s_type", 1)(t));
 	#end
 	#end
-	
+
 	/**
 	/**
 		Resolves the field named `name` on class `c`.
 		Resolves the field named `name` on class `c`.
-		
+
 		If `isStatic` is true, the classes' static fields are checked. Otherwise
 		If `isStatic` is true, the classes' static fields are checked. Otherwise
 		the classes' member fields are checked.
 		the classes' member fields are checked.
-		
+
 		If the field is found, it is returned. Otherwise if `c` has a super
 		If the field is found, it is returned. Otherwise if `c` has a super
 		class, `findField` recursively checks that super class. Otherwise null
 		class, `findField` recursively checks that super class. Otherwise null
 		is returned.
 		is returned.
-		
+
 		If any argument is null, the result is unspecified.
 		If any argument is null, the result is unspecified.
 	**/
 	**/
 	static public function findField(c:ClassType, name:String, isStatic:Bool = false):Null<ClassField> {
 	static public function findField(c:ClassType, name:String, isStatic:Bool = false):Null<ClassField> {

+ 8 - 8
std/haxe/macro/TypedExprTools.hx

@@ -27,7 +27,7 @@ import haxe.macro.Type;
 
 
 class TypedExprTools {
 class TypedExprTools {
 	#if macro
 	#if macro
-	
+
 	static function with(e:TypedExpr, ?edef:TypedExprDef, ?t:Type) {
 	static function with(e:TypedExpr, ?edef:TypedExprDef, ?t:Type) {
 		return {
 		return {
 			expr: edef == null ? e.expr : edef,
 			expr: edef == null ? e.expr : edef,
@@ -35,10 +35,10 @@ class TypedExprTools {
 			t: t == null ? e.t : t
 			t: t == null ? e.t : t
 		}
 		}
 	}
 	}
-	
+
 	/**
 	/**
 		Transforms the sub-expressions of [e] by calling [f] on each of them.
 		Transforms the sub-expressions of [e] by calling [f] on each of them.
-		
+
 		See `haxe.macro.ExprTools.map` for details on expression mapping in
 		See `haxe.macro.ExprTools.map` for details on expression mapping in
 		general. This function works the same way, but with a different data
 		general. This function works the same way, but with a different data
 		structure.
 		structure.
@@ -62,7 +62,7 @@ class TypedExprTools {
 			case TCall(e1, el): with(e, TCall(f(e1), el.map(f)));
 			case TCall(e1, el): with(e, TCall(f(e1), el.map(f)));
 			case TVar(v,eo): with(e, TVar(v, eo == null ? null : f(eo)));
 			case TVar(v,eo): with(e, TVar(v, eo == null ? null : f(eo)));
 			case TFunction(fu): with(e, TFunction({ t: fu.t, args: fu.args, expr: f(fu.expr)}));
 			case TFunction(fu): with(e, TFunction({ t: fu.t, args: fu.args, expr: f(fu.expr)}));
-			case TIf(e1, e2, e3): with(e, TIf(f(e1), f(e2), f(e3)));
+			case TIf(e1, e2, e3): with(e, TIf(f(e1), f(e2), e3 == null ? null : f(e3)));
 			case TSwitch(e1, cases, e2): with(e, TSwitch(e1, cases.map(function(c) return { values: c.values, expr: f(c.expr) }), e2 == null ? null : f(e2)));
 			case TSwitch(e1, cases, e2): with(e, TSwitch(e1, cases.map(function(c) return { values: c.values, expr: f(c.expr) }), e2 == null ? null : f(e2)));
 			case TPatMatch: throw false;
 			case TPatMatch: throw false;
 			case TTry(e1, catches): with(e, TTry(f(e1), catches.map(function(c) return { v:c.v, expr: f(c.expr) })));
 			case TTry(e1, catches): with(e, TTry(f(e1), catches.map(function(c) return { v:c.v, expr: f(c.expr) })));
@@ -71,12 +71,12 @@ class TypedExprTools {
 			case TMeta(m, e1): with(e, TMeta(m, f(e1)));
 			case TMeta(m, e1): with(e, TMeta(m, f(e1)));
 		}
 		}
 	}
 	}
-	
+
 	/**
 	/**
 		Transforms the sub-expressions of [e] by calling [f] on each of them.
 		Transforms the sub-expressions of [e] by calling [f] on each of them.
 		Additionally, types are mapped using `ft` and variables are mapped using
 		Additionally, types are mapped using `ft` and variables are mapped using
 		`fv`.
 		`fv`.
-		
+
 		See `haxe.macro.ExprTools.map` for details on expression mapping in
 		See `haxe.macro.ExprTools.map` for details on expression mapping in
 		general. This function works the same way, but with a different data
 		general. This function works the same way, but with a different data
 		structure.
 		structure.
@@ -101,7 +101,7 @@ class TypedExprTools {
 			case TCall(e1, el): with(e, TCall(f(e1), el.map(f)), ft(e.t));
 			case TCall(e1, el): with(e, TCall(f(e1), el.map(f)), ft(e.t));
 			case TVar(v,eo): with(e, TVar(fv(v), eo == null ? null : f(eo)), ft(e.t));
 			case TVar(v,eo): with(e, TVar(fv(v), eo == null ? null : f(eo)), ft(e.t));
 			case TFunction(fu): with(e, TFunction({ t: ft(fu.t), args: fu.args.map(function(arg) return { v: fv(arg.v), value: arg.value }), expr: f(fu.expr)}), ft(e.t));
 			case TFunction(fu): with(e, TFunction({ t: ft(fu.t), args: fu.args.map(function(arg) return { v: fv(arg.v), value: arg.value }), expr: f(fu.expr)}), ft(e.t));
-			case TIf(e1, e2, e3): with(e, TIf(f(e1), f(e2), f(e3)), ft(e.t));
+			case TIf(e1, e2, e3): with(e, TIf(f(e1), f(e2), e3 == null ? null : f(e3)), ft(e.t));
 			case TSwitch(e1, cases, e2): with(e, TSwitch(e1, cases.map(function(c) return { values: c.values, expr: f(c.expr) }), e2 == null ? null : f(e2)), ft(e.t));
 			case TSwitch(e1, cases, e2): with(e, TSwitch(e1, cases.map(function(c) return { values: c.values, expr: f(c.expr) }), e2 == null ? null : f(e2)), ft(e.t));
 			case TPatMatch: throw false;
 			case TPatMatch: throw false;
 			case TTry(e1, catches): with(e, TTry(f(e1), catches.map(function(c) return { v:fv(c.v), expr: f(c.expr) })), ft(e.t));
 			case TTry(e1, catches): with(e, TTry(f(e1), catches.map(function(c) return { v:fv(c.v), expr: f(c.expr) })), ft(e.t));
@@ -110,7 +110,7 @@ class TypedExprTools {
 			case TMeta(m, e1): with(e, TMeta(m, f(e1)), ft(e.t));
 			case TMeta(m, e1): with(e, TMeta(m, f(e1)), ft(e.t));
 		}
 		}
 	}
 	}
-	
+
 	static public function toString(t:TypedExpr, ?pretty = false):String {
 	static public function toString(t:TypedExpr, ?pretty = false):String {
 		return new String(Context.load("s_expr", 2)(t, pretty));
 		return new String(Context.load("s_expr", 2)(t, pretty));
 	}
 	}

+ 1 - 1
std/haxe/rtti/Meta.hx

@@ -40,7 +40,7 @@ class Meta {
 
 
 	/**
 	/**
 		Returns the metadata that were declared for the given class static fields
 		Returns the metadata that were declared for the given class static fields
-	**/	
+	**/
 	public static function getStatics( t : Dynamic ) : Dynamic<Dynamic<Array<Dynamic>>> {
 	public static function getStatics( t : Dynamic ) : Dynamic<Dynamic<Array<Dynamic>>> {
 		#if (java || cs)
 		#if (java || cs)
 		var meta : Dynamic = Reflect.field(t, "__meta__");
 		var meta : Dynamic = Reflect.field(t, "__meta__");

+ 1 - 1
std/haxe/rtti/XmlParser.hx

@@ -333,7 +333,7 @@ class XmlParser {
 		}
 		}
 		return ml;
 		return ml;
 	}
 	}
-	
+
 	function xoverloads( x : Fast ) : List<ClassField> {
 	function xoverloads( x : Fast ) : List<ClassField> {
 		var l = new List();
 		var l = new List();
 		for ( m in x.elements ) {
 		for ( m in x.elements ) {

+ 6 - 6
std/haxe/xml/Parser.hx

@@ -58,14 +58,14 @@ class Parser
 		h.set("nbsp", String.fromCharCode(160));
 		h.set("nbsp", String.fromCharCode(160));
 		h;
 		h;
 	}
 	}
-	
+
 	static public function parse(str:String)
 	static public function parse(str:String)
 	{
 	{
 		var doc = Xml.createDocument();
 		var doc = Xml.createDocument();
 		doParse(str, 0, doc);
 		doParse(str, 0, doc);
 		return doc;
 		return doc;
 	}
 	}
-	
+
 	static function doParse(str:String, p:Int = 0, ?parent:Xml):Int
 	static function doParse(str:String, p:Int = 0, ?parent:Xml):Int
 	{
 	{
 		var xml:Xml = null;
 		var xml:Xml = null;
@@ -323,23 +323,23 @@ class Parser
 			}
 			}
 			c = str.fastCodeAt(++p);
 			c = str.fastCodeAt(++p);
 		}
 		}
-		
+
 		if (state == S.BEGIN)
 		if (state == S.BEGIN)
 		{
 		{
 			start = p;
 			start = p;
 			state = S.PCDATA;
 			state = S.PCDATA;
 		}
 		}
-		
+
 		if (state == S.PCDATA)
 		if (state == S.PCDATA)
 		{
 		{
 			if (p != start || nsubs == 0)
 			if (p != start || nsubs == 0)
 				parent.addChild(Xml.createPCData(buf.toString() + str.substr(start, p - start)));
 				parent.addChild(Xml.createPCData(buf.toString() + str.substr(start, p - start)));
 			return p;
 			return p;
 		}
 		}
-		
+
 		throw "Unexpected end";
 		throw "Unexpected end";
 	}
 	}
-	
+
 	static inline function isValidChar(c) {
 	static inline function isValidChar(c) {
 		return (c >= 'a'.code && c <= 'z'.code) || (c >= 'A'.code && c <= 'Z'.code) || (c >= '0'.code && c <= '9'.code) || c == ':'.code || c == '.'.code || c == '_'.code || c == '-'.code;
 		return (c >= 'a'.code && c <= 'z'.code) || (c >= 'A'.code && c <= 'Z'.code) || (c >= '0'.code && c <= '9'.code) || c == ':'.code || c == '.'.code || c == '_'.code || c == '-'.code;
 	}
 	}

Some files were not shown because too many files changed in this diff