Explorar o código

Merge pull request #4206 from HaxeFoundation/development

3.2.0
Simon Krajewski %!s(int64=10) %!d(string=hai) anos
pai
achega
77d171b15c
Modificáronse 100 ficheiros con 1481 adicións e 545 borrados
  1. 2 0
      .gitignore
  2. 38 9
      .travis.yml
  3. 1 0
      CONTRIBUTING.md
  4. 21 10
      Makefile
  5. 11 0
      Makefile.version_extra
  6. 16 6
      Makefile.win
  7. 8 8
      README.md
  8. 1 0
      analyzer.ml
  9. 30 26
      appveyor.yml
  10. 2 0
      ast.ml
  11. 2 3
      common.ml
  12. 34 1
      extra/CHANGES.txt
  13. 1 1
      extra/haxelib_src
  14. 22 13
      filters.ml
  15. 89 46
      gencommon.ml
  16. 193 96
      gencpp.ml
  17. 17 2
      gencs.ml
  18. 0 2
      genjava.ml
  19. 3 3
      genjs.ml
  20. 3 3
      genphp.ml
  21. 6 1
      genpy.ml
  22. 16 5
      interp.ml
  23. 1 1
      libs
  24. 22 26
      main.ml
  25. 28 19
      matcher.ml
  26. 1 1
      std/IntIterator.hx
  27. 57 57
      std/Math.hx
  28. 5 5
      std/Std.hx
  29. 2 5
      std/StringTools.hx
  30. 17 6
      std/Xml.hx
  31. 11 0
      std/cpp/ArrayBase.hx
  32. 17 0
      std/cpp/Callable.hx
  33. 1 1
      std/cpp/CastCharStar.hx
  34. 4 1
      std/cpp/ConstCharStar.hx
  35. 3 2
      std/cpp/ConstPointer.hx
  36. 19 49
      std/cpp/Lib.hx
  37. 16 0
      std/cpp/NativeArray.hx
  38. 2 0
      std/cpp/Pointer.hx
  39. 123 0
      std/cpp/Prime.hx
  40. 2 3
      std/cpp/_std/Sys.hx
  41. 7 0
      std/cpp/_std/haxe/ds/IntMap.hx
  42. 9 0
      std/cpp/_std/haxe/ds/ObjectMap.hx
  43. 7 0
      std/cpp/_std/haxe/ds/StringMap.hx
  44. 7 0
      std/cpp/_std/haxe/ds/WeakMap.hx
  45. 17 0
      std/cpp/link/StaticMysql.hx
  46. 16 0
      std/cpp/link/StaticRegexp.hx
  47. 17 0
      std/cpp/link/StaticSqlite.hx
  48. 17 0
      std/cpp/link/StaticStd.hx
  49. 16 0
      std/cpp/link/StaticZlib.hx
  50. 1 1
      std/cpp/vm/Thread.hx
  51. 1 1
      std/cs/Lib.hx
  52. 1 1
      std/cs/Pointer.hx
  53. 12 18
      std/cs/_std/Math.hx
  54. 15 16
      std/cs/_std/Std.hx
  55. 1 1
      std/cs/internal/FieldLookup.hx
  56. 1 1
      std/cs/internal/Runtime.hx
  57. 1 0
      std/haxe/CallStack.hx
  58. 4 0
      std/haxe/Http.hx
  59. 1 1
      std/haxe/Int32.hx
  60. 1 1
      std/haxe/Template.hx
  61. 3 0
      std/haxe/crypto/Adler32.hx
  62. 4 4
      std/haxe/crypto/BaseCode.hx
  63. 4 1
      std/haxe/crypto/Crc32.hx
  64. 7 1
      std/haxe/crypto/Hmac.hx
  65. 3 0
      std/haxe/crypto/Sha1.hx
  66. 3 0
      std/haxe/crypto/Sha224.hx
  67. 3 0
      std/haxe/crypto/Sha256.hx
  68. 1 1
      std/haxe/ds/Vector.hx
  69. 3 4
      std/haxe/macro/Compiler.hx
  70. 6 2
      std/haxe/macro/Type.hx
  71. 2 4
      std/haxe/macro/TypedExprTools.hx
  72. 13 13
      std/haxe/xml/Parser.hx
  73. 3 1
      std/java/_std/Math.hx
  74. 16 16
      std/java/_std/Std.hx
  75. 16 0
      std/java/lang/Boolean.hx
  76. 16 0
      std/java/lang/Byte.hx
  77. 183 0
      std/java/lang/Character.hx
  78. 33 0
      std/java/lang/Double.hx
  79. 33 0
      std/java/lang/Float.hx
  80. 30 0
      std/java/lang/Integer.hx
  81. 30 0
      std/java/lang/Long.hx
  82. 17 0
      std/java/lang/Short.hx
  83. 7 9
      std/js/Boot.hx
  84. 2 1
      std/js/_std/haxe/io/Bytes.hx
  85. 1 0
      std/js/_std/haxe/io/Float32Array.hx
  86. 1 0
      std/js/_std/haxe/io/Float64Array.hx
  87. 1 0
      std/js/_std/haxe/io/Int32Array.hx
  88. 1 0
      std/js/_std/haxe/io/UInt16Array.hx
  89. 1 0
      std/js/_std/haxe/io/UInt32Array.hx
  90. 1 0
      std/js/_std/haxe/io/UInt8Array.hx
  91. 1 1
      std/js/html/Animation.hx
  92. 1 1
      std/js/html/ApplicationCache.hx
  93. 1 1
      std/js/html/Attr.hx
  94. 1 1
      std/js/html/AudioTrackList.hx
  95. 2 2
      std/js/html/CanvasRenderingContext2D.hx
  96. 2 2
      std/js/html/CharacterData.hx
  97. 16 15
      std/js/html/Console.hx
  98. 11 10
      std/js/html/DOMElement.hx
  99. 2 2
      std/js/html/DOMImplementation.hx
  100. 1 1
      std/js/html/DOMParser.hx

+ 2 - 0
.gitignore

@@ -6,6 +6,7 @@
 *.a
 *.exe
 .*.swp
+/out
 
 /extra/hxclasses
 /extra/*.swf
@@ -70,3 +71,4 @@ tests/misc/projects/*/*.n
 tests/unit/bin/
 tests/*.n
 tests/misc/projects/Issue3756/cpp/
+tests/misc/projects/Issue4070/cpp/

+ 38 - 9
.travis.yml

@@ -6,6 +6,10 @@ os:
 
 env:
   global:
+    # make variables
+    - OCAMLC=ocamlc.opt
+    - OCAMLOPT=ocamlopt.opt
+    - ADD_REVISION=1
     # SAUCE_USERNAME
     - secure: SjyKefmjUEXi0IKHGGpcbLAajU0mLHONg8aA8LoY7Q9nAkSN6Aql+fzS38Boq7w1jWn+2FOpr+4jy0l6wVd/bftsF+huFfYpFJmdh8BlKmE0K71zZAral0H1c7YxkuQpPiJCIFGXqtkvev7SWTy0z31u7kuuQeEyW27boXe5cDA=
     # SAUCE_ACCESS_KEY
@@ -27,26 +31,51 @@ matrix:
   # fast_finish: true #https://github.com/travis-ci/travis-ci/issues/1696
 
 before_script:
-  - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then mysql -u root -e "CREATE DATABASE haxe_test;"; fi
+  - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
+    mysql -u root -e "CREATE DATABASE haxe_test;";
+    fi
 
 install:
-  - if [ -z "${TRAVIS_OS_NAME}" ]; then export TRAVIS_OS_NAME=linux; fi; # for our forks that do not have mult-os enabled.
-  - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then travis_retry sudo apt-get update -qq; travis_retry sudo apt-get install ocaml-native-compilers zlib1g-dev libgc-dev -qq; fi
-  - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then travis_retry brew update; travis_retry brew install caskroom/cask/brew-cask; travis_retry brew install ocaml camlp4; fi
-  - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then travis_retry git clone https://github.com/HaxeFoundation/neko.git ~/neko && cd ~/neko && make os=${TRAVIS_OS_NAME} -s && sudo make install -s && cd $TRAVIS_BUILD_DIR; fi
-  - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then travis_retry brew install neko --HEAD; fi
+  # For our forks that do not have mult-os enabled...
+  - if [ -z "${TRAVIS_OS_NAME}" ]; then
+    export TRAVIS_OS_NAME=linux;
+    fi
+  # Install haxe and neko dependencies
+  - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
+    travis_retry sudo apt-get update -qq;
+    travis_retry sudo apt-get install ocaml-native-compilers zlib1g-dev libgc-dev -qq;
+    fi
+  - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
+    travis_retry brew update;
+    travis_retry brew install caskroom/cask/brew-cask;
+    travis_retry brew install ocaml camlp4;
+    fi
+  # Install neko
+  - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
+    travis_retry git clone https://github.com/HaxeFoundation/neko.git ~/neko;
+    cd ~/neko && make os=${TRAVIS_OS_NAME} -s && sudo make install -s;
+    cd $TRAVIS_BUILD_DIR;
+    fi
+  - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
+    travis_retry brew install neko --HEAD;
+    fi
 
 script:
-  - make OCAMLOPT=ocamlopt.opt -s
+  - make -s
   - make tools -s
   - sudo make install -s
   - cd tests/
   - mkdir ~/haxelib && haxelib setup ~/haxelib
-  - haxelib git hx-yaml https://github.com/mikestead/hx-yaml master src
   - haxe -version
-  - haxe -neko RunCi.n -main RunCi -lib hx-yaml
+  - haxe RunCi.hxml
   - neko RunCi.n
 
+branches:
+  except:
+    # A hack to prevent building for tags, assuming they all start with a number.
+    # https://github.com/travis-ci/travis-ci/issues/1532
+    - /^[0-9]/
+
 notifications:
   webhooks:
     urls:

+ 1 - 0
CONTRIBUTING.md

@@ -1,5 +1,6 @@
 Things to check before/while filing an issue:
 
+- Check if you actually suspect that there's an issue in the Haxe code. If you find yourself writing "How do I..." you may want to consider a different communication channel. Refer to http://haxe.org/community/community-support.html for more information.
 - Reduce your code to a minimal example (see http://sscce.org/). In particular avoid library dependencies: If you cannot reproduce your issue without using a specific library, it might not be a Haxe issue to begin with.
 - Check if your problems are already resolved in the Haxe development version (for builds see http://builds.haxe.org/).
 - Most targets produce readable code. If you suspect the generated code to be wrong, try checking the output. Note that you can add `-D dump=pretty` to your compilation parameters and find the code which is passed to the generators in a `dump` sub directory.

+ 21 - 10
Makefile

@@ -16,8 +16,8 @@ INSTALL_LIB_DIR=$(INSTALL_DIR)/lib/haxe
 
 OUTPUT=haxe
 EXTENSION=
-OCAMLOPT=ocamlopt
-OCAMLC=ocamlc
+OCAMLOPT?=ocamlopt
+OCAMLC?=ocamlc
 LFLAGS=
 
 CFLAGS= -g -I libs/extlib -I libs/extc -I libs/neko -I libs/javalib -I libs/ziplib -I libs/swflib -I libs/xml-light -I libs/ttflib -I libs/ilib -I libs/objsize
@@ -51,7 +51,12 @@ MODULES=ast type lexer common genxml parser typecore optimizer typeload \
 	codegen gencommon genas3 gencpp genjs genneko genphp \
 	genswf9 genswf genjava gencs genpy interp dce analyzer filters typer matcher version main
 
-ADD_REVISION=0
+ADD_REVISION?=0
+
+BRANCH=$(shell echo $$APPVEYOR_REPO_NAME | grep -q /haxe && echo $$APPVEYOR_REPO_BRANCH || echo $$TRAVIS_REPO_SLUG | grep -q /haxe && echo $$TRAVIS_BRANCH || git rev-parse --abbrev-ref HEAD)
+COMMIT_SHA=$(shell git rev-parse --short HEAD)
+COMMIT_DATE=$(shell git show -s --format=%ci HEAD | grep -oh ....-..-..)
+PACKAGE_FILE_NAME=haxe_$(COMMIT_DATE)_$(BRANCH)_$(COMMIT_SHA)
 
 # using $(CURDIR) on Windows will not work since it might be a Cygwin path
 ifdef SYSTEMROOT
@@ -60,12 +65,6 @@ else
 	export HAXE_STD_PATH=$(CURDIR)/std
 endif
 
-ifneq ($(ADD_REVISION),0)
-	VERSION_EXTRA="let version_extra = Some \" (git build $(shell git rev-parse --abbrev-ref HEAD) @ $(shell git describe --always)) \""
-else
-	VERSION_EXTRA="let version_extra = None"
-endif
-
 all: libs haxe
 
 libs:
@@ -176,9 +175,21 @@ lexer.$(MODULE_EXT): ast.$(MODULE_EXT)
 ast.$(MODULE_EXT):
 
 version.$(MODULE_EXT):
-	echo $(VERSION_EXTRA) > version.ml
+	$(MAKE) -f Makefile.version_extra -s ADD_REVISION=$(ADD_REVISION) BRANCH=$(BRANCH) COMMIT_SHA=$(COMMIT_SHA) COMMIT_DATE=$(COMMIT_DATE) > version.ml
 	$(COMPILER) $(CFLAGS) -c version.ml
 
+# Package
+
+package_bin:
+	mkdir -p out
+	rm -rf $(PACKAGE_FILE_NAME) $(PACKAGE_FILE_NAME).tar.gz
+	# Copy the package contents to $(PACKAGE_FILE_NAME)
+	mkdir -p $(PACKAGE_FILE_NAME)
+	cp -r $(OUTPUT) haxelib$(EXTENSION) std extra/LICENSE.txt extra/CONTRIB.txt extra/CHANGES.txt $(PACKAGE_FILE_NAME)
+	# archive
+	tar -zcf out/$(PACKAGE_FILE_NAME).tar.gz $(PACKAGE_FILE_NAME)
+	rm -r $(PACKAGE_FILE_NAME)
+
 # Clean
 
 clean: clean_libs clean_haxe clean_tools

+ 11 - 0
Makefile.version_extra

@@ -0,0 +1,11 @@
+# A hack to print the content of version.ml consistently across Windows (cygwin / command prompt) and Unix.
+# The hack: http://stackoverflow.com/a/7284135/267998
+# The issue: https://github.com/HaxeFoundation/haxe/commit/4f8f6a99ddf810ea045492cdd6d40c55abc03e15#commitcomment-10660400
+
+all: ;
+
+ifneq ($(ADD_REVISION),0)
+	$(info let version_extra = Some "(git build $(BRANCH) @ $(COMMIT_SHA))")
+else
+	$(info let version_extra = None)
+endif

+ 16 - 6
Makefile.win

@@ -5,18 +5,13 @@ EXTENSION=.exe
 
 OCAMLOPT=ocamlopt.opt
 
-ifneq ($(ADD_REVISION),0)
-	VERSION_EXTRA=let version_extra = Some " (git build $(shell git rev-parse --abbrev-ref HEAD) @ $(shell git describe --always)) "
-else
-	VERSION_EXTRA=let version_extra = None
-endif
-
 kill:
 	-@taskkill /F /IM haxe.exe
 
 # allow Ocaml/Mingw as well
 NATIVE_LIBS += -I "c:/program files/mingw/lib/"
 
+# use make WODI=wodi32 -f Makefile.win to build using WODI 32bit
 ifdef WODI
 NATIVE_LIBS += -I "/opt/${WODI}/lib"
 endif
@@ -39,3 +34,18 @@ ifdef FILTER
 CC_CMD=($(OCAMLOPT) $(CFLAGS) -c $< 2>tmp.cmi && $(FILTER)) || ($(FILTER) && exit 1)
 CC_PARSER_CMD=($(OCAMLOPT) -pp camlp4o $(CFLAGS) -c parser.ml 2>tmp.cmi && $(FILTER)) || ($(FILTER) && exit 1)
 endif
+
+package_bin:
+	mkdir -p out
+	rm -rf $(PACKAGE_FILE_NAME) $(PACKAGE_FILE_NAME).zip temp.zip
+	# Copy the package contents to $(PACKAGE_FILE_NAME)
+	# Using poor man's cp (zip then unzip), because cp in cygwin is quite broken
+	mkdir -p $(PACKAGE_FILE_NAME)
+	7za a -y -tzip -mx0 temp.zip $(OUTPUT) haxelib$(EXTENSION) std > log.txt || type log.txt
+	cd extra && 7za a -y -tzip -mx0 ../temp.zip LICENSE.txt CONTRIB.txt CHANGES.txt > log.txt || type log.txt
+	7za x -y temp.zip -o$(PACKAGE_FILE_NAME) > log.txt || type log.txt
+	rm temp.zip
+	# archive
+	7za a -r -tzip out/$(PACKAGE_FILE_NAME).zip $(PACKAGE_FILE_NAME) > log.txt || type log.txt
+	rm -r $(PACKAGE_FILE_NAME)
+	rm log.txt extra/log.txt

+ 8 - 8
README.md

@@ -39,14 +39,14 @@ For the complete Haxe licenses, please see http://haxe.org/foundation/open-sourc
 
 ## Installing Haxe
 
-The latest stable release is [Haxe 3.2.0-rc1](http://haxe.org/download). Pre-built binaries are available for your platform:
-
- * **[Windows installer](http://haxe.org/download/file/3.2.0-rc.1/haxe-3.2.0-rc1-win.exe)**
- * **[Windows binaries](http://haxe.org/download/file/3.2.0-rc.1/haxe-3.2.0-rc1-win.zip)**
- * **[OSX installer](http://haxe.org/download/file/3.2.0-rc.1/haxe-3.2.0-rc1-osx-installer.pkg)**
- * **[OSX binaries](http://haxe.org/download/file/3.2.0-rc.1/haxe-3.2.0-rc1-osx.tar.gz)**
- * **[Linux 32-bit binaries](http://haxe.org/download/file/3.2.0-rc.1/haxe-3.2.0-rc1-linux32.tar.gz)**
- * **[Linux 64-bit binaries](http://haxe.org/download/file/3.2.0-rc.1/haxe-3.2.0-rc1-linux64.tar.gz)**
+The latest stable release is [Haxe 3.2.0-rc2](http://haxe.org/download/version/3.2.0-rc.2/). Pre-built binaries are available for your platform:
+
+ * **[Windows installer](http://haxe.org/download/file/3.2.0-rc.2/haxe-3.2.0-rc2-win.exe)**
+ * **[Windows binaries](http://haxe.org/download/file/3.2.0-rc.2/haxe-3.2.0-rc2-win.zip)**
+ * **[OSX installer](http://haxe.org/download/file/3.2.0-rc.2/haxe-3.2.0-rc2-osx-installer.pkg)**
+ * **[OSX binaries](http://haxe.org/download/file/3.2.0-rc.2/haxe-3.2.0-rc2-osx.tar.gz)**
+ * **[Linux 32-bit binaries](http://haxe.org/download/file/3.2.0-rc.2/haxe-3.2.0-rc2-linux32.tar.gz)**
+ * **[Linux 64-bit binaries](http://haxe.org/download/file/3.2.0-rc.2/haxe-3.2.0-rc2-linux64.tar.gz)**
 
 Automated development builds are available from [build.haxe.org](http://build.haxe.org).
 

+ 1 - 0
analyzer.ml

@@ -236,6 +236,7 @@ module Simplifier = struct
 			with Exit ->
 				begin match follow e.etype with
 					| TAbstract({a_path = [],"Void"},_) -> true
+					| TInst ({ cl_path = [],"Array" }, _) when com.platform = Cpp -> true
 					| _ -> false
 				end
 		in

+ 30 - 26
appveyor.yml

@@ -5,60 +5,64 @@ os: unstable #http://help.appveyor.com/discussions/suggestions/427-pre-install-c
 platform:
     - Win32
 
-clone_folder: C:/projects/haxe
-
 environment:
     global:
         NEKO_ROOT: C:/projects/neko
         HAXELIB_ROOT: C:/projects/haxelib
+        CYG_ARCH: x86
+        CYG_ROOT: C:/cygwin
+        CYG_SETUP: C:/cygwin/setup-x86.exe
+        MINGW_ARCH: i686
+        WODI: wodi32
+        ADD_REVISION: 1
+        OCAMLOPT: ocamlopt.opt
     matrix:
-        -   CYG_ARCH: x86
-            CYG_ROOT: C:/cygwin
-            CYG_SETUP: C:/cygwin/setup-x86.exe
-            WODI_ARCH: 32
-            MINGW_ARCH: i686
-        # -   CYG_ARCH: x86_64
-        #     CYG_ROOT: C:/cygwin64
-        #     WODI_ARCH: 64
-        #     MINGW_ARCH: x86_64
+        - TEST: "neko,cs,java,macro"
+        - TEST: "cpp"
 
-init:
-    - 'echo System architecture: %PLATFORM%'
+skip_tags: true
 
 install:
     - 'git submodule update --init --recursive'
+    - cinst 7zip.commandline -y
     # Install ocaml using wodi
-    - '%CYG_ROOT%/setup-%CYG_ARCH%.exe -q -R "%CYG_ROOT%" -P dos2unix -P diffutils -P cpio -P make -P patch -P mingw64-%MINGW_ARCH%-gcc-core -P mingw64-%MINGW_ARCH%-gcc-g++ >NUL'
-    - '%CYG_ROOT%/bin/bash -lc "cygcheck -dc cygwin"'
-    - '%CYG_ROOT%/bin/bash -lc "wget -q http://ml.ignorelist.com/wodi/8/wodi%WODI_ARCH%.tar.xz -O /tmp/wodi%WODI_ARCH%.tar.xz"'
-    - '%CYG_ROOT%/bin/bash -lc "cd /tmp && rm -rf wodi%WODI_ARCH% && tar -xf wodi%WODI_ARCH%.tar.xz && bash wodi%WODI_ARCH%/install.sh"'
-    - '%CYG_ROOT%/bin/bash -lc "godi_add godi-zip"'
-    - 'set PATH=%PATH%;%CYG_ROOT%/opt/wodi%WODI_ARCH%/bin'
+    - appveyor DownloadFile "http://cygwin.com/setup-%CYG_ARCH%.exe" -FileName "%CYG_ROOT%\setup.exe"
+    - '%CYG_ROOT%/setup.exe -g -q -R "%CYG_ROOT%" -P dos2unix -P diffutils -P cpio -P make -P patch -P mingw64-%MINGW_ARCH%-gcc-core -P mingw64-%MINGW_ARCH%-gcc-g++ > log.txt || type log.txt'
+    - '%CYG_ROOT%/bin/bash -lc "cygcheck -dc cygwin" > log.txt || type log.txt'
+    # The archive is a dropbox hosted version of https://github.com/fdopen/godi-repo/issues/7#issuecomment-98480339
+    - '%CYG_ROOT%/bin/bash -lc "wget -q https://dl.dropboxusercontent.com/u/2661116/wodi/%WODI%.tar.xz -O /tmp/%WODI%.tar.xz" > log.txt || type log.txt'
+    - '%CYG_ROOT%/bin/bash -lc "cd /tmp && rm -rf %WODI% && tar -xf %WODI%.tar.xz && bash %WODI%/install.sh" > log.txt || type log.txt'
+    - '%CYG_ROOT%/bin/bash -lc "godi_add godi-zip" > log.txt || type log.txt'
+    - 'set PATH=%PATH%;%CYG_ROOT%/opt/%WODI%/bin'
     # Install neko
     - cinst make -y
     - 'git clone --recursive https://github.com/HaxeFoundation/neko.git %NEKO_ROOT%'
     - 'cd %NEKO_ROOT%'
     - set PATH=%PATH%;%NEKO_ROOT%/bin
-    - msbuild neko_vc10.sln /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
-    - msbuild libs/libs_vc10.sln /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
+    - msbuild neko_vc10.sln /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" > log.txt || type log.txt
+    - msbuild libs/libs_vc10.sln /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" > log.txt || type log.txt
     - copy /y libs\include\gc\gc.dll bin
     - cd %NEKO_ROOT%/src
     - neko ../boot/nekoc tools/install.neko
-    - neko tools/install -nolibs
+    - neko tools/install -nolibs > log.txt || type log.txt
     - neko -version
 
 build_script:
     - 'cd %APPVEYOR_BUILD_FOLDER%'
     - 'set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%'
-    - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && make -f Makefile.win WODI=wodi%WODI_ARCH% OCAMLOPT=ocamlopt.opt"'
-    - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && make -f Makefile.win WODI=wodi%WODI_ARCH% OCAMLOPT=ocamlopt.opt tools"'
+    - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && make -s -f Makefile.win"'
+    - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && make -s -f Makefile.win tools"'
+    - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && make -s -f Makefile.win package_bin"'
+    - dir %APPVEYOR_BUILD_FOLDER%\out
     - cd %APPVEYOR_BUILD_FOLDER%/tests/
     - mkdir "%HAXELIB_ROOT%"
     - haxelib setup "%HAXELIB_ROOT%"
-    - haxelib git hx-yaml https://github.com/mikestead/hx-yaml master src
 
 test_script:
     - cd %APPVEYOR_BUILD_FOLDER%/tests/
     - haxe -version
-    - haxe -neko RunCi.n -main RunCi -lib hx-yaml
+    - haxe RunCi.hxml
     - neko RunCi.n
+
+artifacts:
+    - path: out/haxe_*.zip

+ 2 - 0
ast.ml

@@ -122,7 +122,9 @@ module Meta = struct
 		| NoDoc
 		| NoExpr
 		| NoImportGlobal
+		| NonVirtual
 		| NoPackageRestrict
+		| NoPrivateAccess
 		| NoStack
 		| NotNull
 		| NoUsing

+ 2 - 3
common.ml

@@ -240,7 +240,6 @@ module Define = struct
 		| SwfScriptTimeout
 		| SwfUseDoAbc
 		| Sys
-		| Unity46LineNumbers
 		| Unsafe
 		| UseNekoc
 		| UseRttiDoc
@@ -325,8 +324,6 @@ module Define = struct
 		| SwfScriptTimeout -> ("swf_script_timeout", "Maximum ActionScript processing time before script stuck dialog box displays (in seconds)")
 		| SwfUseDoAbc -> ("swf_use_doabc", "Use DoAbc swf-tag instead of DoAbcDefine")
 		| Sys -> ("sys","Defined for all system platforms")
-		(* see https://github.com/HaxeFoundation/haxe/issues/3759 *)
-		| Unity46LineNumbers -> ("unity46_line_numbers", "Fixes line numbers in generated C# files for Unity 4.6 Mono compiler")
 		| Unsafe -> ("unsafe","Allow unsafe code when targeting C#")
 		| UseNekoc -> ("use_nekoc","Use nekoc compiler instead of internal one")
 		| UseRttiDoc -> ("use_rtti_doc","Allows access to documentation during compilation")
@@ -447,7 +444,9 @@ module MetaInfo = struct
 		| NoDoc -> ":noDoc",("Prevents a type from being included in documentation generation",[])
 		| NoExpr -> ":noExpr",("Internally used to mark abstract fields which have no expression by design",[Internal])
 		| NoImportGlobal -> ":noImportGlobal",("Prevents a static field from being imported with import Class.*",[UsedOn TAnyField])
+		| NonVirtual -> ":nonVirtual",("Declares function to be non-virtual in cpp",[Platform Cpp])
 		| NoPackageRestrict -> ":noPackageRestrict",("Allows a module to be accessed across all targets if found on its first type",[Internal])
+		| NoPrivateAccess -> ":noPrivateAccess",("Disallow private access to anything for the annotated expression",[UsedOn TExpr])
 		| NoStack -> ":noStack",("",[Platform Cpp])
 		| NotNull -> ":notNull",("Declares an abstract type as not accepting null values",[UsedOn TAbstract])
 		| NoUsing -> ":noUsing",("Prevents a field from being used with 'using'",[UsedOn TClassField])

+ 34 - 1
extra/CHANGES.txt

@@ -1,3 +1,36 @@
+2015-05-12: 3.2.0
+
+	New features:
+
+	all : added @:noPrivateAccess to re-enable access restrictions within @:privateAccess
+	cpp : some support for @:nativeGen metadata
+
+	Bugfixes:
+
+	all : fixed detection of @:generic classes with constructor constraints
+	all : fixed variable initialization check issue in loop condition
+	all : fixed pattern matching on @:enum abstracts via field access (#4084)
+	all : fixed missing implicit casts in Map literals (#4100)
+	all : fixed various minor issues in haxe.xml.Parser
+	all : fixed class path issue when HAXE_STD_PATH is set (#4163)
+	js : fixed DCE issue related to printing enums (#4197)
+	js : fixed various issues with the new Bytes implementation
+	php : fixed EOF handling in FileInput.readByte (#4082)
+	cs/java : fixed Math.fround implementation (#4177)
+	cs/java : fixed some cases of Std.parseInt failing (#4132)
+	cpp : fixed compilation without -main (#4199)
+
+	General improvements and optimizations:
+
+	all : --macro keep no longer causes types to be included for compilation
+	php : support interpolation in __php__ code
+	js : added variable number of arguments support in js.html.* classes
+	js : refined new HTML externs
+
+	Macro features and changes:
+
+	macro : [breaking] synced FClosure and FInstance with the compiler updates
+
 2015-03-15: 3.2.0-RC1
 
 	This release removes support for Flash 8 target
@@ -49,7 +82,7 @@
 	cpp : fixed issue with NativeArray in --no-inline mode
 	php : fixed issue with invalid references for closures in for-loops
 	php : fixed Reflect.compare and string comparison for numeric strings
-	cs/java : fixed various issues with -java-lib and -net-lib. 
+	cs/java : fixed various issues with -java-lib and -net-lib.
 	cs/java : added @:libType to skip checking on -java-lib / -net-lib types
 	cs/java : compilation server now works with C#/Java [experimental support]
 	cs : fixed Type.enumIndex / switch on C# native enums

+ 1 - 1
extra/haxelib_src

@@ -1 +1 @@
-Subproject commit 0dfb33242a28d5a89178c1e48968174646e0fefe
+Subproject commit 4fefbd17a2d9a98200b621de801018af3896d68a

+ 22 - 13
filters.ml

@@ -140,19 +140,17 @@ let rec add_final_return e =
 		| _ -> e
 
 let rec wrap_js_exceptions com e =
-	let terr = List.find (fun mt -> match mt with TClassDecl {cl_path = ["js";"_Boot"],"HaxeError"} -> true | _ -> false) com.types in
-	let cerr = match terr with TClassDecl c -> c | _ -> assert false in
-
 	let rec is_error t =
 		match follow t with
 		| TInst ({cl_path = (["js"],"Error")},_) -> true
 		| TInst ({cl_super = Some (csup,tl)}, _) -> is_error (TInst (csup,tl))
 		| _ -> false
 	in
-
 	let rec loop e =
 		match e.eexpr with
 		| TThrow eerr when not (is_error eerr.etype) ->
+			let terr = List.find (fun mt -> match mt with TClassDecl {cl_path = ["js";"_Boot"],"HaxeError"} -> true | _ -> false) com.types in
+			let cerr = match terr with TClassDecl c -> c | _ -> assert false in
 			let ewrap = { eerr with eexpr = TNew (cerr,[],[eerr]) } in
 			{ e with eexpr = TThrow ewrap }
 		| _ ->
@@ -705,12 +703,6 @@ let rename_local_vars ctx e =
 	e
 
 let check_unification ctx e t =
-	begin match follow e.etype,follow t with
-		| TEnum _,TDynamic _ ->
-			Hashtbl.replace ctx.curclass.cl_module.m_extra.m_features "may_print_enum" true;
-		| _ ->
-			()
-	end;
 	begin match e.eexpr,t with
 		| TLocal v,TType({t_path = ["cs"],("Ref" | "Out")},_) ->
 			(* TODO: this smells of hack, but we have to deal with it somehow *)
@@ -769,7 +761,24 @@ let save_class_state ctx t = match t with
 
 (* PASS 2 begin *)
 
-let is_removable_class c = c.cl_kind = KGeneric && (Codegen.has_ctor_constraint c || Meta.has Meta.Remove c.cl_meta)
+let rec is_removable_class c =
+	match c.cl_kind with
+	| KGeneric ->
+		(Meta.has Meta.Remove c.cl_meta ||
+		(match c.cl_super with
+			| Some (c,_) -> is_removable_class c
+			| _ -> false) ||
+		List.exists (fun (_,t) -> match follow t with
+			| TInst(c,_) ->
+				Codegen.has_ctor_constraint c
+			| _ ->
+				false
+		) c.cl_params)
+	| KTypeParameter _ ->
+		(* this shouldn't happen, have to investigate (see #4092) *)
+		true
+	| _ ->
+		false
 
 let remove_generic_base ctx t = match t with
 	| TClassDecl c when is_removable_class c ->
@@ -1125,6 +1134,7 @@ let run com tctx main =
 			Codegen.UnificationCallback.run (check_unification tctx);
 			Codegen.AbstractCast.handle_abstract_casts tctx;
 			blockify_ast;
+			check_local_vars_init;
 			( if (Common.defined com Define.NoSimplify) || (Common.defined com Define.Cppia) ||
 						( match com.platform with Cpp -> false | _ -> true ) then
 					fun e -> e
@@ -1137,7 +1147,6 @@ let run com tctx main =
 						save();
 					e );
 			if com.foptimize then (fun e -> Optimizer.reduce_expression tctx (Optimizer.inline_constructors tctx e)) else Optimizer.sanitize com;
-			check_local_vars_init;
 			captured_vars com;
 			promote_complex_rhs com;
 			if com.config.pf_add_final_return then add_final_return else (fun e -> e);
@@ -1179,7 +1188,7 @@ let run com tctx main =
 				not (Meta.has Meta.Enum cf.cf_meta)
 			in
 			(* also filter abstract implementation classes that have only @:enum fields (issue #2858) *)
-			if not (Meta.has Meta.Used c.cl_meta || Common.defined com Define.As3) || not (List.exists is_runtime_field c.cl_ordered_statics) then
+			if not (List.exists is_runtime_field c.cl_ordered_statics) then
 				c.cl_extern <- true
 		| _ -> ()
 	) com.types;

+ 89 - 46
gencommon.ml

@@ -975,7 +975,7 @@ let write_file gen w source_dir path extension out_files =
 	end else true in
 
 	if should_write then begin
-		let f = open_out s_path in
+		let f = open_out_bin s_path in
 		output_string f contents;
 		close_out f
 	end;
@@ -1607,7 +1607,7 @@ struct
 				| TInst _ | TEnum _ | TAbstract _ ->
 					default_hxgen_func (t_to_md (follow a.a_this))
 				| _ ->
-					Meta.has Meta.NativeGen a.a_meta)
+					not (Meta.has Meta.NativeGen a.a_meta))
 			| TTypeDecl t -> (* TODO see when would we use this *)
 				false
 
@@ -2113,7 +2113,7 @@ struct
 				let init = List.fold_left (fun acc cf ->
 					match cf.cf_kind, should_handle_dynamic_functions with
 						| (Var v, _) when Meta.has Meta.ReadOnly cf.cf_meta && readonly_support ->
-								if v.v_write <> AccNever then gen.gcon.warning "@:readOnly variable declared without `never` setter modifier" cf.cf_pos;
+								if v.v_write <> AccNever && not (Meta.has Meta.CoreApi cl.cl_meta) then gen.gcon.warning "@:readOnly variable declared without `never` setter modifier" cf.cf_pos;
 								(match cf.cf_expr with
 									| None -> gen.gcon.warning "Uninitialized readonly variable" cf.cf_pos; acc
 									| Some e -> ensure_simple_expr gen e; acc)
@@ -2154,7 +2154,7 @@ struct
 					let vars, funs = List.fold_left (fun (acc_vars,acc_funs) cf ->
 						match cf.cf_kind with
 							| Var v when Meta.has Meta.ReadOnly cf.cf_meta && readonly_support ->
-									if v.v_write <> AccNever then gen.gcon.warning "@:readOnly variable declared without `never` setter modifier" cf.cf_pos;
+									if v.v_write <> AccNever && not (Meta.has Meta.CoreApi cl.cl_meta) then gen.gcon.warning "@:readOnly variable declared without `never` setter modifier" cf.cf_pos;
 									(match cf.cf_expr with
 										| None -> (acc_vars,acc_funs)
 										| Some e -> ensure_simple_expr gen e; (acc_vars,acc_funs))
@@ -2805,6 +2805,8 @@ struct
 									( (v,catch_map v (run catch)) :: nowrap_catches, must_wrap_catches, catchall )
 						) ([], [], None) catches
 						in
+						(* temp (?) fix for https://github.com/HaxeFoundation/haxe/issues/4134 *)
+						let must_wrap_catches = List.rev must_wrap_catches in
 						(*
 							1st catch all nowrap "the easy way"
 							2nd see if there are any must_wrap or catchall. If there is,
@@ -3239,6 +3241,11 @@ struct
 			(* get all captured variables it uses *)
 			let captured_ht, tparams = get_captured fexpr in
 			let captured = Hashtbl.fold (fun _ e acc -> e :: acc) captured_ht [] in
+			let captured = List.sort (fun e1 e2 -> match e1, e2 with
+				| { eexpr = TLocal v1 }, { eexpr = TLocal v2 } ->
+					compare v1.v_name v2.v_name
+				| _ -> assert false) captured
+			in
 
 			(*let cltypes = List.map (fun cl -> (snd cl.cl_path, TInst(map_param cl, []) )) tparams in*)
 			let cltypes = List.map (fun cl -> (snd cl.cl_path, TInst(cl, []) )) tparams in
@@ -4138,6 +4145,19 @@ struct
 
 	let priority = max_dep -. 20.
 
+	let rec deep_follow gen t = match run_follow gen t with
+		| TInst(c,tl) ->
+			TInst(c,List.map (deep_follow gen) tl)
+		| TEnum(e,tl) ->
+			TEnum(e,List.map (deep_follow gen) tl)
+		| TAbstract(a,tl) ->
+			TAbstract(a,List.map (deep_follow gen) tl)
+		| TType(t,tl) ->
+			TType(t,List.map (deep_follow gen) tl)
+		| TFun(args,ret) ->
+			TFun(List.map (fun (n,o,t) -> n,o,deep_follow gen t) args, deep_follow gen ret)
+		| t -> t
+
 	(* this function will receive the original function argument, the applied function argument and the original function parameters. *)
 	(* from this info, it will infer the applied tparams for the function *)
 	(* this function is used by CastDetection module *)
@@ -4153,8 +4173,8 @@ struct
 
 			(try
 				List.iter2 (fun a o ->
-					let o = run_follow gen o in
-					let a = run_follow gen a in
+					let o = deep_follow gen o in
+					let a = deep_follow gen a in
 					unify a o
 					(* type_eq EqStrict a o *)
 				) applied original
@@ -4222,26 +4242,19 @@ struct
 				| _ -> false
 
 		let rec follow_all_md md =
-			match md with
-			| TClassDecl { cl_kind = KAbstractImpl a } ->
-				follow_all_md (TAbstractDecl a)
-			| TAbstractDecl a -> if Meta.has Meta.CoreType a.a_meta then
-				None
-			else (
-				match follow (apply_params a.a_params (List.map snd a.a_params) a.a_this) with
-					| TInst(c,_) -> follow_all_md (TClassDecl c)
-					| TEnum(e,_) -> follow_all_md (TEnumDecl e)
-					| TAbstract(a,_) -> follow_all_md (TAbstractDecl a)
-					| TType(t,_) -> follow_all_md (TTypeDecl t)
-					| _ -> None)
-			| TTypeDecl t -> (
-				match follow (apply_params t.t_params (List.map snd t.t_params) t.t_type) with
-				| TInst(c,_) -> follow_all_md (TClassDecl c)
-				| TEnum(e,_) -> follow_all_md (TEnumDecl e)
-				| TAbstract(a,_) -> follow_all_md (TAbstractDecl a)
-				| TType(t,_) -> follow_all_md (TTypeDecl t)
-				| _ -> None)
-			| md -> Some md
+			let t = match md with
+				| TClassDecl { cl_kind = KAbstractImpl a } ->
+					TAbstract(a, List.map snd a.a_params)
+				| TClassDecl c ->
+					TInst(c, List.map snd c.cl_params)
+				| TEnumDecl e ->
+					TEnum(e, List.map snd e.e_params)
+				| TTypeDecl t ->
+					TType(t, List.map snd t.t_params)
+				| TAbstractDecl a ->
+					TAbstract(a, List.map snd a.a_params)
+			in
+			Abstract.follow_with_abstracts t
 
 		let rec is_hxgeneric md =
 			match md with
@@ -4251,9 +4264,13 @@ struct
 				not (Meta.has Meta.NativeGeneric cl.cl_meta)
 			| TEnumDecl(e) ->
 				not (Meta.has Meta.NativeGeneric e.e_meta)
+			| TAbstractDecl(a) when Meta.has Meta.NativeGeneric a.a_meta ->
+				not (Meta.has Meta.NativeGeneric a.a_meta)
 			| md -> match follow_all_md md with
-				| Some md -> is_hxgeneric md
-				| None -> true
+				| TInst(cl,_) -> is_hxgeneric (TClassDecl cl)
+				| TEnum(e,_) -> is_hxgeneric (TEnumDecl e)
+				| TAbstract(a,_) -> not (Meta.has Meta.NativeGeneric a.a_meta)
+				| _ -> true
 
 		let rec set_hxgeneric gen mds isfirst md =
 			let path = t_path md in
@@ -4389,11 +4406,16 @@ struct
 		let set_hxgeneric gen md =
 			let ret = match md with
 				| TClassDecl { cl_kind = KAbstractImpl a } -> (match follow_all_md md with
-					| Some md ->
+					| (TInst _ | TEnum _ as t) -> (
+						let md = match t with
+							| TInst(cl,_) -> TClassDecl cl
+							| TEnum(e,_) -> TEnumDecl e
+							| _ -> assert false
+						in
 						let ret = set_hxgeneric gen [] true md in
-						if ret = None then get (set_hxgeneric gen [] false md) else get ret
-					| None ->
-						true)
+						if ret = None then get (set_hxgeneric gen [] false md) else get ret)
+					| TAbstract(a,_) -> true
+					| _ -> true)
 				| _ -> match set_hxgeneric gen [] true md with
 					| None ->
 						get (set_hxgeneric gen [] false md)
@@ -4815,13 +4837,12 @@ struct
 							let iface = mk_class cl.cl_module cl.cl_path cl.cl_pos in
 							iface.cl_array_access <- Option.map (apply_params (cl.cl_params) (List.map (fun _ -> t_dynamic) cl.cl_params)) cl.cl_array_access;
 							iface.cl_module <- cl.cl_module;
-							iface.cl_meta <- (Meta.HxGen, [], cl.cl_pos) :: iface.cl_meta;
-							if gen.gcon.platform = Cs then begin
-								let tparams = List.map (fun _ -> "object") cl.cl_params in
-								iface.cl_meta <- (Meta.Meta, [
-									EConst( String("haxe.lang.GenericInterface(typeof(" ^ path_s cl.cl_path ^ "<" ^ String.concat ", " tparams ^">))") ), cl.cl_pos
-								], cl.cl_pos) :: iface.cl_meta
-							end;
+							iface.cl_meta <-
+								(Meta.HxGen, [], cl.cl_pos)
+								::
+								(Meta.Custom "generic_iface", [(EConst(Int(string_of_int(List.length cl.cl_params))), cl.cl_pos)], cl.cl_pos)
+								::
+								iface.cl_meta;
 							Hashtbl.add ifaces cl.cl_path iface;
 
 							iface.cl_implements <- (base_generic, []) :: iface.cl_implements;
@@ -6568,6 +6589,20 @@ struct
 		 | _ -> e
 		in
 
+		let get_abstract_impl t = match t with
+			| TAbstract(a,pl) when not (Meta.has Meta.CoreType a.a_meta) ->
+				Abstract.get_underlying_type a pl
+			| t -> t
+		in
+
+		let rec is_abstract_to_struct t = match t with
+			| TAbstract(a,pl) when not (Meta.has Meta.CoreType a.a_meta) ->
+				is_abstract_to_struct (Abstract.get_underlying_type a pl)
+			| TInst(c,_) when Meta.has Meta.Struct c.cl_meta ->
+				true
+			| _ -> false
+		in
+
 		let rec run ?(just_type = false) e =
 			let handle = if not just_type then handle else fun e t1 t2 -> { e with etype = gen.greal_type t2 } in
 			let was_in_value = !in_value in
@@ -6747,20 +6782,27 @@ struct
 						| TParenthesis e | TMeta(_,e) -> get_null e
 						| _ -> None
 					in
+
 					(match get_null expr with
 					| Some enull ->
 							if gen.gcon.platform = Cs then
 								{ enull with etype = gen.greal_type e.etype }
 							else
 								mk_cast (gen.greal_type e.etype) enull
+					| _ when is_abstract_to_struct expr.etype && type_iseq gen e.etype (get_abstract_impl expr.etype) ->
+						run { expr with etype = expr.etype }
 					| _ ->
-						let last_unsafe = gen.gon_unsafe_cast in
-						gen.gon_unsafe_cast <- (fun t t2 pos -> ());
-						let ret = handle (run expr) e.etype expr.etype in
-						gen.gon_unsafe_cast <- last_unsafe;
-						match ret.eexpr with
-							| TCast _ -> ret
-							| _ -> { e with eexpr = TCast(ret,md); etype = gen.greal_type e.etype }
+						match gen.greal_type e.etype, gen.greal_type expr.etype with
+							| (TInst(c,tl) as tinst1), TAbstract({ a_path = ["cs"],"Pointer" }, [tinst2]) when type_iseq gen tinst1 (gen.greal_type tinst2) ->
+								run expr
+							| _ ->
+								let last_unsafe = gen.gon_unsafe_cast in
+								gen.gon_unsafe_cast <- (fun t t2 pos -> ());
+								let ret = handle (run expr) e.etype expr.etype in
+								gen.gon_unsafe_cast <- last_unsafe;
+								match ret.eexpr with
+									| TCast _ -> { ret with etype = gen.greal_type e.etype }
+									| _ -> { e with eexpr = TCast(ret,md); etype = gen.greal_type e.etype }
 					)
 				(*| TCast _ ->
 					(* if there is already a cast, we should skip this cast check *)
@@ -6768,6 +6810,7 @@ struct
 				| TFunction f ->
 					in_value := false;
 					Type.map_expr run e
+
 				| _ -> Type.map_expr run e
 		in
 		run

+ 193 - 96
gencpp.ml

@@ -1,4 +1,4 @@
-(* gencommon.$(MODULE_EXT)
+(*
  * Copyright (C)2005-2013 Haxe Foundation
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -347,7 +347,7 @@ let get_meta_string meta key =
 
 
 
-let get_meta_string_path ctx meta key =
+let get_meta_string_path meta key =
    let rec loop = function
       | [] -> ""
       | (k,[Ast.EConst (Ast.String name),_], pos) :: _  when k=key->
@@ -367,6 +367,28 @@ let get_meta_string_path ctx meta key =
    loop meta
 ;;
 
+
+let get_meta_string_full_filename meta key =
+   let rec loop = function
+      | [] -> ""
+      | (k,_, pos) :: _  when k=key->
+           if (Filename.is_relative pos.pfile) then
+              Gencommon.normalize (Filename.concat (Sys.getcwd()) pos.pfile)
+           else
+              pos.pfile
+      | _ :: l -> loop l
+      in
+   loop meta
+;;
+
+let get_meta_string_full_dirname meta key =
+   let name = get_meta_string_full_filename meta key in
+   try
+      Gencommon.normalize (Filename.dirname name)
+   with Invalid_argument _ -> ""
+;;
+
+
 let get_field_access_meta field_access key =
 match field_access with
    | FInstance(_,_,class_field)
@@ -374,9 +396,20 @@ match field_access with
    | _ -> ""
 ;;
 
+let format_code code =
+	String.concat "\n" (ExtString.String.nsplit code "\r\n")
+
 let get_code meta key =
    let code = get_meta_string meta key in
-   if (code<>"") then code ^ "\n" else code
+   let magic_var = "${GENCPP_SOURCE_DIRECTORY}"  in
+   let code = if ExtString.String.exists code magic_var then begin
+         let source_directory = get_meta_string_full_dirname meta key in
+         let _,code = ExtString.String.replace code magic_var source_directory in
+         code
+      end else
+         code
+      in
+   if (code<>"") then format_code code ^ "\n" else code
 ;;
 
 let has_meta_key meta key =
@@ -579,7 +612,8 @@ let rec class_string klass suffix params remap =
    let join_class_path_remap = if remap then join_class_path_remap else join_class_path in
    (match klass.cl_path with
    (* Array class *)
-   |  ([],"Array") when is_dynamic_array_param (List.hd params) -> "Dynamic"
+   |  ([],"Array") when is_dynamic_array_param (List.hd params) ->
+           "cpp::ArrayBase" ^ suffix (* "Dynamic" *)
    |  ([],"Array") -> (snd klass.cl_path) ^ suffix ^ "< " ^ (String.concat ","
                (List.map array_element_type params) ) ^ " >"
    (* FastIterator class *)
@@ -720,16 +754,19 @@ and cpp_function_signature_params params = match params with
        | TInst (klass,_) -> cpp_function_signature t (get_meta_string klass.cl_meta Meta.Abi)
        | _ -> print_endline (type_string abi);
            assert false )
-   | _ -> 
+   | _ ->
       print_endline ("Params:" ^ (String.concat "," (List.map type_string params) ));
       assert false;
 
 and gen_interface_arg_type_name name opt typ =
    let type_str = (type_string typ) in
-   (if (opt && (cant_be_null typ) ) then
+   (* type_str may have already converted Null<X> to Dynamic because of NotNull tag ... *)
+   (if (opt && (cant_be_null typ) && type_str<>"Dynamic" ) then
       "hx::Null< " ^ type_str ^ " > "
    else
       type_str )
+
+
    ^ " " ^ (keyword_remap name)
 and gen_tfun_interface_arg_list args =
    String.concat "," (List.map (fun (name,opt,typ) -> gen_interface_arg_type_name name opt typ) args)
@@ -846,6 +883,15 @@ let is_extern_class class_def =
        | _ -> false );
 ;;
 
+
+let is_native_gen_class class_def =
+   (has_meta_key class_def.cl_meta Meta.NativeGen) ||
+      (match class_def.cl_kind with
+       | KAbstractImpl abstract_def -> (has_meta_key abstract_def.a_meta Meta.NativeGen)
+       | _ -> false );
+;;
+
+
 let is_extern_class_instance obj =
    match follow obj.etype with
    | TInst (klass,params) -> klass.cl_extern
@@ -1253,7 +1299,7 @@ let find_undeclared_variables_ctx ctx undeclared declarations this_suffix allow_
 let rec is_dynamic_in_cpp ctx expr =
    let expr_type = type_string ( match follow expr.etype with TFun (args,ret) -> ret | _ -> expr.etype) in
    ctx.ctx_dbgout ( "/* idic: " ^ expr_type ^ " */" );
-   if ( expr_type="Dynamic" ) then
+   if ( expr_type="Dynamic" || expr_type="cpp::ArrayBase") then
       true
    else begin
       let result = (
@@ -1331,18 +1377,18 @@ and is_dynamic_member_return_in_cpp ctx field_object field =
    | TTypeExpr t ->
          let full_name = "::" ^ (join_class_path (t_path t) "::" ) ^ "." ^ member in
          ctx.ctx_dbgout ("/*static:"^ full_name^"*/");
-         ( try ( let mem_type = (Hashtbl.find ctx.ctx_class_member_types full_name) in mem_type="Dynamic" )
+         ( try ( let mem_type = (Hashtbl.find ctx.ctx_class_member_types full_name) in mem_type="Dynamic"||mem_type="cpp::ArrayBase" )
          with Not_found -> true )
    | _ ->
       let tstr = type_string field_object.etype in
       (match tstr with
          (* Internal classes have no dynamic members *)
          | "::String" | "Null" | "::hx::Class" | "::Enum" | "::Math" | "::ArrayAccess" -> false
-         | "Dynamic" -> ctx.ctx_dbgout "/*D*/"; true
+         | "Dynamic" | "cpp::ArrayBase" -> ctx.ctx_dbgout "/*D*/"; true
          | name ->
                let full_name = name ^ "." ^ member in
                ctx.ctx_dbgout ("/*R:"^full_name^"*/");
-               try ( let mem_type = (Hashtbl.find ctx.ctx_class_member_types full_name) in mem_type="Dynamic" )
+               try ( let mem_type = (Hashtbl.find ctx.ctx_class_member_types full_name) in mem_type="Dynamic"||mem_type="cpp::ArrayBase" )
                with Not_found -> true )
 ;;
 
@@ -1850,7 +1896,7 @@ and gen_expression ctx retval expression =
       | x when is_interface_type x -> ()
       | TInst (klass,[element]) ->
          let name = type_string element in
-         if ( is_object name ) then
+         if ( is_object name && not (is_interface_type element) ) then
             gen_array_cast ".StaticCast" "Array<Dynamic>" "()"
          else
             gen_array_cast ".StaticCast" (type_string array_type) "()"
@@ -1903,6 +1949,13 @@ and gen_expression ctx retval expression =
                output ( "." ^ remap_name )
             else begin
                cast_if_required ctx field_object (type_string field_object.etype);
+               let remap_name = if (type_string field_object.etype)="cpp::ArrayBase" then
+                   match remap_name with
+                   | "length" -> remap_name
+                   | _ -> "__" ^ remap_name
+               else
+                  remap_name
+               in
                output ( "->" ^ remap_name );
                if (calling && (is_array field_object.etype) && remap_name="iterator" ) then
                   check_array_element_cast field_object.etype "Fast" "";
@@ -1934,9 +1987,9 @@ and gen_expression ctx retval expression =
          | TLocal { v_name = "__cpp__" } -> true
          | _ -> false) ->
       ( match arg_list with
-      | [{ eexpr = TConst (TString code) }] -> output code;
+      | [{ eexpr = TConst (TString code) }] -> output (format_code code);
       | ({ eexpr = TConst (TString code) } as ecode) :: tl ->
-         Codegen.interpolate_code ctx.ctx_common code tl output (gen_expression ctx true) ecode.epos
+         Codegen.interpolate_code ctx.ctx_common (format_code code) tl output (gen_expression ctx true) ecode.epos
       | _ -> error "__cpp__'s first argument must be a string" func.epos;
       )
    | TCall (func, arg_list) when tcall_expand_args->
@@ -1970,7 +2023,7 @@ and gen_expression ctx retval expression =
             let signature = cpp_function_signature field.cf_type "" in
             let name = keyword_remap field.cf_name in
             let void_cast = has_meta_key field.cf_meta Meta.Void in
-            output ("::cpp::Function<" ^ signature ^">(");
+            output ("::cpp::Function< " ^ signature ^">(");
             if (void_cast) then output "hx::AnyCast(";
             output ("&::" ^(join_class_path klass.cl_path "::")^ "_obj::" ^ name );
             if (void_cast) then output ")";
@@ -1994,7 +2047,7 @@ and gen_expression ctx retval expression =
          let cpp_type = member_type ctx obj field.cf_name in
          (not (is_scalar cpp_type)) && (
             let fixed = (cpp_type<>"?") && (expr_type<>"Dynamic") && (cpp_type<>"Dynamic") &&
-               (cpp_type<>expr_type) && (expr_type<>"Void") in
+               (cpp_type<>expr_type) && (expr_type<>"Void") && (cpp_type<>"cpp::ArrayBase") in
             if (fixed && (ctx.ctx_debug_level>1) ) then begin
                output ("/* " ^ (cpp_type) ^ " != " ^ expr_type ^ " -> cast */");
             end;
@@ -2042,14 +2095,14 @@ and gen_expression ctx retval expression =
       end;
       if (cast_result) then output (")");
       if ( (is_variable func) && (not (is_cpp_function_member func) ) &&
-           (expr_type<>"Dynamic") && (not is_super) && (not is_block_call)) then
+           (expr_type<>"Dynamic" && expr_type<>"cpp::ArrayBase" ) && (not is_super) && (not is_block_call)) then
          ctx.ctx_output (".Cast< " ^ expr_type ^ " >()" );
 
       let rec cast_array_output func =
          match func.eexpr with
             | TField(obj,field) when is_array obj.etype ->
                (match field_name field with
-                  | "pop" | "shift" -> check_array_element_cast obj.etype ".StaticCast" "()"
+                  | "pop" | "shift" | "__unsafe_get" | "__unsafe_set" -> check_array_element_cast obj.etype ".StaticCast" "()"
                   | "map" -> check_array_cast expression.etype
                   | _ -> ()
                )
@@ -2124,7 +2177,7 @@ and gen_expression ctx retval expression =
    | TLocal v -> output (keyword_remap v.v_name);
    | TArray (array_expr,_) when (is_null array_expr) -> output "Dynamic()"
    | TArray (array_expr,index) ->
-      let dynamic =  is_dynamic_in_cpp ctx array_expr in
+      let dynamic =  is_dynamic_in_cpp ctx array_expr || (type_string array_expr.etype) = "cpp::ArrayBase" in
       if ( assigning && (not dynamic) ) then begin
          if (is_array_implementer array_expr.etype) then begin
             output "hx::__ArrayImplRef(";
@@ -2160,7 +2213,8 @@ and gen_expression ctx retval expression =
       end
    (* Get precidence matching haxe ? *)
    | TBinop (op,expr1,expr2) -> gen_bin_op op expr1 expr2
-   | TField (expr,_) | TEnumParameter (expr,_,_) when (is_null expr) -> output "Dynamic()"
+   | TField (expr,_) | TEnumParameter (expr,_,_) when (is_null expr) ->
+         output "hx::Throw(HX_CSTRING(\"Invalid field access on null object\"))"
    | TEnumParameter (expr,ef,i) ->
       let enum = match follow ef.ef_type with
          | TEnum(en,_) | TFun(_,TEnum(en,_)) -> en
@@ -2474,6 +2528,18 @@ let rec all_virtual_functions clazz =
    | _ -> [] )
 ;;
 
+let reflective class_def field = not (
+    (Meta.has Meta.NativeGen class_def.cl_meta) ||
+    (Meta.has Meta.Unreflective class_def.cl_meta) ||
+    (Meta.has Meta.Unreflective field.cf_meta) ||
+    (match field.cf_type with
+       | TInst (klass,_) ->  Meta.has Meta.Unreflective klass.cl_meta
+       | _ -> false
+    )
+)
+;;
+
+
 
 
 
@@ -2493,6 +2559,7 @@ let gen_field ctx class_def class_name ptr_name dot_name is_static is_interface
    let remap_name = keyword_remap field.cf_name in
    let decl = get_meta_string field.cf_meta Meta.Decl in
    let has_decl = decl <> "" in
+   let nativeGen = has_meta_key class_def.cl_meta Meta.NativeGen in
    if (is_interface) then begin
       (* Just the dynamic glue  - not even that ... *)
       ()
@@ -2505,7 +2572,7 @@ let gen_field ctx class_def class_name ptr_name dot_name is_static is_interface
       let ret = if is_void  then "(void)" else "return " in
       let output_i = ctx.ctx_writer#write_i in
       let orig_debug = ctx.ctx_debug_level in
-      let dump_src = if ((Meta.has Meta.NoStack field.cf_meta)||(Meta.has Meta.NoDebug field.cf_meta) || orig_debug<1) then begin
+      let dump_src = if ((Meta.has Meta.NoStack field.cf_meta)||(Meta.has Meta.NoDebug field.cf_meta) || orig_debug<1 || nativeGen) then begin
          ctx.ctx_debug_level <- 0;
          (fun()->())
       end else begin
@@ -2552,8 +2619,10 @@ let gen_field ctx class_def class_name ptr_name dot_name is_static is_interface
          end;
 
          output "\n\n";
+         let nonVirtual = has_meta_key field.cf_meta Meta.NonVirtual in
+         let doDynamic =  (nonVirtual || not (is_override class_def field.cf_name ) ) && (reflective class_def field ) in
          (* generate dynamic version too ... *)
-         if ( not (is_override class_def field.cf_name ) ) then begin
+         if ( doDynamic ) then begin
             if (is_static) then output "STATIC_";
             output ("HX_DEFINE_DYNAMIC_FUNC" ^ nargs ^ "(" ^ class_name ^ "," ^
                      remap_name ^ "," ^ ret ^ ")\n\n");
@@ -2565,13 +2634,19 @@ let gen_field ctx class_def class_name ptr_name dot_name is_static is_interface
          let func_name = "__default_" ^ (remap_name) in
          output ("HX_BEGIN_DEFAULT_FUNC(" ^ func_name ^ "," ^ class_name ^ ")\n");
          output return_type;
-         output (" run(" ^ (gen_arg_list function_def.tf_args "") ^ ")");
+         output (" run(" ^ (gen_arg_list function_def.tf_args "__o_") ^ ")");
          ctx.ctx_dump_src_pos <- dump_src;
          if (is_void) then begin
             ctx.ctx_writer#begin_block;
+            generate_default_values ctx function_def.tf_args "__o_";
             gen_expression ctx false function_def.tf_expr;
             output "return null();\n";
             ctx.ctx_writer#end_block;
+         end else if (has_default_values function_def.tf_args) then begin
+            ctx.ctx_writer#begin_block;
+            generate_default_values ctx function_def.tf_args "__o_";
+            gen_expression ctx false function_def.tf_expr;
+            ctx.ctx_writer#end_block;
          end else
             gen_expression ctx false (to_block function_def.tf_expr);
 
@@ -2643,6 +2718,7 @@ let has_field_init field =
 let gen_member_def ctx class_def is_static is_interface field =
    let output = ctx.ctx_output in
    let remap_name = keyword_remap field.cf_name in
+   let nativeGen = has_meta_key class_def.cl_meta Meta.NativeGen in
 
    if (is_interface) then begin
       match follow field.cf_type, field.cf_kind with
@@ -2652,8 +2728,10 @@ let gen_member_def ctx class_def is_static is_interface field =
          output (" " ^ remap_name ^ "( " );
          output (gen_tfun_interface_arg_list args);
          output (if (not is_static) then ")=0;\n" else ");\n");
-         output (if is_static then "\t\tstatic " else "\t\t");
-         output ("virtual Dynamic " ^ remap_name ^ "_dyn()=0;\n" );
+         if not nativeGen then begin
+            output (if is_static then "\t\tstatic " else "\t\t");
+            output ("virtual Dynamic " ^ remap_name ^ "_dyn()=0;\n" );
+         end
       | _  ->  ( )
    end else begin
    let decl = get_meta_string field.cf_meta Meta.Decl in
@@ -2663,8 +2741,10 @@ let gen_member_def ctx class_def is_static is_interface field =
    output (if is_static then "\t\tstatic " else "\t\t");
    (match  field.cf_expr with
    | Some { eexpr = TFunction function_def } ->
+      let nonVirtual = has_meta_key field.cf_meta Meta.NonVirtual in
+      let doDynamic =  (nonVirtual || not (is_override class_def field.cf_name ) ) && (reflective class_def field ) in
       if ( is_dynamic_haxe_method field ) then begin
-         if ( not (is_override class_def field.cf_name ) ) then begin
+         if ( doDynamic ) then begin
             output ("Dynamic " ^ remap_name ^ ";\n");
             output (if is_static then "\t\tstatic " else "\t\t");
             output ("inline Dynamic &" ^ remap_name ^ "_dyn() " ^ "{return " ^ remap_name^ "; }\n")
@@ -2672,13 +2752,13 @@ let gen_member_def ctx class_def is_static is_interface field =
       end else begin
          let return_type = (type_string function_def.tf_type) in
 
-         if (not is_static) then output "virtual ";
+         if ( not is_static && not nonVirtual ) then output "virtual ";
          output (if return_type="Void" && (has_meta_key field.cf_meta Meta.Void) then "void" else return_type );
 
          output (" " ^ remap_name ^ "( " );
          output (gen_arg_list function_def.tf_args "" );
          output ");\n";
-         if ( not (is_override class_def field.cf_name ) ) then begin
+         if ( doDynamic ) then begin
             output (if is_static then "\t\tstatic " else "\t\t");
             output ("Dynamic " ^ remap_name ^ "_dyn();\n" )
          end;
@@ -2694,6 +2774,7 @@ let gen_member_def ctx class_def is_static is_interface field =
 
       (* Add a "dyn" function for variable to unify variable/function access *)
       (match follow field.cf_type with
+      | _ when nativeGen  -> ()
       | TFun (_,_) ->
          output (if is_static then "\t\tstatic " else "\t\t");
          gen_type ctx field.cf_type;
@@ -2734,12 +2815,21 @@ let find_referenced_types ctx obj super_deps constructor_deps header_only for_de
       end
    in
    let add_extern_class klass =
-      let include_file = get_meta_string_path ctx klass.cl_meta (if for_depends then Meta.Depend else Meta.Include) in
+      let include_file = get_meta_string_path klass.cl_meta (if for_depends then Meta.Depend else Meta.Include) in
       if (include_file<>"") then
          add_type ( path_of_string include_file )
       else if (not for_depends) && (has_meta_key klass.cl_meta Meta.Include) then
          add_type klass.cl_path
    in
+   let add_native_gen_class klass =
+      let include_file = get_meta_string_path klass.cl_meta (if for_depends then Meta.Depend else Meta.Include) in
+      if (include_file<>"") then
+         add_type ( path_of_string include_file )
+      else if for_depends then
+         add_type klass.cl_path
+      else
+         add_type ( path_of_string ( (join_class_path klass.cl_path "/") ^ ".h") )
+   in
    let visited = ref [] in
    let rec visit_type in_type =
       if not (List.exists (fun t2 -> Type.fast_eq in_type t2) !visited) then begin
@@ -2754,6 +2844,7 @@ let find_referenced_types ctx obj super_deps constructor_deps header_only for_de
             | ([],"Array") | ([],"Class") | (["cpp"],"FastIterator")
             | (["cpp"],"Pointer") | (["cpp"],"ConstPointer") | (["cpp"],"Function")
             | (["cpp"],"RawPointer") | (["cpp"],"RawConstPointer") -> List.iter visit_type params
+            | _ when is_native_gen_class klass -> add_native_gen_class klass
             | _ when is_extern_class klass -> add_extern_class klass
             | _ -> (match klass.cl_kind with KTypeParameter _ -> () | _ -> add_type klass.cl_path);
             )
@@ -2770,6 +2861,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 ... *)
          (match expression.eexpr with
             | TTypeExpr type_def -> ( match type_def with
+               | TClassDecl class_def when is_native_gen_class class_def -> add_native_gen_class class_def
                | TClassDecl class_def when is_extern_class class_def -> add_extern_class class_def
                | _ -> add_type (t_path type_def)
                )
@@ -2832,7 +2924,10 @@ let find_referenced_types ctx obj super_deps constructor_deps header_only for_de
          List.iter visit_field (List.map (fun (a,_,_) -> a ) (all_virtual_functions class_def ));
 
       (* Add super & interfaces *)
-      add_type class_def.cl_path;
+      if is_native_gen_class class_def then
+         add_native_gen_class class_def
+      else
+         add_type class_def.cl_path;
    in
    let visit_enum enum_def =
       add_type enum_def.e_path;
@@ -2918,7 +3013,7 @@ let generate_dummy_main common_ctx =
       let main_file = new_cpp_file common_ctx common_ctx.file ([],filename) in
       let output_main = (main_file#write) in
       generate_main_header output_main;
-      if is_main then output_main "\n#include <hx/HxcppMain.h\n\n";
+      if is_main then output_main "\n#include <hx/HxcppMain.h>\n\n";
       generate_main_footer1 output_main;
       generate_main_footer2 output_main;
       main_file#close;
@@ -3310,15 +3405,6 @@ let is_writable class_def field =
    | _ -> true)
 ;;
 
-let reflective class_def field = not (
-    (Meta.has Meta.Unreflective class_def.cl_meta) ||
-    (Meta.has Meta.Unreflective field.cf_meta) ||
-    (match field.cf_type with
-       | TInst (klass,_) ->  Meta.has Meta.Unreflective klass.cl_meta
-       | _ -> false
-    )
-)
-;;
 
 let statics_except_meta class_def = (List.filter (fun static -> static.cf_name <> "__meta__" && static.cf_name <> "__rtti") class_def.cl_ordered_statics);;
 
@@ -3385,7 +3471,8 @@ let access_str a = match a with
 
 let generate_class_files common_ctx member_types super_deps constructor_deps class_def file_info inScriptable =
    let class_path = class_def.cl_path in
-   let class_name = (snd class_path) ^ "_obj" in
+   let nativeGen = has_meta_key class_def.cl_meta Meta.NativeGen in
+   let class_name = (snd class_path) ^ (if nativeGen then "" else "_obj") in
    let dot_name = join_class_path class_path "." in
    let smart_class_name =  (snd class_path)  in
    (*let cpp_file = new_cpp_file common_ctx.file class_path in*)
@@ -3395,6 +3482,8 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
       then 0 else 1 in
    let scriptable = inScriptable && not class_def.cl_private in
    let ctx = new_context common_ctx cpp_file debug file_info in
+
+
    ctx.ctx_class_name <- "::" ^ (join_class_path class_def.cl_path "::");
    ctx.ctx_class_super_name <- (match class_def.cl_super with
       | Some (klass, params) -> class_string klass "_obj" params true
@@ -3456,7 +3545,7 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
       output_cpp "#include <hx/Scriptable.h>\n";
 
    output_cpp ( get_class_code class_def Meta.CppFileCode );
-   let inc = get_meta_string_path ctx class_def.cl_meta Meta.CppInclude in
+   let inc = get_meta_string_path class_def.cl_meta Meta.CppInclude in
    if (inc<>"") then
       output_cpp ("#include \"" ^ inc ^ "\"\n");
 
@@ -3465,7 +3554,7 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
 
    output_cpp ( get_class_code class_def Meta.CppNamespaceCode );
 
-   if (not class_def.cl_interface) then begin
+   if (not class_def.cl_interface) && not nativeGen then begin
       output_cpp ("Void " ^ class_name ^ "::__construct(" ^ constructor_type_args ^ ")\n{\n");
       (match class_def.cl_constructor with
          | Some definition ->
@@ -3501,16 +3590,16 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
       output_cpp (ptr_name ^ " " ^ class_name ^ "::__new(" ^constructor_type_args ^")\n");
 
       let create_result () =
-         output_cpp ("{  " ^ ptr_name ^ " result = new " ^ class_name ^ "();\n");
+         output_cpp ("{  " ^ ptr_name ^ " _result_ = new " ^ class_name ^ "();\n");
          in
       create_result ();
-      output_cpp ("\tresult->__construct(" ^ constructor_args ^ ");\n");
-      output_cpp ("\treturn result;}\n\n");
+      output_cpp ("\t_result_->__construct(" ^ constructor_args ^ ");\n");
+      output_cpp ("\treturn _result_;}\n\n");
 
       output_cpp ("Dynamic " ^ class_name ^ "::__Create(hx::DynamicArray inArgs)\n");
       create_result ();
-      output_cpp ("\tresult->__construct(" ^ (array_arg_list constructor_var_list) ^ ");\n");
-      output_cpp ("\treturn result;}\n\n");
+      output_cpp ("\t_result_->__construct(" ^ (array_arg_list constructor_var_list) ^ ");\n");
+      output_cpp ("\treturn _result_;}\n\n");
       if ( (List.length implemented) > 0 ) then begin
          output_cpp ("hx::Object *" ^ class_name ^ "::__ToInterface(const hx::type_info &inType) {\n");
          List.iter (fun interface_name ->
@@ -3548,10 +3637,10 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
       (gen_field ctx class_def class_name smart_class_name dot_name true class_def.cl_interface) statics_except_meta;
    output_cpp "\n";
 
-   let override_iteration = has_new_gc_references class_def in
+   let override_iteration = (not nativeGen) && (has_new_gc_references class_def) in
 
    (* Initialise non-static variables *)
-   if (not class_def.cl_interface) then begin
+   if ( (not class_def.cl_interface) && (not nativeGen) ) then begin
       output_cpp (class_name ^ "::" ^ class_name ^  "()\n{\n");
       if (implement_dynamic) then
          output_cpp "\tHX_INIT_IMPLEMENT_DYNAMIC;\n";
@@ -3821,31 +3910,33 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
    let sMemberFields = if List.length reflective_members>0 then begin
       output_cpp "static ::String sMemberFields[] = {\n";
       List.iter dump_field_name  reflective_members;
-      output_cpp "\tString(null()) };\n\n";
+      output_cpp "\t::String(null()) };\n\n";
       "sMemberFields"
    end else
       "0 /* sMemberFields */";
    in
 
-   (* Mark static variables as used *)
-   output_cpp "static void sMarkStatics(HX_MARK_PARAMS) {\n";
-   output_cpp ("\tHX_MARK_MEMBER_NAME(" ^ class_name ^ "::__mClass,\"__mClass\");\n");
-   List.iter (fun field ->
-      if (is_data_member field) then
-         output_cpp ("\tHX_MARK_MEMBER_NAME(" ^ class_name ^ "::" ^ (keyword_remap field.cf_name) ^ ",\"" ^  field.cf_name ^ "\");\n") )
-      implemented_fields;
-   output_cpp "};\n\n";
-
-   (* Visit static variables *)
-   output_cpp "#ifdef HXCPP_VISIT_ALLOCS\n";
-   output_cpp "static void sVisitStatics(HX_VISIT_PARAMS) {\n";
-   output_cpp ("\tHX_VISIT_MEMBER_NAME(" ^ class_name ^ "::__mClass,\"__mClass\");\n");
-   List.iter (fun field ->
-      if (is_data_member field) then
-         output_cpp ("\tHX_VISIT_MEMBER_NAME(" ^ class_name ^ "::" ^ (keyword_remap field.cf_name) ^ ",\"" ^  field.cf_name ^ "\");\n") )
-      implemented_fields;
-   output_cpp "};\n\n";
-   output_cpp "#endif\n\n";
+   if (not nativeGen) then begin
+      (* Mark static variables as used *)
+      output_cpp "static void sMarkStatics(HX_MARK_PARAMS) {\n";
+      output_cpp ("\tHX_MARK_MEMBER_NAME(" ^ class_name ^ "::__mClass,\"__mClass\");\n");
+      List.iter (fun field ->
+         if (is_data_member field) then
+            output_cpp ("\tHX_MARK_MEMBER_NAME(" ^ class_name ^ "::" ^ (keyword_remap field.cf_name) ^ ",\"" ^  field.cf_name ^ "\");\n") )
+         implemented_fields;
+      output_cpp "};\n\n";
+
+      (* Visit static variables *)
+      output_cpp "#ifdef HXCPP_VISIT_ALLOCS\n";
+      output_cpp "static void sVisitStatics(HX_VISIT_PARAMS) {\n";
+      output_cpp ("\tHX_VISIT_MEMBER_NAME(" ^ class_name ^ "::__mClass,\"__mClass\");\n");
+      List.iter (fun field ->
+         if (is_data_member field) then
+            output_cpp ("\tHX_VISIT_MEMBER_NAME(" ^ class_name ^ "::" ^ (keyword_remap field.cf_name) ^ ",\"" ^  field.cf_name ^ "\");\n") )
+         implemented_fields;
+      output_cpp "};\n\n";
+      output_cpp "#endif\n\n";
+   end;
 
    let script_type t optional = if optional then "Object" else
    match type_string t with
@@ -3894,7 +3985,7 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
    in
 
 
-   if (scriptable ) then begin
+   if (scriptable && not nativeGen) then begin
       let dump_script_field idx (field,f_args,return_t) =
       let args = if (class_def.cl_interface) then
             gen_tfun_interface_arg_list f_args
@@ -3975,7 +4066,7 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
    let class_name_text = join_class_path class_path "." in
 
    (* Initialise static in boot function ... *)
-   if (not class_def.cl_interface) then begin
+   if (not class_def.cl_interface && not nativeGen) then begin
       (* Remap the specialised "extern" classes back to the generic names *)
       output_cpp ("hx::Class " ^ class_name ^ "::__mClass;\n\n");
       if (scriptable) then begin
@@ -3992,7 +4083,7 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
       let sStaticFields = if List.length reflective_statics > 0 then begin
          output_cpp "static ::String sStaticFields[] = {\n";
          List.iter dump_field_name  reflective_statics;
-         output_cpp "\tString(null()) };\n\n";
+         output_cpp "\t::String(null()) };\n\n";
          "sStaticFields";
       end else
         "0 /* sStaticFields */"
@@ -4020,7 +4111,7 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
          output_cpp ("  HX_SCRIPTABLE_REGISTER_CLASS(\""^class_name_text^"\"," ^ class_name ^ ");\n");
       output_cpp ("}\n\n");
 
-   end else begin
+   end else if not nativeGen then begin
       output_cpp ("hx::Class " ^ class_name ^ "::__mClass;\n\n");
 
       output_cpp ("void " ^ class_name ^ "::__register()\n{\n");
@@ -4054,6 +4145,7 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
    let h_file = new_header_file common_ctx common_ctx.file class_path in
    let super = match class_def.cl_super with
       | Some (klass,params) -> (class_string klass "_obj" params true)
+      | _ when nativeGen -> ""
       | _ -> if (class_def.cl_interface) then "hx::Interface" else "hx::Object"
       in
    let output_h = (h_file#write) in
@@ -4079,7 +4171,7 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
    List.iter ( gen_forward_decl h_file ) referenced;
 
    output_h ( get_class_code class_def Meta.HeaderCode );
-   let inc = get_meta_string_path ctx class_def.cl_meta Meta.HeaderInclude in
+   let inc = get_meta_string_path class_def.cl_meta Meta.HeaderInclude in
    if (inc<>"") then
       output_h ("#include \"" ^ inc ^ "\"\n");
 
@@ -4090,12 +4182,17 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
    let extern_class =  Common.defined common_ctx Define.DllExport in
    let attribs = "HXCPP_" ^ (if extern_class then "EXTERN_" else "") ^ "CLASS_ATTRIBUTES " in
 
-   output_h ("class " ^ attribs ^ " " ^ class_name ^ " : public " ^ super );
-   output_h "{\n\tpublic:\n";
-   output_h ("\t\ttypedef " ^ super ^ " super;\n");
-   output_h ("\t\ttypedef " ^ class_name ^ " OBJ_;\n");
+   if (super="") then begin
+      output_h ("class " ^ attribs ^ " " ^ class_name);
+      output_h "{\n\tpublic:\n";
+   end else begin
+      output_h ("class " ^ attribs ^ " " ^ class_name ^ " : public " ^ super );
+      output_h "{\n\tpublic:\n";
+      output_h ("\t\ttypedef " ^ super ^ " super;\n");
+      output_h ("\t\ttypedef " ^ class_name ^ " OBJ_;\n");
+   end;
 
-   if (not class_def.cl_interface) then begin
+   if (not class_def.cl_interface && not nativeGen) then begin
       output_h ("\t\t" ^ class_name ^  "();\n");
       output_h ("\t\tVoid __construct(" ^ constructor_type_args ^ ");\n");
       output_h "\n\tpublic:\n";
@@ -4111,15 +4208,15 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
       output_h ("\t\t//~" ^ class_name ^ "();\n\n");
       output_h ("\t\tHX_DO_RTTI_ALL;\n");
       if (has_get_member_field class_def) then
-         output_h ("Dynamic __Field(const ::String &inString, hx::PropertyAccess inCallProp);\n");
+         output_h ("\t\tDynamic __Field(const ::String &inString, hx::PropertyAccess inCallProp);\n");
       if (has_get_static_field class_def) then
-         output_h ("static bool __GetStatic(const ::String &inString, Dynamic &outValue, hx::PropertyAccess inCallProp);\n");
+         output_h ("\t\tstatic bool __GetStatic(const ::String &inString, Dynamic &outValue, hx::PropertyAccess inCallProp);\n");
       if (has_set_member_field class_def) then
-         output_h ("Dynamic __SetField(const ::String &inString,const Dynamic &inValue, hx::PropertyAccess inCallProp);\n");
+         output_h ("\t\tDynamic __SetField(const ::String &inString,const Dynamic &inValue, hx::PropertyAccess inCallProp);\n");
       if (has_set_static_field class_def) then
-         output_h ("static bool __SetStatic(const ::String &inString, Dynamic &ioValue, hx::PropertyAccess inCallProp);\n");
+         output_h ("\t\tstatic bool __SetStatic(const ::String &inString, Dynamic &ioValue, hx::PropertyAccess inCallProp);\n");
       if (has_get_fields class_def) then
-         output_h ("void __GetFields(Array< ::String> &outFields);\n");
+         output_h ("\t\tvoid __GetFields(Array< ::String> &outFields);\n");
 
       if (field_integer_dynamic) then output_h "\t\tDynamic __IField(int inFieldID);\n";
       if (field_integer_numeric) then output_h "\t\tdouble __INumField(int inFieldID);\n";
@@ -4142,7 +4239,7 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
       if (has_init_field class_def) then
          output_h "\t\tstatic void __init__();\n\n";
       output_h ("\t\t::String __ToString() const { return " ^ (str smart_class_name) ^ "; }\n\n");
-   end else begin
+   end else if not nativeGen then begin
       output_h ("\t\tHX_DO_INTERFACE_RTTI;\n");
    end;
    if (has_boot_field class_def) then
@@ -4161,7 +4258,7 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
    output_h ( get_class_code class_def Meta.HeaderClassCode );
    output_h "};\n\n";
 
-   if (class_def.cl_interface) then begin
+   if (class_def.cl_interface && not nativeGen) then begin
       output_h ("#define DELEGATE_" ^ (join_class_path class_path "_" ) ^ " \\\n");
       List.iter (fun field ->
       match follow field.cf_type, field.cf_kind  with
@@ -4249,7 +4346,7 @@ let write_resources common_ctx =
       incr idx;
    ) common_ctx.resources;
 
-   resource_file#write_i "{String(null()),0,0}";
+   resource_file#write_i "{::String(null()),0,0}";
    resource_file#end_block_line;
    resource_file#write ";\n\n";
    resource_file#write "namespace hx { Resource *GetResources() { return __Resources; } } \n\n";
@@ -4257,7 +4354,7 @@ let write_resources common_ctx =
 
 
 
-let write_build_data common_ctx filename classes main_deps build_extra extern_src exe_name =
+let write_build_data common_ctx filename classes main_deps boot_deps build_extra extern_src exe_name =
    let buildfile = open_out filename in
    let include_prefix = get_include_prefix common_ctx true in
    let add_class_to_buildfile class_path deps  =
@@ -4279,7 +4376,7 @@ let write_build_data common_ctx filename classes main_deps build_extra extern_sr
    output_string buildfile "<files id=\"haxe\">\n";
    output_string buildfile "<compilerflag value=\"-Iinclude\"/>\n";
    List.iter add_classdef_to_buildfile classes;
-   add_class_to_buildfile ( [] , "__boot__")  [];
+   add_class_to_buildfile ( [] , "__boot__")  boot_deps;
    add_class_to_buildfile ( [] , "__files__")  [];
    add_class_to_buildfile ( [] , "__resources__")  [];
    output_string buildfile "</files>\n";
@@ -4941,7 +5038,7 @@ class script_writer common_ctx ctx filename asciiOut =
             | "::String"  -> ArrayData "String"
             | "int" | "Float" | "bool" | "String" | "unsigned char" ->
                ArrayData typeName
-            | "Dynamic" -> ArrayAny
+            | "cpp::ArrayBase" | "Dynamic" -> ArrayAny
             | _ when is_interface_type param -> ArrayInterface (this#typeId (script_type_string param))
             | _ -> ArrayObject
             )
@@ -5114,7 +5211,7 @@ class script_writer common_ctx ctx filename asciiOut =
       let argN = (string_of_int (List.length arg_list)) ^ " " in
       let is_real_function field =
          match field.cf_kind with
-         | Method MethNormal -> true
+         | Method MethNormal | Method MethInline-> true
          | _ -> false;
       in
       let gen_call () =
@@ -5473,7 +5570,7 @@ let generate_source common_ctx =
       (match object_def with
       | TClassDecl class_def when is_extern_class class_def ->
          build_xml := !build_xml ^ (get_class_code class_def Meta.BuildXml);
-         let source = get_meta_string_path common_ctx class_def.cl_meta Meta.SourceFile in
+         let source = get_meta_string_path class_def.cl_meta Meta.SourceFile in
          if (source<>"") then
             extern_src := source :: !extern_src;
       | TClassDecl class_def ->
@@ -5487,7 +5584,7 @@ let generate_source common_ctx =
                init_classes := class_def.cl_path ::  !init_classes;
             if (has_boot_field class_def) then
                boot_classes := class_def.cl_path ::  !boot_classes
-            else
+            else if not (has_meta_key class_def.cl_meta Meta.NativeGen) then
                nonboot_classes := class_def.cl_path ::  !nonboot_classes;
             let deps = generate_class_files common_ctx
                member_types super_deps constructor_deps class_def file_info scriptable in
@@ -5537,7 +5634,7 @@ let generate_source common_ctx =
          with Not_found -> "export_classes.info"
       in
       if (filename <> "") then begin
-         let escape s = 
+         let escape s =
             let b = Buffer.create 0 in
             for i = 0 to String.length s - 1 do
                let c = String.unsafe_get s i in
@@ -5562,7 +5659,7 @@ let generate_source common_ctx =
             | TAbstract ({ a_path = ([],"Int") },[]) -> "int"
             | TAbstract( { a_path = ([], "EnumValue") }, _  ) -> "Dynamic"
             | TEnum (enum,params) -> spath enum.e_path
-            | TInst (klass,params) -> 
+            | TInst (klass,params) ->
                (match klass.cl_path, params with
                (* Array class *)
                (*|  ([],"Array") when is_dynamic_array_param (List.hd params) -> "Dynamic" *)
@@ -5657,7 +5754,7 @@ let generate_source common_ctx =
    | Some path -> (snd path)
    | _ -> "output" in
 
-   write_build_data common_ctx (common_ctx.file ^ "/Build.xml") !exe_classes !main_deps !build_xml !extern_src output_name;
+   write_build_data common_ctx (common_ctx.file ^ "/Build.xml") !exe_classes !main_deps (!boot_enums@ !boot_classes) !build_xml !extern_src output_name;
    let cmd_defines = ref "" in
    PMap.iter ( fun name value -> match name with
       | "true" | "sys" | "dce" | "cpp" | "debug" -> ()

+ 17 - 2
gencs.ml

@@ -1138,8 +1138,7 @@ let configure gen =
 		else fun w p ->
 			let cur_line = Lexer.get_error_line p in
 			let file = Common.get_full_path p.pfile in
-			let line = if Common.defined gen.gcon Define.Unity46LineNumbers then cur_line - 1 else cur_line in
-			if cur_line <> ((!last_line)+1) then begin print w "#line %d \"%s\"" line (Ast.s_escape file); newline w end;
+			if cur_line <> ((!last_line)+1) then begin print w "#line %d \"%s\"" cur_line (Ast.s_escape file); newline w end;
 			last_line := cur_line
 	in
 	let line_reset_directive =
@@ -2363,6 +2362,22 @@ let configure gen =
 				begin_block w;
 				true
 		in
+
+		(try
+			let _,m,_ = Meta.get (Meta.Custom "generic_iface") cl.cl_meta in
+			let rec loop i acc =
+				if i == 0 then
+					acc
+				else
+					"object" :: (loop (pred i) acc)
+			in
+			let tparams = loop (match m with [(EConst(Int s),_)] -> int_of_string s | _ -> assert false) [] in
+			cl.cl_meta <- (Meta.Meta, [
+				EConst(String("global::haxe.lang.GenericInterface(typeof(global::" ^ module_s (TClassDecl cl) ^ "<" ^ String.concat ", " tparams ^ ">))") ), cl.cl_pos
+			], cl.cl_pos) :: cl.cl_meta
+		with Not_found ->
+			());
+
 		gen_attributes w cl.cl_meta;
 
 		let is_main =

+ 0 - 2
genjava.ml

@@ -205,8 +205,6 @@ struct
 				| TCall( ({ eexpr = TField( (_ as ef), FStatic({ cl_path = (["java";"lang"], "Math") }, { cf_name = ("ffloor" as f) }) ) } as fe), p)
 				| TCall( ({ eexpr = TField( (_ as ef), FStatic({ cl_path = (["java";"lang"], "Math") }, { cf_name = ("fceil" as f) }) ) } as fe), p) ->
 						Type.map_expr run { e with eexpr = TCall({ fe with eexpr = TField(ef, FDynamic (String.sub f 1 (String.length f - 1)))	}, p) }
-				| TCall( ({ eexpr = TField( (_ as ef), FStatic({ cl_path = (["java";"lang"], "Math") }, { cf_name = ("fround") }) ) } as fe), p) ->
-						Type.map_expr run { e with eexpr = TCall({ fe with eexpr = TField(ef, FDynamic "rint")	}, p) }
 				| TCall( { eexpr = TField( _, FStatic({ cl_path = (["java";"lang"], "Math") }, { cf_name = "floor" }) ) }, _)
 				| TCall( { eexpr = TField( _, FStatic({ cl_path = (["java";"lang"], "Math") }, { cf_name = "round" }) ) }, _)
 				| TCall( { eexpr = TField( _, FStatic({ cl_path = (["java";"lang"], "Math") }, { cf_name = "ceil" }) ) }, _) ->

+ 3 - 3
genjs.ml

@@ -1099,14 +1099,14 @@ let generate_enum ctx e =
 		| TFun (args,_) ->
 			let sargs = String.concat "," (List.map (fun (n,_,_) -> ident n) args) in
 			print ctx "function(%s) { var $x = [\"%s\",%d,%s]; $x.__enum__ = %s;" sargs f.ef_name f.ef_index sargs p;
-			if has_feature ctx "may_print_enum" then
+			if has_feature ctx "has_enum" then
 				spr ctx " $x.toString = $estr;";
 			spr ctx " return $x; }";
 			ctx.separator <- true;
 		| _ ->
 			print ctx "[\"%s\",%d]" f.ef_name f.ef_index;
 			newline ctx;
-			if has_feature ctx "may_print_enum" then begin
+			if has_feature ctx "has_enum" then begin
 				print ctx "%s%s.toString = $estr" p (field f.ef_name);
 				newline ctx;
 			end;
@@ -1329,7 +1329,7 @@ let generate com =
 	(* TODO: fix $estr *)
 	let vars = [] in
 	let vars = (if has_feature ctx "Type.resolveClass" || has_feature ctx "Type.resolveEnum" then ("$hxClasses = " ^ (if ctx.js_modern then "{}" else "$hxClasses || {}")) :: vars else vars) in
-	let vars = if has_feature ctx "may_print_enum"
+	let vars = if has_feature ctx "has_enum"
 		then ("$estr = function() { return " ^ (ctx.type_accessor (TClassDecl { null_class with cl_path = ["js"],"Boot" })) ^ ".__string_rec(this,''); }") :: vars
 		else vars in
 	(match List.rev vars with

+ 3 - 3
genphp.ml

@@ -589,6 +589,8 @@ and gen_call ctx e el =
 	| TLocal { v_name = "__php__" }, [{ eexpr = TConst (TString code) }] ->
 		(*--php-prefix*)
 		spr ctx (prefix_init_replace ctx.com code)
+	| TLocal { v_name = "__php__" }, { eexpr = TConst (TString code); epos = p } :: tl ->
+		Codegen.interpolate_code ctx.com code tl (spr ctx) (gen_expr ctx) p
 	| TLocal { v_name = "__instanceof__" },  [e1;{ eexpr = TConst (TString t) }] ->
 		gen_value ctx e1;
 		print ctx " instanceof %s" t;
@@ -1307,9 +1309,7 @@ and gen_expr ctx e =
 			end) in
 		let remaining = ref (List.length el) in
 		let build e =
-			(match e.eexpr with
-			| TBlock [] -> ()
-			| _ -> newline ctx);
+			newline ctx;
 			if (in_block && !remaining = 1) then begin
 				(match e.eexpr with
 				| TIf _

+ 6 - 1
genpy.ml

@@ -1260,7 +1260,12 @@ module Printer = struct
 					Printf.sprintf "%s(%s,%s)" (third ops) (print_expr pctx e1) (print_expr pctx e2)
 				| _,_ -> Printf.sprintf "(%s %s %s)" (print_expr pctx e1) (snd ops) (print_expr pctx e2))
 			| TBinop(OpMod,e1,e2) when (is_type1 "" "Int")(e1.etype) && (is_type1 "" "Int")(e2.etype) ->
-				Printf.sprintf "(%s %% %s)" (print_expr pctx e1) (print_expr pctx e2)
+				(match e1.eexpr with
+				| TConst(TInt(x)) when (Int32.to_int x) >= 0 ->
+					(* constant optimization *)
+					Printf.sprintf "%s %% %s" (print_expr pctx e1) (print_expr pctx e2)
+				| _ ->
+					Printf.sprintf "HxOverrides.mod(%s, %s)" (print_expr pctx e1) (print_expr pctx e2))
 			| TBinop(OpMod,e1,e2) ->
 				Printf.sprintf "HxOverrides.modf(%s, %s)" (print_expr pctx e1) (print_expr pctx e2)
 			| TBinop(OpUShr,e1,e2) ->

+ 16 - 5
interp.ml

@@ -4628,12 +4628,18 @@ and encode_tfunc func =
 	]
 
 and encode_field_access fa =
+	let encode_instance c tl =
+		enc_obj [
+			"c",encode_clref c;
+			"params",encode_tparams tl
+		]
+	in
 	let tag,pl = match fa with
-		| FInstance(c,_,cf) -> 0,[encode_clref c;encode_cfref cf] (* TODO: breaking change, kind of *)
+		| FInstance(c,tl,cf) -> 0,[encode_clref c;encode_tparams tl;encode_cfref cf]
 		| FStatic(c,cf) -> 1,[encode_clref c;encode_cfref cf]
 		| FAnon(cf) -> 2,[encode_cfref cf]
 		| FDynamic(s) -> 3,[enc_string s]
-		| FClosure(co,cf) -> 4,[(match co with Some (c,_) -> encode_clref c | None -> VNull);encode_cfref cf] (* TODO: breaking change, kind of, too *)
+		| FClosure(co,cf) -> 4,[(match co with Some (c,tl) -> encode_instance c tl | None -> VNull);encode_cfref cf]
 		| FEnum(en,ef) -> 5,[encode_enref en;encode_efield ef]
 	in
 	enc_enum IFieldAccess tag pl
@@ -4769,13 +4775,18 @@ let decode_efield v =
 
 let decode_field_access v =
 	match decode_enum v with
-	| 0, [c;cf] ->
+	| 0, [c;tl;cf] ->
 		let c = decode_ref c in
-		FInstance(c,List.map snd c.cl_params,decode_ref cf) (* TODO: breaking change? *)
+		FInstance(c,List.map decode_type (dec_array tl),decode_ref cf)
 	| 1, [c;cf] -> FStatic(decode_ref c,decode_ref cf)
 	| 2, [cf] -> FAnon(decode_ref cf)
 	| 3, [s] -> FDynamic(dec_string s)
-	| 4, [co;cf] -> FClosure(opt decode_ref co,decode_ref cf)
+	| 4, [co;cf] ->
+		let co = match co with
+			| VNull -> None
+			| _ -> Some (decode_ref (field co "c"),List.map decode_type (dec_array (field co "params")))
+		in
+		FClosure(co,decode_ref cf)
 	| 5, [e;ef] -> FEnum(decode_ref e,decode_efield ef)
 	| _ -> raise Invalid_expr
 

+ 1 - 1
libs

@@ -1 +1 @@
-Subproject commit 8bba5315cabf666f94031436653ee0c6115a1762
+Subproject commit 7a83e902634e1db204f6e3a48c2439f63d83c141

+ 22 - 26
main.ml

@@ -96,7 +96,7 @@ let is_debug_run() =
 	try Sys.getenv "HAXEDEBUG" = "1" with _ -> false
 
 let s_version =
-	Printf.sprintf "%d.%d.%d" version_major version_minor version_revision
+	Printf.sprintf "%d.%d.%d%s" version_major version_minor version_revision (match Version.version_extra with None -> "" | Some v -> " " ^ v)
 
 let format msg p =
 	if p = Ast.null_pos then
@@ -122,27 +122,26 @@ let message ctx msg p =
 	ctx.messages <- format msg p :: ctx.messages
 
 let deprecated = [
-	"Class not found : IntIter","IntIter was renamed to IntIterator";
+	"Type not found : IntIter","IntIter was renamed to IntIterator";
 	"EReg has no field customReplace","EReg.customReplace was renamed to EReg.map";
 	"#StringTools has no field isEOF","StringTools.isEOF was renamed to StringTools.isEof";
-	"Class not found : haxe.BaseCode","haxe.BaseCode was moved to haxe.crypto.BaseCode";
-	"Class not found : haxe.Md5","haxe.Md5 was moved to haxe.crypto.Md5";
-	"Class not found : haxe.SHA1","haxe.SHA1 was moved to haxe.crypto.SHA1";
-	"Class not found : Hash","Hash has been removed, use Map instead";
-	"Class not found : IntHash","IntHash has been removed, use Map instead";
-	"Class not found : haxe.FastList","haxe.FastList was moved to haxe.ds.GenericStack";
+	"Type not found : haxe.BaseCode","haxe.BaseCode was moved to haxe.crypto.BaseCode";
+	"Type not found : haxe.Md5","haxe.Md5 was moved to haxe.crypto.Md5";
+	"Type not found : haxe.SHA1","haxe.SHA1 was moved to haxe.crypto.SHA1";
+	"Type not found : Hash","Hash has been removed, use Map instead";
+	"Type not found : IntHash","IntHash has been removed, use Map instead";
+	"Type not found : haxe.FastList","haxe.FastList was moved to haxe.ds.GenericStack";
 	"#Std has no field format","Std.format has been removed, use single quote 'string ${escape}' syntax instead";
 	"Identifier 'EType' is not part of enum haxe.macro.ExprDef","EType has been removed, use EField instead";
 	"Identifier 'CType' is not part of enum haxe.macro.Constant","CType has been removed, use CIdent instead";
-	"Class not found : haxe.rtti.Infos","Use @:rtti instead of implementing haxe.rtti.Infos";
-	"Class not found : haxe.rtti.Generic","Use @:generic instead of implementing haxe.Generic";
-	"Class not found : flash.utils.TypedDictionary","flash.utils.TypedDictionary has been removed, use Map instead";
-	"Class not found : haxe.Stack", "haxe.Stack has been renamed to haxe.CallStack";
-	"Class not found : neko.zip.Reader", "neko.zip.Reader has been removed, use haxe.zip.Reader instead";
-	"Class not found : neko.zip.Writer", "neko.zip.Writer has been removed, use haxe.zip.Writer instead";
-	"Class not found : haxe.Public", "Use @:publicFields instead of implementing or extending haxe.Public";
-	"#Xml has no field createProlog", "Xml.createProlog was renamed to Xml.createProcessingInstruction";
-	"Module js.html.HtmlElement is loaded with a different case than js.html.HTMLElement", "htmlelement"
+	"Type not found : haxe.rtti.Infos","Use @:rtti instead of implementing haxe.rtti.Infos";
+	"Type not found : haxe.rtti.Generic","Use @:generic instead of implementing haxe.Generic";
+	"Type not found : flash.utils.TypedDictionary","flash.utils.TypedDictionary has been removed, use Map instead";
+	"Type not found : haxe.Stack", "haxe.Stack has been renamed to haxe.CallStack";
+	"Type not found : neko.zip.Reader", "neko.zip.Reader has been removed, use haxe.zip.Reader instead";
+	"Type not found : neko.zip.Writer", "neko.zip.Writer has been removed, use haxe.zip.Writer instead";
+	"Type not found : haxe.Public", "Use @:publicFields instead of implementing or extending haxe.Public";
+	"#Xml has no field createProlog", "Xml.createProlog was renamed to Xml.createProcessingInstruction"
 ]
 
 let limit_string s offset =
@@ -159,10 +158,7 @@ let limit_string s offset =
 
 let error ctx msg p =
 	let msg = try List.assoc msg deprecated with Not_found -> msg in
-	if msg = "htmlelement" then
-		message ctx "There was a problem with HtmlElement, please refer to https://github.com/HaxeFoundation/html-externs/blob/master/README.md#htmlelement" null_pos
-	else
-		message ctx msg p;
+	message ctx msg p;
 	ctx.has_error <- true
 
 let htmlescape s =
@@ -664,7 +660,7 @@ let rec process_params create pl =
 				(* already connected : skip *)
 				loop acc l)
 		| "--run" :: cl :: args ->
-			let acc = (cl ^ ".main()") :: "--macro" :: acc in
+			let acc = cl :: "-main" :: "--interp" :: acc in
 			let ctx = create (!each_params @ (List.rev acc)) in
 			ctx.com.sys_args <- args;
 			init ctx;
@@ -982,8 +978,8 @@ and do_connect host port args =
 
 and init ctx =
 	let usage = Printf.sprintf
-		"Haxe Compiler %s %s- (C)2005-2015 Haxe Foundation\n Usage : haxe%s -main <class> [-swf|-js|-neko|-php|-cpp|-as3] <output> [options]\n Options :"
-		s_version (match Version.version_extra with None -> "" | Some v -> v) (if Sys.os_type = "Win32" then ".exe" else "")
+		"Haxe Compiler %s - (C)2005-2015 Haxe Foundation\n Usage : haxe%s -main <class> [-swf|-js|-neko|-php|-cpp|-as3] <output> [options]\n Options :"
+		s_version (if Sys.os_type = "Win32" then ".exe" else "")
 	in
 	let com = ctx.com in
 	let classes = ref [([],"Std")] in
@@ -1021,8 +1017,8 @@ try
 			| l ->
 				l
 		in
-		let parts = "" :: Str.split_delim (Str.regexp "[;:]") p in
-		com.class_path <- List.map normalize_path (loop parts)
+		let parts = Str.split_delim (Str.regexp "[;:]") p in
+		com.class_path <- "" :: List.map normalize_path (loop parts)
 	with
 		Not_found ->
 			if Sys.os_type = "Unix" then

+ 28 - 19
matcher.ml

@@ -326,6 +326,26 @@ let to_pattern ctx e t =
 		tctx.pc_locals <- PMap.add s (v,p) tctx.pc_locals;
 		v
 	in
+	let check_texpr_pattern e t p =
+		let ec = match Optimizer.make_constant_expression ctx ~concat_strings:true e with Some e -> e | None -> e in
+		match ec.eexpr with
+			| TField (_,FEnum (en,ef)) ->
+				begin try unify_raise ctx ec.etype t ec.epos with Error (Unify _,_) -> raise Not_found end;
+				begin try
+					unify_enum_field en (List.map (fun _ -> mk_mono()) en.e_params) ef t;
+				with Unify_error l ->
+					error (error_msg (Unify l)) p
+				end;
+				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;
+				mk_con_pat (CConst c) [] t p
+			| TTypeExpr mt ->
+				mk_type_pat ctx mt t p
+			| _ ->
+				raise Not_found
+	in
 	let rec loop pctx e t =
 		let p = pos e in
 		match fst e with
@@ -362,7 +382,13 @@ let to_pattern ctx e t =
 			| TTypeExpr mt ->
 				mk_type_pat ctx mt t p
 			| TField(_, FStatic(_,cf)) when is_value_type cf.cf_type ->
-				mk_con_pat (CExpr e) [] cf.cf_type p
+				ignore (follow cf.cf_type);
+				begin match cf.cf_expr with
+				| Some e ->
+					(try check_texpr_pattern e t p with Not_found -> mk_con_pat (CExpr e) [] cf.cf_type p)
+				| None ->
+					mk_con_pat (CExpr e) [] cf.cf_type p
+				end
 			| TField(_, FEnum(en,ef)) ->
 				begin try
 					unify_enum_field en (List.map (fun _ -> mk_mono()) en.e_params) ef t
@@ -449,24 +475,7 @@ let to_pattern ctx e t =
 						ctx.untyped <- old;
 						e
 				in
-				let ec = match Optimizer.make_constant_expression ctx ~concat_strings:true ec with Some e -> e | None -> ec in
-				(match ec.eexpr with
-					| TField (_,FEnum (en,ef)) ->
-						begin try unify_raise ctx ec.etype t ec.epos with Error (Unify _,_) -> raise Not_found end;
-						begin try
-							unify_enum_field en (List.map (fun _ -> mk_mono()) en.e_params) ef t;
-						with Unify_error l ->
-							error (error_msg (Unify l)) p
-						end;
-						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;
-						mk_con_pat (CConst c) [] t p
-					| TTypeExpr mt ->
-						mk_type_pat ctx mt t p
-					| _ ->
-						raise Not_found);
+				check_texpr_pattern ec t p
 			with Not_found ->
 				begin match get_tuple_params t with
 					| Some tl ->

+ 1 - 1
std/IntIterator.hx

@@ -23,7 +23,7 @@
  /**
 	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 its special syntax:
 	`min...max`
 
 	While it is possible to assign an instance of IntIterator to a variable or

+ 57 - 57
std/Math.hx

@@ -32,47 +32,47 @@ extern class Math
 	static var PI(default,null) : Float;
 
 	/**
-		A special Float constant which denotes negative infinity.
+		A special `Float` constant which denotes negative infinity.
 
 		For example, this is the result of -1.0 / 0.0.
 
-		Operations with NEGATIVE_INFINITY as an operand may result in
-		NEGATIVE_INFINITY, POSITIVE_INFINITY or NaN.
+		Operations with `NEGATIVE_INFINITY` as an operand may result in
+		`NEGATIVE_INFINITY`, `POSITIVE_INFINITY` or `NaN`.
 
-		If this constant is converted to an Int, e.g. through Std.int(), the
+		If this constant is converted to an `Int`, e.g. through `Std.int()`, the
 		result is unspecified.
 	**/
 	static var NEGATIVE_INFINITY(default, null) : Float;
 
 	/**
-		A special Float constant which denotes negative infinity.
+		A special `Float` constant which denotes negative infinity.
 
 		For example, this is the result of 1.0 / 0.0.
 
-		Operations with POSITIVE_INFINITY as an operand may result in
-		NEGATIVE_INFINITY, POSITIVE_INFINITY or NaN.
+		Operations with `POSITIVE_INFINITY` as an operand may result in
+		`NEGATIVE_INFINITY`, `POSITIVE_INFINITY` or `NaN`.
 
-		If this constant is converted to an Int, e.g. through Std.int(), the
+		If this constant is converted to an `Int`, e.g. through `Std.int()`, the
 		result is unspecified.
 	**/
 	static var POSITIVE_INFINITY(default,null) : Float;
 
 	/**
-		A special Float constant which denotes an invalid number.
+		A special `Float` constant which denotes an invalid number.
 
 		NaN stands for "Not a Number". It occurs when a mathematically incorrect
 		operation is executed, such as taking the square root of a negative
 		number: Math.sqrt(-1).
 
-		All further operations with NaN as an operand will result in NaN.
+		All further operations with `NaN` as an operand will result in `NaN`.
 
-		If this constant is converted to an Int, e.g. through Std.int(), the
+		If this constant is converted to an `Int`, e.g. through `Std.int()`, the
 		result is unspecified.
 
-		In order to test if a value is NaN, you should use Math.isNaN() function.
+		In order to test if a value is `NaN`, you should use `Math.isNaN()` function.
 
 		@php In PHP versions prior to 5.3.1 VC 9 there may be unexpected
-		results when performing arithmetic operations with NaN on Windows,
+		results when performing arithmetic operations with `NaN` on Windows,
 		see [https://bugs.php.net/bug.php?id=42143]
 	**/
 	static var NaN(default, null) : Float;
@@ -83,56 +83,56 @@ extern class Math
 		If `v` is positive or 0, the result is unchanged. Otherwise the result
 		is -`v`.
 
-		If `v` is NEGATIVE_INFINITY or POSITIVE_INFINITY, the result is
-		POSITIVE_INFINITY.
+		If `v` is `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`, the result is
+		`POSITIVE_INFINITY`.
 
-		If `v` is NaN, the result is NaN.
+		If `v` is `NaN`, the result is `NaN`.
 	**/
 	static function abs(v:Float):Float;
 
 	/**
 		Returns the smaller of values `a` and `b`.
 
-		If `a` or `b` are NaN, the result is NaN.
-		If `a` or `b` are NEGATIVE_INFINITY, the result is NEGATIVE_INFINITY.
-		If `a` and `b` are POSITIVE_INFINITY, the result is POSITIVE_INFINITY.
+		If `a` or `b` are `NaN`, the result is `NaN`.
+		If `a` or `b` are `NEGATIVE_INFINITY`, the result is `NEGATIVE_INFINITY`.
+		If `a` and `b` are `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`.
 	**/
 	static function min(a:Float, b:Float):Float;
 
 	/**
 		Returns the greater of values `a` and `b`.
 
-		If `a` or `b` are NaN, the result is NaN.
-		If `a` or `b` are POSITIVE_INFINITY, the result is POSITIVE_INFINITY.
-		If `a` and `b` are NEGATIVE_INFINITY, the result is NEGATIVE_INFINITY.
+		If `a` or `b` are `NaN`, the result is `NaN`.
+		If `a` or `b` are `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`.
+		If `a` and `b` are `NEGATIVE_INFINITY`, the result is `NEGATIVE_INFINITY`.
 	**/
 	static function max(a:Float, b:Float):Float;
 
 	/**
 		Returns the trigonometric sine of the specified angle `v`, in radians.
 
-		If `v` is NaN or infinite, the result is NaN.
+		If `v` is `NaN` or infinite, the result is `NaN`.
 	**/
 	static function sin(v:Float):Float;
 
 	/**
 		Returns the trigonometric cosine of the specified angle `v`, in radians.
 
-		If `v` is NaN or infinite, the result is NaN.
+		If `v` is `NaN` or infinite, the result is `NaN`.
 	**/
 	static function cos(v:Float):Float;
 
 	/**
 		Returns the trigonometric tangent of the specified angle `v`, in radians.
 
-		If `v` is NaN or infinite, the result is NaN.
+		If `v` is `NaN` or infinite, the result is `NaN`.
 	**/
 	static function tan(v:Float):Float;
 
 	/**
 		Returns the trigonometric arc of the specified angle `v`, in radians.
 
-		If `v` is NaN or infinite, the result is NaN.
+		If `v` is `NaN` or infinite, the result is `NaN`.
 	**/
 	static function asin(v:Float):Float;
 
@@ -140,7 +140,7 @@ extern class Math
 		Returns the trigonometric arc cosine of the specified angle `v`,
 		in radians.
 
-		If `v` is NaN or infinite, the result is NaN.
+		If `v` is `NaN` or infinite, the result is `NaN`.
 	**/
 	static function acos(v:Float):Float;
 
@@ -148,7 +148,7 @@ extern class Math
 		Returns the trigonometric arc tangent of the specified angle `v`,
 		in radians.
 
-		If `v` is NaN or infinite, the result is NaN.
+		If `v` is `NaN` or infinite, the result is `NaN`.
 	**/
 	static function atan(v:Float):Float;
 
@@ -156,8 +156,8 @@ extern class Math
 		Returns the trigonometric arc tangent whose tangent is the quotient of
 		two specified numbers, in radians.
 
-		If parameter `x` or `y`  is NaN, NEGATIVE_INFINITY or POSITIVE_INFINITY,
-		the result is NaN.
+		If parameter `x` or `y`  is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`,
+		the result is `NaN`.
 	**/
 	static function atan2(y:Float, x:Float):Float;
 
@@ -166,9 +166,9 @@ extern class Math
 
 		exp(1.0) is approximately 2.718281828459.
 
-		If `v` is POSITIVE_INFINITY, the result is POSITIVE_INFINITY.
-		If `v` is NEGATIVE_INFINITY, the result is 0.0.
-		If `v` is NaN, the result is NaN.
+		If `v` is `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`.
+		If `v` is `NEGATIVE_INFINITY`, the result is `0.0`.
+		If `v` is `NaN`, the result is `NaN`.
 	**/
 	static function exp(v:Float):Float;
 
@@ -178,10 +178,10 @@ extern class Math
 		This is the mathematical inverse operation of exp,
 		i.e. `log(exp(v)) == v` always holds.
 
-		If `v` is negative (including NEGATIVE_INFINITY) or NaN, the result
-		is NaN.
-		If `v` is POSITIVE_INFINITY, the result is POSITIVE_INFINITY.
-		If `v` is 0.0, the result is NEGATIVE_INFINITY.
+		If `v` is negative (including `NEGATIVE_INFINITY`) or `NaN`, the result
+		is `NaN`.
+		If `v` is `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`.
+		If `v` is `0.0`, the result is `NEGATIVE_INFINITY`.
 	**/
 	static function log(v:Float):Float;
 
@@ -193,34 +193,34 @@ extern class Math
 	/**
 		Returns the square root of `v`.
 
-		If `v` is negative (including NEGATIVE_INFINITY) or NaN, the result
-		is NaN.
-		If `v` is POSITIVE_INFINITY, the result is POSITIVE_INFINITY.
-		If `v` is 0.0, the result is 0.0.
+		If `v` is negative (including `NEGATIVE_INFINITY`) or `NaN`, the result
+		is `NaN`.
+		If `v` is `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`.
+		If `v` is `0.0`, the result is `0.0`.
 	**/
 	static function sqrt(v:Float):Float;
 
 	/**
 		Rounds `v` to the nearest integer value.
 
-		If `v` is outside of the signed Int32 range, or is NaN, NEGATIVE_INFINITY
-		or POSITIVE_INFINITY, the result is unspecified.
+		If `v` is outside of the signed `Int32` range, or is `NaN`, `NEGATIVE_INFINITY`
+		or `POSITIVE_INFINITY`, the result is unspecified.
 	**/
 	static function round(v:Float):Int;
 
 	/**
 		Returns the largest integer value that is not greater than `v`.
 
-		If `v` is outside of the signed Int32 range, or is NaN, NEGATIVE_INFINITY
-		or POSITIVE_INFINITY, the result is unspecified.
+		If `v` is outside of the signed `Int32` range, or is `NaN`, `NEGATIVE_INFINITY`
+		or `POSITIVE_INFINITY`, the result is unspecified.
 	**/
 	static function floor(v:Float):Int;
 
 	/**
 		Returns the smallest integer value that is not less than `v`.
 
-		If `v` is outside of the signed Int32 range, or is NaN, NEGATIVE_INFINITY
-		or POSITIVE_INFINITY, the result is unspecified.
+		If `v` is outside of the signed `Int32` range, or is `NaN`, `NEGATIVE_INFINITY`
+		or `POSITIVE_INFINITY`, the result is unspecified.
 	**/
 	static function ceil(v:Float):Int;
 
@@ -232,17 +232,17 @@ extern class Math
 
 	#if ((flash && !as3) || cpp)
 	/**
-		Returns the largest integer value that is not greater than `v`, as a Float.
+		Returns the largest integer value that is not greater than `v`, as a `Float`.
 
-		If `v` is is NaN, NEGATIVE_INFINITY or POSITIVE_INFINITY,
+		If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`,
 		the result is unspecified.
 	**/
 	static function ffloor( v : Float ) : Float;
 
 	/**
-		Returns the smallest integer value that is not less than `v`, as a Float.
+		Returns the smallest integer value that is not less than `v`, as a `Float`.
 
-		If `v` is is NaN, NEGATIVE_INFINITY or POSITIVE_INFINITY,
+		If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`,
 		the result is unspecified.
 	**/
 	static function fceil( v : Float ) : Float;
@@ -250,7 +250,7 @@ extern class Math
 	/**
 		Rounds `v` to the nearest integer value, as a Float.
 
-		If `v` is is NaN, NEGATIVE_INFINITY or POSITIVE_INFINITY,
+		If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`,
 		the result is unspecified.
 	**/
 	static function fround( v : Float ) : Float;
@@ -275,17 +275,17 @@ extern class Math
 	/**
 		Tells if `f` is a finite number.
 
-		If `f` is POSITIVE_INFINITY, NEGATIVE_INFINITY or NaN, the result
-		is false, otherwise the result is true.
+		If `f` is `POSITIVE_INFINITY`, `NEGATIVE_INFINITY` or `NaN`, the result
+		is `false`, otherwise the result is `true`.
 	**/
 	static function isFinite( f : Float ) : Bool;
 
 	/**
 		Tells if `f` is not a valid number.
 
-		If `f` is NaN, the result is true, otherwise the result is false.
-		In particular, both POSITIVE_INFINITY and NEGATIVE_INFINITY are
-		not considered NaN.
+		If `f` is `NaN`, the result is `true`, otherwise the result is `false`.
+		In particular, both `POSITIVE_INFINITY` and `NEGATIVE_INFINITY` are
+		not considered `NaN`.
 	**/
 	static function isNaN( f : Float ) : Bool;
 

+ 5 - 5
std/Std.hx

@@ -29,7 +29,7 @@
 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;
 
@@ -44,7 +44,7 @@ extern class Std {
 		returned. Otherwise null is returned.
 
 		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
 		unspecified.
@@ -74,7 +74,7 @@ extern class Std {
 	/**
 		Converts a `Float` to an `Int`, rounded towards 0.
 
-		If `x` is outside of the signed Int32 range, or is NaN, NEGATIVE_INFINITY or POSITIVE_INFINITY, the result is unspecified.
+		If `x` is outside of the signed Int32 range, or is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`, the result is unspecified.
 	**/
 	public static function int( x : Float ) : Int;
 
@@ -96,7 +96,7 @@ extern class Std {
 		Leading 0s that are not part of the 0x/0X hexadecimal notation are ignored, which means octal
 		notation is not supported.
 
-		If the input cannot be recognized, the result is null.
+		If the input cannot be recognized, the result is `null`.
 	**/
 	public static function parseInt( x : String ) : Null<Int>;
 
@@ -104,7 +104,7 @@ extern class Std {
 		Converts a `String` to a `Float`.
 
 		The parsing rules for `parseInt` apply here as well, with the exception of invalid input
-		resulting in a NaN value instead of null.
+		resulting in a `NaN` value instead of null.
 
 		Additionally, decimal notation may contain a single `.` to denote the start of the fractions.
 	**/

+ 2 - 5
std/StringTools.hx

@@ -29,9 +29,6 @@
 #if cpp
 using cpp.NativeString;
 #end
-#if cs
-@:keep
-#end
 class StringTools {
 	/**
 		Encode an URL by using the standard format.
@@ -50,9 +47,9 @@ class StringTools {
 				return untyped __java__("java.net.URLEncoder.encode(s, \"UTF-8\")")
 			catch (e:Dynamic) throw e;
 		#elseif cs
-			return untyped cs.system.Uri.EscapeUriString(s);
+			return untyped cs.system.Uri.EscapeDataString(s);
 		#elseif python
-			return python.lib.urllib.Parse.quote(s);
+			return python.lib.urllib.Parse.quote(s, "");
 		#else
 			return null;
 		#end

+ 17 - 6
std/Xml.hx

@@ -265,13 +265,13 @@ class Xml {
 
 	/**
 		Adds a child node to the Document or Element.
-		One node can only be inside one given node which is indicated by the [parent] property.
+		A child node can only be inside one given parent node, which is indicated by the [parent] property.
+		If the child is already inside this Document or Element, it will be moved to the last position among the Document or Element's children.
+		If the child node was previously inside a different node, it will be moved to this Document or Element.
 	**/
 	public function addChild( x : Xml ) : Void {
 		ensureElementType();
-		if (x.parent == this) {
-			return;
-		} else if (x.parent != null) {
+		if (x.parent != null) {
 			x.parent.removeChild(x);
 		}
 		children.push(x);
@@ -284,15 +284,26 @@ class Xml {
 	**/
 	public function removeChild( x : Xml ) : Bool {
 		ensureElementType();
-		return children.remove(x);
+		if (children.remove(x)) {
+			x.parent = null;
+			return true;
+		}
+		return false;
 	}
 
 	/**
 		Inserts a child at the given position among the other childs.
+		A child node can only be inside one given parent node, which is indicated by the [parent] property.
+		If the child is already inside this Document or Element, it will be moved to the new position among the Document or Element's children.
+		If the child node was previously inside a different node, it will be moved to this Document or Element.
 	**/
 	public function insertChild( x : Xml, pos : Int ) : Void {
 		ensureElementType();
+		if (x.parent != null) {
+			x.parent.children.remove(x);
+		}
 		children.insert(pos, x);
+		x.parent = this;
 	}
 
 	/**
@@ -313,4 +324,4 @@ class Xml {
 			throw 'Bad node type, expected Element or Document but found $nodeType';
 		}
 	}
-}
+}

+ 11 - 0
std/cpp/ArrayBase.hx

@@ -0,0 +1,11 @@
+package cpp;
+
+extern class ArrayBase
+{
+   // Length is number of elements
+   public var length(default,null):Int;
+   public function getElementSize():Int;
+   public function getByteCount():Int;
+   public function getBase():RawPointer<Char>;
+}
+

+ 17 - 0
std/cpp/Callable.hx

@@ -1,5 +1,22 @@
 package cpp;
 
+#if cpp
+
 typedef Callable<T> = Function<T, cpp.abi.Abi >
 
+#else
+
+@:noPackageRestrict
+abstract Callable<T>(T)
+{
+   public var call(get,never):T;
+
+   inline public function new(inValue:T) this = inValue;
+
+   inline function get_call():T return this;
+}
+
+
+#end
+
 

+ 1 - 1
std/cpp/CastCharStar.hx

@@ -2,7 +2,7 @@ package cpp;
 
 abstract CastCharStar( RawPointer<Char> ) to(RawPointer<Char>)
 {
-   inline function new(s:String) this = untyped s.__s;
+   inline function new(s:String) this = cast untyped s.__s;
 
    @:from
    static public inline function fromString(s:String) return new CastCharStar(s);

+ 4 - 1
std/cpp/ConstCharStar.hx

@@ -7,7 +7,10 @@ abstract ConstCharStar( RawConstPointer<Char> ) to(RawConstPointer<Char>)
    @:from
    static public inline function fromString(s:String) return new ConstCharStar(s);
 
-    @:to
+   @:to @:extern
+   public inline function toString():String return new String(untyped this);
+
+    @:to @:extern
     public inline function toPointer() return this;
 }
 

+ 3 - 2
std/cpp/ConstPointer.hx

@@ -6,7 +6,7 @@ extern class ConstPointer<T>
 {
    // ptr actually returns the pointer - not strictly a 'T' - for pointers to smart pointers
    // Use value or ref to get dereferenced value
-	private var ptr:T;
+	public var ptr:T;
 
    @:analyzer(no_simplification)
 	public var value(get,never):T;
@@ -20,11 +20,12 @@ extern class ConstPointer<T>
 	public function gt(inOther:Pointer<T>):Bool;
 	public function geq(inOther:Pointer<T>):Bool;
 
-
+   public static function fromRaw<T>(ptr:RawConstPointer<T>) : ConstPointer<T>;
 
    public static function fromPointer<T>(inNativePointer:Dynamic) : ConstPointer<T>;
 
 	public function reinterpret<Other>():Pointer<Other>;
+	public function rawCast<Other>():RawPointer<Other>;
 
    @:analyzer(no_simplification)
 	public function at(inIndex:Int):T;

+ 19 - 49
std/cpp/Lib.hx

@@ -21,24 +21,9 @@
  */
 package cpp;
 
-#if macro
-import haxe.macro.Context;
-import haxe.macro.Type;
-import haxe.macro.Expr;
-#else
 
-using cpp.NativeString;
-using cpp.RawConstPointer;
-using cpp.Char;
-
-#end
-
-#if macro
-@:noPackageRestrict
-#end
 class Lib {
 
-   #if !macro
 	/**
 		Load and return a Cpp primitive from a DLL library.
 	**/
@@ -50,13 +35,21 @@ class Lib {
 		#end
 	}
 
+	/**
+		Unloaded all dynamic libraries in reverse order of loading.
+		Returns the number of libraries unloaded.
+	**/
+	public static function unloadAllLibraries() : Int {
+		return untyped __global__.__hxcpp_unload_all_libraries();
+	}
+
    @:analyzer(no_simplification)
 	public static function _loadPrime( lib : String, prim : String, signature : String, quietFail = false ) : Dynamic {
-		var factory:Callable< RawConstPointer<Char> -> RawPointer<Object> > =
+		var factory:Callable< ConstCharStar -> Object > =
                untyped __global__.__hxcpp_cast_get_proc_address(lib, prim + "__prime", quietFail);
       if (factory!=null)
       {
-         var func:Dynamic = factory.call(signature.raw());
+         var func:Dynamic = factory.call(signature);
          if (func==null && !quietFail)
             throw '$prim does not have signature $signature';
          return func;
@@ -94,6 +87,15 @@ class Lib {
       return result;
    }
 
+	public static function pushDllSearchPath(inPath:String) : Void
+      untyped __global__.__hxcpp_push_dll_path(inPath);
+
+	public static function getDllExtension() : String
+      return untyped __global__.__hxcpp_get_dll_extension();
+
+	public static function getBinDirectory() : String
+      return untyped __global__.__hxcpp_get_bin_dir();
+
 	/**
 		Returns bytes referencing the content of a string.
       Use with extreme caution - changing constant strings will crash.
@@ -135,41 +137,9 @@ class Lib {
 		untyped __global__.__hxcpp_println(v);
 	}
 
-   #else
-   static function codeToType(code:String) : String
-   {
-      switch(code)
-      {
-         case "b" : return "Bool";
-         case "i" : return "Int";
-         case "d" : return "Float";
-         case "f" : return "cpp.Float32";
-         case "s" : return "String";
-         case "o" : return "cpp.Object";
-         case "v" : return "cpp.Void";
-         case "c" : return "cpp.ConstCharStar";
-         default:
-            throw "Unknown signature type :" + code;
-      }
-   }
-   #end
-
    public static function setFloatFormat(inFormat:String):Void
    {
       untyped __global__.__hxcpp_set_float_format(inFormat);
    }
 
-   public static macro function loadPrime(inModule:String, inName:String, inSig:String,inAllowFail:Bool = false)
-   {
-      var parts = inSig.split("");
-      if (parts.length<1)
-         throw "Invalid function signature " + inSig;
-      var typeString = parts.length==1 ? "Void" : codeToType(parts.shift());
-      for(p in parts)
-         typeString += "->" + codeToType(p);
-      typeString = "cpp.Callable<" + typeString + ">";
-      var expr = 'new $typeString(cpp.Lib._loadPrime("$inModule","$inName","$inSig",$inAllowFail))';
-      return Context.parse( expr, Context.currentPos() );
-   }
-
 }

+ 16 - 0
std/cpp/NativeArray.hx

@@ -8,6 +8,22 @@ extern class NativeArray {
 	untyped ioDestArray.blit(inDestElement, inSourceArray, inSourceElement, inElementCount);
 	};
 
+	public static inline function getBase( inArray:Array<Dynamic> ) : ArrayBase {
+      return untyped inArray;
+   }
+
+	public static inline function address<T>( inArray:Array<T>,inIndex:Int ) : Pointer<T> {
+      return Pointer.arrayElem(inArray,inIndex);
+   }
+
+	public static inline function setData<T>( inArray:Array<T>,inData:Pointer<T>,inElementCount:Int ) : Void {
+      untyped inArray.setData(inData.raw,inElementCount);
+   }
+	public static inline function setUnmanagedData<T>( inArray:Array<T>,inData:Pointer<T>,inElementCount:Int ) : Void {
+      untyped inArray.setUnmanagedData(inData.raw,inElementCount);
+   }
+
+
 	public static inline function zero<T>( ioDestArray:Array<T>, ?inFirst:Int, ?inElements:Int ) : Void {
 		untyped ioDestArray.zero(inFirst, inElements);
 	};

+ 2 - 0
std/cpp/Pointer.hx

@@ -13,6 +13,8 @@ extern class Pointer<T> extends ConstPointer<T> implements ArrayAccess<T>
    public function set_ref(t:T) : T;
 
 
+   public static function fromRaw<T>(ptr:RawPointer<T>) : Pointer<T>;
+
    public static function fromHandle<T>(inHandle:Dynamic,?inKind:String) : Pointer<T>;
 
    public static function fromPointer<T>(inNativePointer:Dynamic) : Pointer<T>;

+ 123 - 0
std/cpp/Prime.hx

@@ -0,0 +1,123 @@
+/*
+ * Copyright (C)2005-2012 Haxe Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+package cpp;
+
+#if macro
+import haxe.macro.Context;
+import haxe.macro.Type;
+import haxe.macro.Expr;
+#end
+
+@:noPackageRestrict
+class Prime {
+
+   #if (!macro && cpp)
+
+   @:analyzer(no_simplification)
+	public static function _loadPrime( lib : String, prim : String, signature : String, quietFail = false ) : Dynamic {
+		var factory:Callable< ConstCharStar -> Object > =
+               untyped __global__.__hxcpp_cast_get_proc_address(lib, prim + "__prime", quietFail);
+      if (factory!=null)
+      {
+         var func:Dynamic = factory.call(signature);
+         if (func==null && !quietFail)
+            throw '$prim does not have signature $signature';
+         return func;
+      }
+      return null;
+	}
+   #end
+
+   #if (macro)
+   static function codeToType(code:String,forCpp:Bool) : String
+   {
+      var isCpp = Context.defined("cpp");
+
+      switch(code)
+      {
+         case "b" : return "Bool";
+         case "i" : return "Int";
+         case "d" : return "Float";
+         case "s" : return "String";
+         case "f" : return forCpp ? "cpp.Float32" : "Float";
+         case "o" : return forCpp ? "cpp.Object" : "Dynamic";
+         case "v" : return forCpp ? "cpp.Void" : "Dynamic";
+         case "c" :
+             if (forCpp)
+                return "cpp.ConstCharStar";
+             throw "const char * type only supported in cpp mode";
+         default:
+            throw "Unknown signature type :" + code;
+      }
+   }
+   #end
+
+   public static function nekoInit(inModuleName:String) : Bool
+   {
+      #if neko
+      var init = neko.Lib.load(inModuleName, "neko_init", 5);
+
+      if (init != null) 
+      {
+         init( function(s) return new String(s),
+               function(len:Int) { var r = []; if (len > 0) r[len - 1] = null; return r; },
+               null,
+               true,
+               false);
+         return true;
+
+      }
+      #end
+      return false;
+   }
+
+
+   public static macro function load(inModule:String, inName:String, inSig:String,inAllowFail:Bool = false)
+   {
+      var parts = inSig.split("");
+      if (parts.length<1)
+         throw "Invalid function signature " + inSig;
+
+      var cppMode = Context.defined("cpp");
+
+      var typeString = parts.length==1 ? codeToType("v",cppMode) : codeToType(parts.shift(),cppMode);
+      for(p in parts)
+         typeString += "->" + codeToType(p,cppMode);
+
+      if (cppMode)
+      {
+         typeString = "cpp.Callable<" + typeString + ">";
+         var expr = 'new $typeString(cpp.Prime._loadPrime("$inModule","$inName","$inSig",$inAllowFail))';
+         return Context.parse( expr, Context.currentPos() );
+      }
+      else
+      {
+         var len = parts.length;
+         if (len>5)
+            len = -1;
+         var lazy = inAllowFail ? "loadLazy" : "load";
+         var expr = 'new cpp.Callable<$typeString>(neko.Lib.$lazy("$inModule","$inName",$len))';
+         return Context.parse( expr, Context.currentPos() );
+      }
+   }
+
+}

+ 2 - 3
std/cpp/_std/Sys.hx

@@ -106,7 +106,7 @@
 	}
 
 	public static function exit( code : Int ) : Void {
-		sys_exit(code);
+		untyped __global__.__hxcpp_exit(code);
 	}
 
 	public static function time() : Float {
@@ -140,7 +140,6 @@
 	private static var set_cwd = cpp.Lib.load("std","set_cwd",1);
 	private static var sys_string = cpp.Lib.load("std","sys_string",0);
 	private static var sys_command = cpp.Lib.load("std","sys_command",1);
-	private static var sys_exit = cpp.Lib.load("std","sys_exit",1);
 	private static var sys_time = cpp.Lib.load("std","sys_time",0);
 	private static var sys_cpu_time = cpp.Lib.load("std","sys_cpu_time",0);
 	private static var sys_exe_path = cpp.Lib.load("std","sys_exe_path",0);
@@ -151,4 +150,4 @@
 	private static var file_stderr = cpp.Lib.load("std","file_stderr",0);
 
 	private static var getch = cpp.Lib.load("std","sys_getch",1);
-}
+}

+ 7 - 0
std/cpp/_std/haxe/ds/IntMap.hx

@@ -35,6 +35,13 @@ package haxe.ds;
   inline void set(int key, double value) { __int_hash_set_float(h,key,value); }
   inline void set(int key, ::String value) { __int_hash_set_string(h,key,value); }
 
+  template<typename V, typename H>
+  inline void set(int key, const ::cpp::Struct<V,H> &value) {__int_hash_set(h,key,value); }
+  template<typename F>
+  inline void set(int key, const ::cpp::Function<F> &value) {__int_hash_set(h,key,value); }
+  template<typename V>
+  inline void set(int key, const ::cpp::Pointer<V> &value) {__int_hash_set(h,key,(Dynamic)value ); }
+
   template<typename VALUE>
   inline Void set(Dynamic &key, const VALUE &value) { set( (int)key, value ); return null(); }
 ")

+ 9 - 0
std/cpp/_std/haxe/ds/ObjectMap.hx

@@ -34,6 +34,15 @@ package haxe.ds;
   inline void set(Dynamic key, float value) { __object_hash_set_float(h,key,value); }
   inline void set(Dynamic key, double value) { __object_hash_set_float(h,key,value); }
   inline void set(Dynamic key, ::String value) { __object_hash_set_string(h,key,value); }
+
+
+  template<typename V, typename H>
+  inline void set(Dynamic key, const ::cpp::Struct<V,H> &value) {__object_hash_set(h,key,value); }
+  template<typename V>
+  inline void set(Dynamic key, const ::cpp::Function<V> &value) {__object_hash_set(h,key,(Dynamic)value ); }
+  template<typename V>
+  inline void set(Dynamic key, const ::cpp::Pointer<V> &value) {__object_hash_set(h,key,(Dynamic)value ); }
+
 ")
 @:coreApi
 class ObjectMap<K:{},V> implements haxe.Constraints.IMap<K,V> {

+ 7 - 0
std/cpp/_std/haxe/ds/StringMap.hx

@@ -35,6 +35,13 @@ package haxe.ds;
   inline void set(String key, double value) { __string_hash_set_float(h,key,value); }
   inline void set(String key, ::String value) { __string_hash_set_string(h,key,value); }
 
+  template<typename V, typename H>
+  inline void set(String key, const ::cpp::Struct<V,H> &value) {__string_hash_set(h,key,value); }
+  template<typename V>
+  inline void set(String key, const ::cpp::Function<V> &value) {__string_hash_set(h,key,(Dynamic)value ); }
+  template<typename V>
+  inline void set(String key, const ::cpp::Pointer<V> &value) {__string_hash_set(h,key,(Dynamic)value ); }
+
   template<typename VALUE>
   inline Void set(Dynamic &key, const VALUE &value) { set( (String)key, value ); return null(); }
 ")

+ 7 - 0
std/cpp/_std/haxe/ds/WeakMap.hx

@@ -34,6 +34,13 @@ package haxe.ds;
   inline void set(Dynamic key, float value) { __object_hash_set_float(h,key,value,true); }
   inline void set(Dynamic key, double value) { __object_hash_set_float(h,key,value,true); }
   inline void set(Dynamic key, ::String value) { __object_hash_set_string(h,key,value,true); }
+
+  template<typename V, typename H>
+  inline void set(Dynamic key, const ::cpp::Struct<V,H> &value) {__object_hash_set(h,key,value,true); }
+  template<typename V>
+  inline void set(Dynamic key, const ::cpp::Pointer<V> &value) {__object_hash_set(h,key,(Dynamic)value,true ); }
+  template<typename V>
+  inline void set(Dynamic key, const ::cpp::Function<V> &value) {__object_hash_set(h,key,(Dynamic)value,true ); }
 ")
 @:coreApi
 class WeakMap<K:{},V> implements haxe.Constraints.IMap<K,V> {

+ 17 - 0
std/cpp/link/StaticMysql.hx

@@ -0,0 +1,17 @@
+package cpp.link;
+
+@:cppFileCode( 'extern "C" int mysql_register_prims();')
+@:buildXml("
+<target id='haxe'>
+  <lib name='${HXCPP}/lib/${BINDIR}/libmysql5${LIBEXTRA}${LIBEXT}'/>
+  <lib name='ws2_32.lib' if='windows'/>
+</target>
+")
+@:keep class StaticMysql
+{
+   static function __init__()
+   {
+     untyped __cpp__("mysql_register_prims();");
+   }
+}
+

+ 16 - 0
std/cpp/link/StaticRegexp.hx

@@ -0,0 +1,16 @@
+package cpp.link;
+
+@:cppFileCode( 'extern "C" int regexp_register_prims();')
+@:buildXml("
+<target id='haxe'>
+  <lib name='${HXCPP}/lib/${BINDIR}/libregexp${LIBEXTRA}${LIBEXT}'/>
+</target>
+")
+@:keep class StaticRegexp
+{
+   static function __init__()
+   {
+     untyped __cpp__("regexp_register_prims();");
+   }
+}
+

+ 17 - 0
std/cpp/link/StaticSqlite.hx

@@ -0,0 +1,17 @@
+package cpp.link;
+
+@:cppFileCode( 'extern "C" int sqlite_register_prims();')
+@:buildXml("
+<target id='haxe'>
+  <lib name='${HXCPP}/lib/${BINDIR}/libsqlite${LIBEXTRA}${LIBEXT}'/>
+  <lib name='-lpthread' if='linux'/>
+</target>
+")
+@:keep class StaticSqlite
+{
+   static function __init__()
+   {
+     untyped __cpp__("sqlite_register_prims();");
+   }
+}
+

+ 17 - 0
std/cpp/link/StaticStd.hx

@@ -0,0 +1,17 @@
+package cpp.link;
+
+@:cppFileCode( 'extern "C" int std_register_prims();')
+@:buildXml("
+<target id='haxe'>
+  <lib name='${HXCPP}/lib/${BINDIR}/libstd${LIBEXTRA}${LIBEXT}'/>
+   <lib name='ws2_32.lib' if='windows'/>
+</target>
+")
+@:keep class StaticStd
+{
+   static function __init__()
+   {
+     untyped __cpp__("std_register_prims();");
+   }
+}
+

+ 16 - 0
std/cpp/link/StaticZlib.hx

@@ -0,0 +1,16 @@
+package cpp.link;
+
+@:cppFileCode( 'extern "C" int zlib_register_prims();')
+@:buildXml("
+<target id='haxe'>
+  <lib name='${HXCPP}/lib/${BINDIR}/libzlib${LIBEXTRA}${LIBEXT}'/>
+</target>
+")
+@:keep class StaticZlib
+{
+   static function __init__()
+   {
+     untyped __cpp__("zlib_register_prims();");
+   }
+}
+

+ 1 - 1
std/cpp/vm/Thread.hx

@@ -62,7 +62,7 @@ class Thread {
 		return untyped __global__.__hxcpp_thread_read_message(block);
 	}
 
-	function __compare(t) : Int {
+	@:keep function __compare(t) : Int {
 		return handle == t.handle ? 0 : 1;
 	}
 

+ 1 - 1
std/cs/Lib.hx

@@ -166,7 +166,7 @@ class Lib
 	/**
 		Allocates a new Haxe Array with a predetermined size
 	**/
-	public static function arrayAlloc<T>(size:Int):Array<T>
+	inline public static function arrayAlloc<T>(size:Int):Array<T>
 	{
 		return @:privateAccess Array.alloc(size);
 	}

+ 1 - 1
std/cs/Pointer.hx

@@ -43,7 +43,7 @@ import cs.StdTypes.Int64;
 #if !unsafe
 #error "You need to define 'unsafe' to be able to use unsafe code in hxcs"
 #else
-@:runtimeValue @:coreType abstract Pointer<T> from Int64
+@:runtimeValue @:coreType abstract Pointer<T> from Int64 from PointerAccess<T> to PointerAccess<T>
 {
 	@:op(A+B) public static function addIp<T>(lhs:Pointer<T>, rhs:Int):Pointer<T>;
 	@:op(A+B) public static function addp<T>(lhs:Pointer<T>, rhs:Int64):Pointer<T>;

+ 12 - 18
std/cs/_std/Math.hx

@@ -19,25 +19,19 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
-package;
-import cs.system.Random;
-
 @:coreApi @:nativeGen class Math
 {
-	public static inline function __init__():Void
-	{
-		PI = cs.system.Math.PI;
-		NaN = cs.system.Double.NaN;
-		NEGATIVE_INFINITY = cs.system.Double.NegativeInfinity;
-		POSITIVE_INFINITY = cs.system.Double.PositiveInfinity;
-		rand = new Random();
-	}
-
-	private static var rand:Random;
-	public static var PI(default, null) : Float;
-	public static var NaN(default,null) : Float;
-	public static var NEGATIVE_INFINITY(default,null) : Float;
-	public static var POSITIVE_INFINITY(default,null) : Float;
+	@:readOnly
+	private static var rand = new cs.system.Random();
+
+	@:readOnly
+	public static var PI(default,null) = cs.system.Math.PI;
+	@:readOnly
+	public static var NaN(default,null) = cs.system.Double.NaN;
+	@:readOnly
+	public static var NEGATIVE_INFINITY(default,null) = cs.system.Double.NegativeInfinity;
+	@:readOnly
+	public static var POSITIVE_INFINITY(default,null) = cs.system.Double.PositiveInfinity;
 
 	public static inline function abs(v:Float):Float
 	{
@@ -91,7 +85,7 @@ import cs.system.Random;
 
 	public static inline function fround(v:Float):Float
 	{
-		return cs.system.Math.Round(v);
+		return cs.system.Math.Floor(v + 0.5);
 	}
 
 	public static inline function ffloor(v:Float):Float

+ 15 - 16
std/cs/_std/Std.hx

@@ -81,7 +81,7 @@ import cs.internal.Exceptions;
 			}
 		}
 
-		var foundAny = false;
+		var foundAny = i != -1;
 		var isNeg = false;
 		while (++i < len)
 		{
@@ -134,7 +134,8 @@ import cs.internal.Exceptions;
 	public static function parseFloat( x : String ) : Float {
 		if (x == null) return Math.NaN;
 		x = StringTools.ltrim(x);
-		var found = false, isHex = false, hasDot = false, hasE = false, hasNeg = false, hasENeg = false;
+		var found = false, hasDot = false, hasSign = false,
+		    hasE = false, hasESign = false, hasEData = false;
 		var i = -1;
 		inline function getch(i:Int):Int return cast ((untyped x : cs.system.String)[i]);
 
@@ -143,32 +144,30 @@ import cs.internal.Exceptions;
 			var chr = getch(i);
 			if (chr >= '0'.code && chr <= '9'.code)
 			{
-				if ( !found && chr == '0'.code && (i+1) < x.length )
+				if (hasE)
 				{
-					var next = getch(i+1);
-					if (next == 'x'.code || next == 'X'.code)
-					{
-						isHex = true;
-						i++;
-					}
+					hasEData = true;
 				}
 				found = true;
 			} else switch (chr) {
-				case 'a'.code | 'b'.code | 'c'.code | 'd'.code | 'e'.code | 'f'.code
-				   | 'A'.code | 'B'.code | 'C'.code | 'D'.code | 'E'.code | 'F'.code if (isHex):
-					//do nothing - it's alright
 				case 'e'.code | 'E'.code if(!hasE):
 					hasE = true;
 				case '.'.code if (!hasDot):
 					hasDot = true;
-				case '-'.code if (!found && !hasNeg):
-					hasNeg = true;
-				case '-'.code if (found && !hasENeg && hasE):
-					hasENeg = true;
+				case '-'.code, '+'.code if (!found && !hasSign):
+					hasSign = true;
+				case '-'.code | '+'.code if (found && !hasESign && hasE && !hasEData):
+					hasESign = true;
 				case _:
 					break;
 			}
 		}
+		if (hasE && !hasEData)
+		{
+			i--;
+			if (hasESign)
+				i--;
+		}
 		if (i != x.length)
 		{
 			x = x.substr(0,i);

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

@@ -132,7 +132,7 @@ package cs.internal;
 				return fields[mid];
 			}
 		}
-		//if not found, it's definately an error
+		//if not found, it's definitely an error
 		throw "Field not found for hash " + key;
 	}
 

+ 1 - 1
std/cs/internal/Runtime.hx

@@ -487,7 +487,7 @@ import cs.system.Object;
 		if (methodLength == 0)
 			throw "Invalid calling parameters for method " + methods[0].Name;
 
-		var best = Math.POSITIVE_INFINITY;
+		var best = cs.system.Double.PositiveInfinity;
 		var bestMethod = 0;
 		for(i in 0...methodLength)
 		{

+ 1 - 0
std/haxe/CallStack.hx

@@ -40,6 +40,7 @@ class CallStack {
 	static var lastException:js.Error;
 
 	static function getStack(e:js.Error):Array<StackItem> {
+		if (e == null) return [];
 		// https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
 		var oldValue = (untyped Error).prepareStackTrace;
 		(untyped Error).prepareStackTrace = function (error, callsites :Array<Dynamic>) {

+ 4 - 0
std/haxe/Http.hx

@@ -383,8 +383,12 @@ class Http {
 				#elseif java
 				sock = new java.net.SslSocket();
 				#elseif hxssl
+				#if neko
 				sock = new neko.tls.Socket();
 				#else
+				sock = new sys.ssl.Socket();
+				#end
+				#else
 				throw "Https is only supported with -lib hxssl";
 				#end
 			} else

+ 1 - 1
std/haxe/Int32.hx

@@ -192,7 +192,7 @@ abstract Int32(Int) from Int to Int {
 		// we might be on 64-bit php, so sign extend from 32-bit
 		return (x << extraBits) >> extraBits;
 		#elseif python
-		return (x + python.Syntax.opPow(2, 31)) % python.Syntax.opPow(2, 32) - python.Syntax.opPow(2, 31);
+		return python.Syntax.pythonCode("{0} % {1}", (x + python.Syntax.opPow(2, 31)), python.Syntax.opPow(2, 32)) - python.Syntax.opPow(2, 31);
 		#else
 		return (x);
 		#end

+ 1 - 1
std/haxe/Template.hx

@@ -47,7 +47,7 @@ private typedef ExprToken = {
 	String, and to have some basic logic.
 
 	A complete documentation of the supported syntax is available at:
-	http://haxe.org/doc/cross/template
+	<a href="http://haxe.org/manual/std-template.html">http://haxe.org/manual/std-template.html</a>
 **/
 class Template {
 

+ 3 - 0
std/haxe/crypto/Adler32.hx

@@ -21,6 +21,9 @@
  */
 package haxe.crypto;
 
+/**
+    Calculates the Adler32 of the given Bytes.
+*/
 class Adler32 {
 
 	var a1 : Int;

+ 4 - 4
std/haxe/crypto/BaseCode.hx

@@ -42,7 +42,7 @@ class BaseCode {
 	}
 
 	public function encodeBytes( b : haxe.io.Bytes ) : haxe.io.Bytes {
-		#if neko
+		#if (neko && !interp)
 		return haxe.io.Bytes.ofData( base_encode(b.getData(),base.getData()) );
 		#else
 		var nbits = this.nbits;
@@ -79,7 +79,7 @@ class BaseCode {
 	}
 
 	public function decodeBytes( b : haxe.io.Bytes ) : haxe.io.Bytes {
-		#if neko
+		#if (neko && !interp)
 		return haxe.io.Bytes.ofData( base_decode(b.getData(),base.getData()) );
 		#else
 		var nbits = this.nbits;
@@ -109,7 +109,7 @@ class BaseCode {
 	}
 
 	public function encodeString( s : String ) {
-		#if neko
+		#if (neko && !interp)
 		return neko.NativeString.toString( base_encode(neko.NativeString.ofString(s),base.getData()) );
 		#else
 		return encodeBytes(haxe.io.Bytes.ofString(s)).toString();
@@ -117,7 +117,7 @@ class BaseCode {
 	}
 
 	public function decodeString( s : String ) {
-		#if neko
+		#if (neko && !interp)
 		return neko.NativeString.toString( base_decode(neko.NativeString.ofString(s),base.getData()) );
 		#else
 		return decodeBytes(haxe.io.Bytes.ofString(s)).toString();

+ 4 - 1
std/haxe/crypto/Crc32.hx

@@ -21,6 +21,9 @@
  */
 package haxe.crypto;
 
+/**
+    Calculates the Crc32 of the given Bytes.
+*/
 class Crc32 {
 
 	var crc : Int;
@@ -78,4 +81,4 @@ class Crc32 {
 		return crc ^ init;
 	}
 
-}
+}

+ 7 - 1
std/haxe/crypto/Hmac.hx

@@ -21,12 +21,18 @@
  */
 package haxe.crypto;
 
+/**
+    Hash methods for Hmac calculation.
+*/
 enum HashMethod {
 	MD5;
 	SHA1;
 	SHA256;
 }
 
+/**
+    Calculates a Hmac of the given Bytes using a HashMethod.
+*/
 class Hmac {
 	
 	var method : HashMethod;
@@ -82,4 +88,4 @@ class Hmac {
 		return doHash(Ko.getBytes());
 	}
 	
-}
+}

+ 3 - 0
std/haxe/crypto/Sha1.hx

@@ -21,6 +21,9 @@
  */
 package haxe.crypto;
 
+/**
+    Creates a Sha1 of a String.
+*/
 class Sha1 {
 
 	public static function encode( s:String ) : String {

+ 3 - 0
std/haxe/crypto/Sha224.hx

@@ -21,6 +21,9 @@
  */
 package haxe.crypto;
 
+/**
+    Creates a Sha224 of a String.
+*/
 class Sha224 {
     
     public static function encode( s:String ) : String {

+ 3 - 0
std/haxe/crypto/Sha256.hx

@@ -21,6 +21,9 @@
  */
 package haxe.crypto;
 
+/**
+    Creates a Sha256 of a String.
+*/
 class Sha256 {
 	
 	public static function encode( s:String ) : String {

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

@@ -205,7 +205,7 @@ abstract Vector<T>(VectorData<T>) {
 	static public inline function fromArrayCopy<T>(array:Array<T>):Vector<T> {
 		#if python
 		return cast array.copy();
-		#elseif flash
+		#elseif flash10
 		return fromData(flash.Vector.ofArray(array));
 		#elseif java
 		return fromData(java.Lib.nativeArray(array,false));

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

@@ -102,7 +102,7 @@ class Compiler {
 
 		In order to include single modules, their paths can be listed directly
 		on command line: `haxe ... ModuleName pack.ModuleName`.
-		
+
 		By default `Compiler.include` will search for modules in the directories defined with `-cp`.
 		If you want to specify a different set of paths to search for modules, you can use the optional
 		argument `classPath`.
@@ -110,7 +110,7 @@ class Compiler {
 		@param rec If true, recursively adds all sub-packages.
 		@param ignore Array of module names to ignore for inclusion.
 		@param classPaths An alternative array of paths (directory names) to use to search for modules to include.
-		       Note that if you pass this argument, only the specified paths will be used for inclusion.  
+		       Note that if you pass this argument, only the specified paths will be used for inclusion.
 	**/
 	public static function include( pack : String, ?rec = true, ?ignore : Array<String>, ?classPaths : Array<String> ) {
 		var skip = if( ignore == null ) {
@@ -269,8 +269,7 @@ class Compiler {
 	}
 
 	/**
-		Marks types or packages to be kept by DCE and includes them for
-		compilation.
+		Marks types or packages to be kept by DCE.
 
 		This also extends to the sub-types of resolved modules.
 

+ 6 - 2
std/haxe/macro/Type.hx

@@ -21,6 +21,10 @@
  */
 package haxe.macro;
 
+/*
+    Warning: Some of these types correspond to compiler-internal data structures
+    and might change in minor Haxe releases in order to adapt to internal changes.
+*/
 typedef Ref<T> = {
 	public function get() : T;
 	public function toString() : String;
@@ -300,11 +304,11 @@ typedef TFunc = {
 }
 
 enum FieldAccess {
-	FInstance(c:Ref<ClassType>, cf:Ref<ClassField>);
+	FInstance(c:Ref<ClassType>, params:Array<Type>, cf:Ref<ClassField>);
 	FStatic(c:Ref<ClassType>, cf:Ref<ClassField>);
 	FAnon(cf:Ref<ClassField>);
 	FDynamic(s:String);
-	FClosure(c:Null<Ref<ClassType>>, cf:Ref<ClassField>);
+	FClosure(c:Null<{c:Ref<ClassType>, params:Array<Type>}>, cf:Ref<ClassField>);
 	FEnum(e:Ref<EnumType>, ef:EnumField);
 }
 

+ 2 - 4
std/haxe/macro/TypedExprTools.hx

@@ -22,12 +22,9 @@
 
 package haxe.macro;
 
-import haxe.macro.Context;
 import haxe.macro.Type;
 
 class TypedExprTools {
-	#if macro
-
 	static function with(e:TypedExpr, ?edef:TypedExprDef, ?t:Type) {
 		return {
 			expr: edef == null ? e.expr : edef,
@@ -152,8 +149,9 @@ class TypedExprTools {
 		}
 	}
 
+	#if macro
 	static public function toString(t:TypedExpr, ?pretty = false):String {
-		return new String(Context.load("s_expr", 2)(t, pretty));
+		return new String(haxe.macro.Context.load("s_expr", 2)(t, pretty));
 	}
 	#end
 }

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

@@ -82,6 +82,10 @@ class Parser
 		// need extra state because next is in use
 		var escapeNext = S.BEGIN;
 		var attrValQuote = -1;
+		inline function addChild(xml:Xml) {
+			parent.addChild(xml);
+			nsubs++;
+		}
 		while (!StringTools.isEof(c))
 		{
 			switch(state)
@@ -115,8 +119,7 @@ class Parser
 						buf.addSub(str, start, p - start);
 						var child = Xml.createPCData(buf.toString());
 						buf = new StringBuf();
-						parent.addChild(child);
-						nsubs++;
+						addChild(child);
 						state = S.IGNORE_SPACES;
 						next = S.BEGIN_NODE;
 					} else if (c == '&'.code) {
@@ -129,8 +132,7 @@ class Parser
 					if (c == ']'.code && str.fastCodeAt(p + 1) == ']'.code && str.fastCodeAt(p + 2) == '>'.code)
 					{
 						var child = Xml.createCData(str.substr(start, p - start));
-						parent.addChild(child);
-						nsubs++;
+						addChild(child);
 						p += 2;
 						state = S.BEGIN;
 					}
@@ -183,7 +185,7 @@ class Parser
 						if( p == start )
 							throw("Expected node name");
 						xml = Xml.createElement(str.substr(start, p - start));
-						parent.addChild(xml);
+						addChild(xml);
 						state = S.IGNORE_SPACES;
 						next = S.BODY;
 						continue;
@@ -193,10 +195,8 @@ class Parser
 					{
 						case '/'.code:
 							state = S.WAIT_END;
-							nsubs++;
 						case '>'.code:
 							state = S.CHILDS;
-							nsubs++;
 						default:
 							state = S.ATTRIB_NAME;
 							start = p;
@@ -293,7 +293,7 @@ class Parser
 				case S.COMMENT:
 					if (c == '-'.code && str.fastCodeAt(p +1) == '-'.code && str.fastCodeAt(p + 2) == '>'.code)
 					{
-						parent.addChild(Xml.createComment(str.substr(start, p - start)));
+						addChild(Xml.createComment(str.substr(start, p - start)));
 						p += 2;
 						state = S.BEGIN;
 					}
@@ -304,7 +304,7 @@ class Parser
 						nbrackets--;
 					else if (c == '>'.code && nbrackets == 0)
 					{
-						parent.addChild(Xml.createDocType(str.substr(start, p - start)));
+						addChild(Xml.createDocType(str.substr(start, p - start)));
 						state = S.BEGIN;
 					}
 				case S.HEADER:
@@ -312,7 +312,7 @@ class Parser
 					{
 						p++;
 						var str = str.substr(start + 1, p - start - 2);
-						parent.addChild(Xml.createProcessingInstruction(str));
+						addChild(Xml.createProcessingInstruction(str));
 						state = S.BEGIN;
 					}
 				case S.ESCAPE:
@@ -358,7 +358,7 @@ class Parser
 						buf.addChar("&".code);
 						buf.addSub(str, start, p - start);
 						p--;
-						start = p;
+						start = p + 1;
 						state = escapeNext;
 					}
 			}
@@ -375,7 +375,7 @@ class Parser
 		{
 			if (p != start || nsubs == 0) {
 				buf.addSub(str, start, p-start);
-				parent.addChild(Xml.createPCData(buf.toString()));
+				addChild(Xml.createPCData(buf.toString()));
 			}
 			return p;
 		}
@@ -383,7 +383,7 @@ class Parser
 		if( !strict && state == S.ESCAPE && escapeNext == S.PCDATA ) {
 			buf.addChar("&".code);
 			buf.addSub(str, start, p - start);
-			parent.addChild(Xml.createPCData(buf.toString()));
+			addChild(Xml.createPCData(buf.toString()));
 			return p;
 		}
 

+ 3 - 1
std/java/_std/Math.hx

@@ -42,7 +42,9 @@
 	static function floor(v:Float):Int;
 	static function ceil(v:Float):Int;
 	static function atan(v:Float):Float;
-	static function fround(v:Float):Float;
+	inline static function fround(v:Float):Float {
+		return ffloor(v + 0.5);
+	}
 	static function ffloor(v:Float):Float;
 	static function fceil(v:Float):Float;
 	static function asin(v:Float):Float;

+ 16 - 16
std/java/_std/Std.hx

@@ -79,7 +79,7 @@ import java.internal.Exceptions;
 			}
 		}
 
-		boolean foundAny = false;
+		boolean foundAny = i != 0;
 		boolean isNeg = false;
 		for (; i < len; i++)
 		{
@@ -138,7 +138,8 @@ import java.internal.Exceptions;
 	public static function parseFloat( x : String ) : Float {
 		if (x == null) return Math.NaN;
 		x = StringTools.ltrim(x);
-		var found = false, isHex = false, hasDot = false, hasE = false, hasNeg = false, hasENeg = false;
+		var found = false, hasDot = false, hasSign = false,
+		    hasE = false, hasESign = false, hasEData = false;
 		var i = -1;
 		inline function getch(i:Int):Int return cast (untyped x._charAt(i) : java.StdTypes.Char16);
 
@@ -147,32 +148,31 @@ import java.internal.Exceptions;
 			var chr = getch(i);
 			if (chr >= '0'.code && chr <= '9'.code)
 			{
-				if ( !found && chr == '0'.code && (i+1) < x.length )
+				if (hasE)
 				{
-					var next = getch(i+1);
-					if (next == 'x'.code || next == 'X'.code)
-					{
-						isHex = true;
-						i++;
-					}
+					hasEData = true;
 				}
 				found = true;
 			} else switch (chr) {
-				case 'a'.code | 'b'.code | 'c'.code | 'd'.code | 'e'.code | 'f'.code
-				   | 'A'.code | 'B'.code | 'C'.code | 'D'.code | 'E'.code | 'F'.code if (isHex):
-					//do nothing - it's alright
 				case 'e'.code | 'E'.code if(!hasE):
 					hasE = true;
 				case '.'.code if (!hasDot):
 					hasDot = true;
-				case '-'.code if (!found && !hasNeg):
-					hasNeg = true;
-				case '-'.code if (found && !hasENeg && hasE):
-					hasENeg = true;
+				case '-'.code, '+'.code if (!found && !hasSign):
+					hasSign = true;
+				case '-'.code | '+'.code if (found && !hasESign && hasE && !hasEData):
+					hasESign = true;
 				case _:
 					break;
 			}
 		}
+		if (hasE && !hasEData)
+		{
+			i--;
+			if (hasESign)
+				i--;
+		}
+
 		if (i != x.length)
 		{
 			x = x.substr(0,i);

+ 16 - 0
std/java/lang/Boolean.hx

@@ -1,11 +1,27 @@
 package java.lang;
 
+@:native("") // make sure the generator won't see this
 @:forward abstract Boolean(BooleanClass) from BooleanClass to BooleanClass
 {
 	@:to @:extern inline public function toBool():Bool
 		return this.booleanValue();
 	@:from @:extern inline public static function fromBool(b:Bool):Boolean
 		return BooleanClass.valueOf(b);
+
+	public static var FALSE(get,set):Boolean;
+	@:extern static inline function get_FALSE():Boolean return BooleanClass.FALSE;
+	@:extern static inline function set_FALSE(val:Boolean):Boolean return BooleanClass.FALSE = val;
+	public static var TRUE(get,set):Boolean;
+	@:extern static inline function get_TRUE():Boolean return BooleanClass.TRUE;
+	@:extern static inline function set_TRUE(val:Boolean):Boolean return BooleanClass.TRUE = val;
+	public static var TYPE(get,set):Class<java.lang.Boolean>;
+	@:extern static inline function get_TYPE():Class<java.lang.Boolean> return BooleanClass.TYPE;
+	@:extern static inline function set_TYPE(val:Class<java.lang.Boolean>):Class<java.lang.Boolean> return BooleanClass.TYPE = val;
+	@:extern @:overload inline public static function compare(param1:Bool, param2:Bool):Int return BooleanClass.compare(param1, param2);
+	@:extern @:overload inline public static function getBoolean(param1:String):Bool return BooleanClass.getBoolean(param1);
+	@:extern @:overload inline public static function parseBoolean(param1:String):Bool return BooleanClass.parseBoolean(param1);
+	@:extern @:overload inline public static function _toString(param1:Bool):String return BooleanClass._toString(param1);
+	@:extern @:overload inline public static function valueOf(param1:Bool):Boolean return BooleanClass.valueOf(param1);
 }
 
 @:native("java.lang.Boolean") extern class BooleanClass extends Number implements Comparable<Boolean>

+ 16 - 0
std/java/lang/Byte.hx

@@ -1,11 +1,27 @@
 package java.lang;
 
+@:native("") // make sure the generator won't see this
 @:forward abstract Byte(ByteClass) from ByteClass to ByteClass
 {
 	@:to @:extern inline public function toByte():java.types.Int8
 		return this.byteValue();
 	@:from @:extern inline public static function fromByte(b:java.types.Int8):Byte
 		return ByteClass.valueOf(b);
+
+	public static var MAX_VALUE(get,never):java.types.Int8;
+	@:extern static inline function get_MAX_VALUE():java.types.Int8 return ByteClass.MAX_VALUE;
+	public static var MIN_VALUE(get,never):java.types.Int8;
+	@:extern static inline function get_MIN_VALUE():java.types.Int8 return ByteClass.MIN_VALUE;
+	public static var SIZE(get,never):Int;
+	@:extern static inline function get_SIZE():Int return ByteClass.SIZE;
+	public static var TYPE(get,set):Class<java.lang.Byte>;
+	@:extern static inline function get_TYPE():Class<java.lang.Byte> return ByteClass.TYPE;
+	@:extern static inline function set_TYPE(val:Class<java.lang.Byte>):Class<java.lang.Byte> return ByteClass.TYPE = val;
+	@:extern @:overload inline public static function compare(param1:java.types.Int8, param2:java.types.Int8):Int return ByteClass.compare(param1, param2);
+	@:extern @:overload inline public static function decode(param1:String):Byte return ByteClass.decode(param1);
+	@:extern @:overload inline public static function parseByte(param1:String, param2:Int):java.types.Int8 return ByteClass.parseByte(param1, param2);
+	@:extern @:overload inline public static function _toString(param1:java.types.Int8):String return ByteClass._toString(param1);
+	@:extern @:overload inline public static function valueOf(param1:java.types.Int8):Byte return ByteClass.valueOf(param1);
 }
 
 @:native("java.lang.Byte") extern class ByteClass extends Number implements Comparable<Byte>

+ 183 - 0
std/java/lang/Character.hx

@@ -1,11 +1,194 @@
 package java.lang;
 
+@:native("") // make sure the generator won't see this
 @:forward abstract Character(CharacterClass) from CharacterClass to CharacterClass
 {
 	@:to @:extern inline public function toCharacter():java.types.Char16
 		return this.charValue();
 	@:from @:extern inline public static function fromCharacter(b:java.types.Char16):Character
 		return CharacterClass.valueOf(b);
+
+	public static var COMBINING_SPACING_MARK(get,never):java.types.Char16;
+	@:extern static inline function get_COMBINING_SPACING_MARK():java.types.Char16 return CharacterClass.COMBINING_SPACING_MARK;
+	public static var CONNECTOR_PUNCTUATION(get,never):java.types.Char16;
+	@:extern static inline function get_CONNECTOR_PUNCTUATION():java.types.Char16 return CharacterClass.CONNECTOR_PUNCTUATION;
+	public static var CONTROL(get,never):java.types.Char16;
+	@:extern static inline function get_CONTROL():java.types.Char16 return CharacterClass.CONTROL;
+	public static var CURRENCY_SYMBOL(get,never):java.types.Char16;
+	@:extern static inline function get_CURRENCY_SYMBOL():java.types.Char16 return CharacterClass.CURRENCY_SYMBOL;
+	public static var DASH_PUNCTUATION(get,never):java.types.Char16;
+	@:extern static inline function get_DASH_PUNCTUATION():java.types.Char16 return CharacterClass.DASH_PUNCTUATION;
+	public static var DECIMAL_DIGIT_NUMBER(get,never):java.types.Char16;
+	@:extern static inline function get_DECIMAL_DIGIT_NUMBER():java.types.Char16 return CharacterClass.DECIMAL_DIGIT_NUMBER;
+	public static var DIRECTIONALITY_ARABIC_NUMBER(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_ARABIC_NUMBER():java.types.Char16 return CharacterClass.DIRECTIONALITY_ARABIC_NUMBER;
+	public static var DIRECTIONALITY_BOUNDARY_NEUTRAL(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_BOUNDARY_NEUTRAL():java.types.Char16 return CharacterClass.DIRECTIONALITY_BOUNDARY_NEUTRAL;
+	public static var DIRECTIONALITY_COMMON_NUMBER_SEPARATOR(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_COMMON_NUMBER_SEPARATOR():java.types.Char16 return CharacterClass.DIRECTIONALITY_COMMON_NUMBER_SEPARATOR;
+	public static var DIRECTIONALITY_EUROPEAN_NUMBER(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_EUROPEAN_NUMBER():java.types.Char16 return CharacterClass.DIRECTIONALITY_EUROPEAN_NUMBER;
+	public static var DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR():java.types.Char16 return CharacterClass.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR;
+	public static var DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR():java.types.Char16 return CharacterClass.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR;
+	public static var DIRECTIONALITY_LEFT_TO_RIGHT(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_LEFT_TO_RIGHT():java.types.Char16 return CharacterClass.DIRECTIONALITY_LEFT_TO_RIGHT;
+	public static var DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING():java.types.Char16 return CharacterClass.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING;
+	public static var DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE():java.types.Char16 return CharacterClass.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE;
+	public static var DIRECTIONALITY_NONSPACING_MARK(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_NONSPACING_MARK():java.types.Char16 return CharacterClass.DIRECTIONALITY_NONSPACING_MARK;
+	public static var DIRECTIONALITY_OTHER_NEUTRALS(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_OTHER_NEUTRALS():java.types.Char16 return CharacterClass.DIRECTIONALITY_OTHER_NEUTRALS;
+	public static var DIRECTIONALITY_PARAGRAPH_SEPARATOR(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_PARAGRAPH_SEPARATOR():java.types.Char16 return CharacterClass.DIRECTIONALITY_PARAGRAPH_SEPARATOR;
+	public static var DIRECTIONALITY_POP_DIRECTIONAL_FORMAT(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_POP_DIRECTIONAL_FORMAT():java.types.Char16 return CharacterClass.DIRECTIONALITY_POP_DIRECTIONAL_FORMAT;
+	public static var DIRECTIONALITY_RIGHT_TO_LEFT(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_RIGHT_TO_LEFT():java.types.Char16 return CharacterClass.DIRECTIONALITY_RIGHT_TO_LEFT;
+	public static var DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC():java.types.Char16 return CharacterClass.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
+	public static var DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING():java.types.Char16 return CharacterClass.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING;
+	public static var DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE():java.types.Char16 return CharacterClass.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE;
+	public static var DIRECTIONALITY_SEGMENT_SEPARATOR(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_SEGMENT_SEPARATOR():java.types.Char16 return CharacterClass.DIRECTIONALITY_SEGMENT_SEPARATOR;
+	public static var DIRECTIONALITY_UNDEFINED(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_UNDEFINED():java.types.Char16 return CharacterClass.DIRECTIONALITY_UNDEFINED;
+	public static var DIRECTIONALITY_WHITESPACE(get,never):java.types.Char16;
+	@:extern static inline function get_DIRECTIONALITY_WHITESPACE():java.types.Char16 return CharacterClass.DIRECTIONALITY_WHITESPACE;
+	public static var ENCLOSING_MARK(get,never):java.types.Char16;
+	@:extern static inline function get_ENCLOSING_MARK():java.types.Char16 return CharacterClass.ENCLOSING_MARK;
+	public static var END_PUNCTUATION(get,never):java.types.Char16;
+	@:extern static inline function get_END_PUNCTUATION():java.types.Char16 return CharacterClass.END_PUNCTUATION;
+	public static var FINAL_QUOTE_PUNCTUATION(get,never):java.types.Char16;
+	@:extern static inline function get_FINAL_QUOTE_PUNCTUATION():java.types.Char16 return CharacterClass.FINAL_QUOTE_PUNCTUATION;
+	public static var FORMAT(get,never):java.types.Char16;
+	@:extern static inline function get_FORMAT():java.types.Char16 return CharacterClass.FORMAT;
+	public static var INITIAL_QUOTE_PUNCTUATION(get,never):java.types.Char16;
+	@:extern static inline function get_INITIAL_QUOTE_PUNCTUATION():java.types.Char16 return CharacterClass.INITIAL_QUOTE_PUNCTUATION;
+	public static var LETTER_NUMBER(get,never):java.types.Char16;
+	@:extern static inline function get_LETTER_NUMBER():java.types.Char16 return CharacterClass.LETTER_NUMBER;
+	public static var LINE_SEPARATOR(get,never):java.types.Char16;
+	@:extern static inline function get_LINE_SEPARATOR():java.types.Char16 return CharacterClass.LINE_SEPARATOR;
+	public static var LOWERCASE_LETTER(get,never):java.types.Char16;
+	@:extern static inline function get_LOWERCASE_LETTER():java.types.Char16 return CharacterClass.LOWERCASE_LETTER;
+	public static var MATH_SYMBOL(get,never):java.types.Char16;
+	@:extern static inline function get_MATH_SYMBOL():java.types.Char16 return CharacterClass.MATH_SYMBOL;
+	public static var MAX_CODE_POINT(get,never):Int;
+	@:extern static inline function get_MAX_CODE_POINT():Int return CharacterClass.MAX_CODE_POINT;
+	public static var MAX_HIGH_SURROGATE(get,never):java.types.Char16;
+	@:extern static inline function get_MAX_HIGH_SURROGATE():java.types.Char16 return CharacterClass.MAX_HIGH_SURROGATE;
+	public static var MAX_LOW_SURROGATE(get,never):java.types.Char16;
+	@:extern static inline function get_MAX_LOW_SURROGATE():java.types.Char16 return CharacterClass.MAX_LOW_SURROGATE;
+	public static var MAX_RADIX(get,never):Int;
+	@:extern static inline function get_MAX_RADIX():Int return CharacterClass.MAX_RADIX;
+	public static var MAX_SURROGATE(get,never):java.types.Char16;
+	@:extern static inline function get_MAX_SURROGATE():java.types.Char16 return CharacterClass.MAX_SURROGATE;
+	public static var MAX_VALUE(get,never):java.types.Char16;
+	@:extern static inline function get_MAX_VALUE():java.types.Char16 return CharacterClass.MAX_VALUE;
+	public static var MIN_CODE_POINT(get,never):Int;
+	@:extern static inline function get_MIN_CODE_POINT():Int return CharacterClass.MIN_CODE_POINT;
+	public static var MIN_HIGH_SURROGATE(get,never):java.types.Char16;
+	@:extern static inline function get_MIN_HIGH_SURROGATE():java.types.Char16 return CharacterClass.MIN_HIGH_SURROGATE;
+	public static var MIN_LOW_SURROGATE(get,never):java.types.Char16;
+	@:extern static inline function get_MIN_LOW_SURROGATE():java.types.Char16 return CharacterClass.MIN_LOW_SURROGATE;
+	public static var MIN_RADIX(get,never):Int;
+	@:extern static inline function get_MIN_RADIX():Int return CharacterClass.MIN_RADIX;
+	public static var MIN_SUPPLEMENTARY_CODE_POINT(get,never):Int;
+	@:extern static inline function get_MIN_SUPPLEMENTARY_CODE_POINT():Int return CharacterClass.MIN_SUPPLEMENTARY_CODE_POINT;
+	public static var MIN_SURROGATE(get,never):java.types.Char16;
+	@:extern static inline function get_MIN_SURROGATE():java.types.Char16 return CharacterClass.MIN_SURROGATE;
+	public static var MIN_VALUE(get,never):java.types.Char16;
+	@:extern static inline function get_MIN_VALUE():java.types.Char16 return CharacterClass.MIN_VALUE;
+	public static var MODIFIER_LETTER(get,never):java.types.Char16;
+	@:extern static inline function get_MODIFIER_LETTER():java.types.Char16 return CharacterClass.MODIFIER_LETTER;
+	public static var MODIFIER_SYMBOL(get,never):java.types.Char16;
+	@:extern static inline function get_MODIFIER_SYMBOL():java.types.Char16 return CharacterClass.MODIFIER_SYMBOL;
+	public static var NON_SPACING_MARK(get,never):java.types.Char16;
+	@:extern static inline function get_NON_SPACING_MARK():java.types.Char16 return CharacterClass.NON_SPACING_MARK;
+	public static var OTHER_LETTER(get,never):java.types.Char16;
+	@:extern static inline function get_OTHER_LETTER():java.types.Char16 return CharacterClass.OTHER_LETTER;
+	public static var OTHER_NUMBER(get,never):java.types.Char16;
+	@:extern static inline function get_OTHER_NUMBER():java.types.Char16 return CharacterClass.OTHER_NUMBER;
+	public static var OTHER_PUNCTUATION(get,never):java.types.Char16;
+	@:extern static inline function get_OTHER_PUNCTUATION():java.types.Char16 return CharacterClass.OTHER_PUNCTUATION;
+	public static var OTHER_SYMBOL(get,never):java.types.Char16;
+	@:extern static inline function get_OTHER_SYMBOL():java.types.Char16 return CharacterClass.OTHER_SYMBOL;
+	public static var PARAGRAPH_SEPARATOR(get,never):java.types.Char16;
+	@:extern static inline function get_PARAGRAPH_SEPARATOR():java.types.Char16 return CharacterClass.PARAGRAPH_SEPARATOR;
+	public static var PRIVATE_USE(get,never):java.types.Char16;
+	@:extern static inline function get_PRIVATE_USE():java.types.Char16 return CharacterClass.PRIVATE_USE;
+	public static var SIZE(get,never):Int;
+	@:extern static inline function get_SIZE():Int return CharacterClass.SIZE;
+	public static var SPACE_SEPARATOR(get,never):java.types.Char16;
+	@:extern static inline function get_SPACE_SEPARATOR():java.types.Char16 return CharacterClass.SPACE_SEPARATOR;
+	public static var START_PUNCTUATION(get,never):java.types.Char16;
+	@:extern static inline function get_START_PUNCTUATION():java.types.Char16 return CharacterClass.START_PUNCTUATION;
+	public static var SURROGATE(get,never):java.types.Char16;
+	@:extern static inline function get_SURROGATE():java.types.Char16 return CharacterClass.SURROGATE;
+	public static var TITLECASE_LETTER(get,never):java.types.Char16;
+	@:extern static inline function get_TITLECASE_LETTER():java.types.Char16 return CharacterClass.TITLECASE_LETTER;
+	public static var TYPE(get,set):Class<java.lang.Character>;
+	@:extern static inline function get_TYPE():Class<java.lang.Character> return CharacterClass.TYPE;
+	@:extern static inline function set_TYPE(val:Class<java.lang.Character>):Class<java.lang.Character> return CharacterClass.TYPE = val;
+	public static var UNASSIGNED(get,never):java.types.Char16;
+	@:extern static inline function get_UNASSIGNED():java.types.Char16 return CharacterClass.UNASSIGNED;
+	public static var UPPERCASE_LETTER(get,never):java.types.Char16;
+	@:extern static inline function get_UPPERCASE_LETTER():java.types.Char16 return CharacterClass.UPPERCASE_LETTER;
+	@:extern @:overload inline public static function charCount(param1:Int):Int return CharacterClass.charCount(param1);
+	@:extern @:overload inline public static function codePointAt(param1:CharSequence, param2:Int):Int return CharacterClass.codePointAt(param1, param2);
+	@:extern @:overload inline public static function codePointBefore(param1:CharSequence, param2:Int):Int return CharacterClass.codePointBefore(param1, param2);
+	@:extern @:overload inline public static function codePointCount(param1:CharSequence, param2:Int, param3:Int):Int return CharacterClass.codePointCount(param1, param2, param3);
+	@:extern @:overload inline public static function compare(param1:java.types.Char16, param2:java.types.Char16):Int return CharacterClass.compare(param1, param2);
+	@:extern @:overload inline public static function digit(param1:java.types.Char16, param2:Int):Int return CharacterClass.digit(param1, param2);
+	@:extern @:overload inline public static function forDigit(param1:Int, param2:Int):java.types.Char16 return CharacterClass.forDigit(param1, param2);
+	@:extern @:overload inline public static function getDirectionality(param1:java.types.Char16):java.types.Char16 return CharacterClass.getDirectionality(param1);
+	@:extern @:overload inline public static function getName(param1:Int):String return CharacterClass.getName(param1);
+	@:extern @:overload inline public static function getNumericValue(param1:java.types.Char16):Int return CharacterClass.getNumericValue(param1);
+	@:extern @:overload inline public static function getType(param1:java.types.Char16):Int return CharacterClass.getType(param1);
+	@:extern @:overload inline public static function highSurrogate(param1:Int):java.types.Char16 return CharacterClass.highSurrogate(param1);
+	@:extern @:overload inline public static function isAlphabetic(param1:Int):Bool return CharacterClass.isAlphabetic(param1);
+	@:extern @:overload inline public static function isBmpCodePoint(param1:Int):Bool return CharacterClass.isBmpCodePoint(param1);
+	@:extern @:overload inline public static function isDefined(param1:java.types.Char16):Bool return CharacterClass.isDefined(param1);
+	@:extern @:overload inline public static function isDigit(param1:java.types.Char16):Bool return CharacterClass.isDigit(param1);
+	@:extern @:overload inline public static function isHighSurrogate(param1:java.types.Char16):Bool return CharacterClass.isHighSurrogate(param1);
+	@:extern @:overload inline public static function isISOControl(param1:java.types.Char16):Bool return CharacterClass.isISOControl(param1);
+	@:extern @:overload inline public static function isIdentifierIgnorable(param1:java.types.Char16):Bool return CharacterClass.isIdentifierIgnorable(param1);
+	@:extern @:overload inline public static function isIdeographic(param1:Int):Bool return CharacterClass.isIdeographic(param1);
+	@:extern @:overload inline public static function isJavaIdentifierPart(param1:java.types.Char16):Bool return CharacterClass.isJavaIdentifierPart(param1);
+	@:extern @:overload inline public static function isJavaIdentifierStart(param1:java.types.Char16):Bool return CharacterClass.isJavaIdentifierStart(param1);
+
+
+	@:extern @:overload inline public static function isLetter(param1:java.types.Char16):Bool return CharacterClass.isLetter(param1);
+	@:extern @:overload inline public static function isLetterOrDigit(param1:java.types.Char16):Bool return CharacterClass.isLetterOrDigit(param1);
+	@:extern @:overload inline public static function isLowSurrogate(param1:java.types.Char16):Bool return CharacterClass.isLowSurrogate(param1);
+	@:extern @:overload inline public static function isLowerCase(param1:java.types.Char16):Bool return CharacterClass.isLowerCase(param1);
+	@:extern @:overload inline public static function isMirrored(param1:java.types.Char16):Bool return CharacterClass.isMirrored(param1);
+
+	@:extern @:overload inline public static function isSpaceChar(param1:java.types.Char16):Bool return CharacterClass.isSpaceChar(param1);
+	@:extern @:overload inline public static function isSupplementaryCodePoint(param1:Int):Bool return CharacterClass.isSupplementaryCodePoint(param1);
+	@:extern @:overload inline public static function isSurrogate(param1:java.types.Char16):Bool return CharacterClass.isSurrogate(param1);
+	@:extern @:overload inline public static function isSurrogatePair(param1:java.types.Char16, param2:java.types.Char16):Bool return CharacterClass.isSurrogatePair(param1, param2);
+	@:extern @:overload inline public static function isTitleCase(param1:java.types.Char16):Bool return CharacterClass.isTitleCase(param1);
+	@:extern @:overload inline public static function isUnicodeIdentifierPart(param1:java.types.Char16):Bool return CharacterClass.isUnicodeIdentifierPart(param1);
+	@:extern @:overload inline public static function isUnicodeIdentifierStart(param1:java.types.Char16):Bool return CharacterClass.isUnicodeIdentifierStart(param1);
+	@:extern @:overload inline public static function isUpperCase(param1:java.types.Char16):Bool return CharacterClass.isUpperCase(param1);
+	@:extern @:overload inline public static function isValidCodePoint(param1:Int):Bool return CharacterClass.isValidCodePoint(param1);
+	@:extern @:overload inline public static function isWhitespace(param1:java.types.Char16):Bool return CharacterClass.isWhitespace(param1);
+	@:extern @:overload inline public static function lowSurrogate(param1:Int):java.types.Char16 return CharacterClass.lowSurrogate(param1);
+	@:extern @:overload inline public static function offsetByCodePoints(param1:CharSequence, param2:Int, param3:Int):Int return CharacterClass.offsetByCodePoints(param1, param2, param3);
+	@:extern @:overload inline public static function reverseBytes(param1:java.types.Char16):java.types.Char16 return CharacterClass.reverseBytes(param1);
+	@:extern @:overload inline public static function toChars(param1:Int, param2:java.NativeArray<java.types.Char16>, param3:Int):Int return CharacterClass.toChars(param1, param2, param3);
+	@:extern @:overload inline public static function toCodePoint(param1:java.types.Char16, param2:java.types.Char16):Int return CharacterClass.toCodePoint(param1, param2);
+	@:extern @:overload inline public static function toLowerCase(param1:java.types.Char16):java.types.Char16 return CharacterClass.toLowerCase(param1);
+	@:extern @:overload inline public static function _toString(param1:java.types.Char16):String return CharacterClass._toString(param1);
+	@:extern @:overload inline public static function toTitleCase(param1:java.types.Char16):java.types.Char16 return CharacterClass.toTitleCase(param1);
+	@:extern @:overload inline public static function toUpperCase(param1:java.types.Char16):java.types.Char16 return CharacterClass.toUpperCase(param1);
+	@:extern @:overload inline public static function valueOf(param1:java.types.Char16):Character return CharacterClass.valueOf(param1);
 }
 
 @:native("java.lang.Character") extern class CharacterClass implements Comparable<Character>

+ 33 - 0
std/java/lang/Double.hx

@@ -1,11 +1,44 @@
 package java.lang;
 
+@:native("") // make sure the generator won't see this
 @:forward abstract Double(DoubleClass) from DoubleClass to DoubleClass
 {
 	@:to @:extern inline public function toFloat():Float
 		return this.doubleValue();
 	@:from @:extern inline public static function fromFloat(b:Float):Double
 		return DoubleClass.valueOf(b);
+
+	public static var MAX_EXPONENT(get,never):Int;
+	@:extern static inline function get_MAX_EXPONENT():Int return DoubleClass.MAX_EXPONENT;
+	public static var MAX_VALUE(get,never):Float;
+	@:extern static inline function get_MAX_VALUE():Float return DoubleClass.MAX_VALUE;
+	public static var MIN_EXPONENT(get,never):Int;
+	@:extern static inline function get_MIN_EXPONENT():Int return DoubleClass.MIN_EXPONENT;
+	public static var MIN_NORMAL(get,never):Float;
+	@:extern static inline function get_MIN_NORMAL():Float return DoubleClass.MIN_NORMAL;
+	public static var MIN_VALUE(get,never):Float;
+	@:extern static inline function get_MIN_VALUE():Float return DoubleClass.MIN_VALUE;
+	public static var NEGATIVE_INFINITY(get,never):Float;
+	@:extern static inline function get_NEGATIVE_INFINITY():Float return DoubleClass.NEGATIVE_INFINITY;
+	public static var NaN(get,never):Float;
+	@:extern static inline function get_NaN():Float return DoubleClass.NaN;
+	public static var POSITIVE_INFINITY(get,never):Float;
+	@:extern static inline function get_POSITIVE_INFINITY():Float return DoubleClass.POSITIVE_INFINITY;
+	public static var SIZE(get,never):Int;
+	@:extern static inline function get_SIZE():Int return DoubleClass.SIZE;
+	public static var TYPE(get,set):Class<java.lang.Double>;
+	@:extern static inline function get_TYPE():Class<java.lang.Double> return DoubleClass.TYPE;
+	@:extern static inline function set_TYPE(val:Class<java.lang.Double>):Class<java.lang.Double> return DoubleClass.TYPE = val;
+	@:extern @:overload inline public static function compare(param1:Float, param2:Float):Int return DoubleClass.compare(param1, param2);
+	@:extern @:overload inline public static function doubleToLongBits(param1:Float):haxe.Int64 return DoubleClass.doubleToLongBits(param1);
+	@:extern @:overload inline public static function doubleToRawLongBits(param1:Float):haxe.Int64 return DoubleClass.doubleToRawLongBits(param1);
+	@:extern @:overload inline public static function _isInfinite(param1:Float):Bool return DoubleClass._isInfinite(param1);
+	@:extern @:overload inline public static function _isNaN(param1:Float):Bool return DoubleClass._isNaN(param1);
+	@:extern @:overload inline public static function longBitsToDouble(param1:haxe.Int64):Float return DoubleClass.longBitsToDouble(param1);
+	@:extern @:overload inline public static function parseDouble(param1:String):Float return DoubleClass.parseDouble(param1);
+	@:extern @:overload inline public static function toHexString(param1:Float):String return DoubleClass.toHexString(param1);
+	@:extern @:overload inline public static function _toString(param1:Float):String return DoubleClass._toString(param1);
+	@:extern @:overload inline public static function valueOf(param1:String):Double return DoubleClass.valueOf(param1);
 }
 
 @:native("java.lang.Double") extern class DoubleClass extends Number implements Comparable<Double>

+ 33 - 0
std/java/lang/Float.hx

@@ -1,11 +1,44 @@
 package java.lang;
 
+@:native("") // make sure the generator won't see this
 @:forward abstract Float(FloatClass) from FloatClass to FloatClass
 {
 	@:to @:extern inline public function toFloat():std.StdTypes.Float
 		return this.floatValue();
 	@:from @:extern inline public static function fromFloat(b:std.StdTypes.Single):Float
 		return FloatClass.valueOf(b);
+
+	public static var MAX_EXPONENT(get,never):Int;
+	@:extern static inline function get_MAX_EXPONENT():Int return FloatClass.MAX_EXPONENT;
+	public static var MAX_VALUE(get,never):Single;
+	@:extern static inline function get_MAX_VALUE():Single return FloatClass.MAX_VALUE;
+	public static var MIN_EXPONENT(get,never):Int;
+	@:extern static inline function get_MIN_EXPONENT():Int return FloatClass.MIN_EXPONENT;
+	public static var MIN_NORMAL(get,never):Single;
+	@:extern static inline function get_MIN_NORMAL():Single return FloatClass.MIN_NORMAL;
+	public static var MIN_VALUE(get,never):Single;
+	@:extern static inline function get_MIN_VALUE():Single return FloatClass.MIN_VALUE;
+	public static var NEGATIVE_INFINITY(get,never):Single;
+	@:extern static inline function get_NEGATIVE_INFINITY():Single return FloatClass.NEGATIVE_INFINITY;
+	public static var NaN(get,never):Single;
+	@:extern static inline function get_NaN():Single return FloatClass.NaN;
+	public static var POSITIVE_INFINITY(get,never):Single;
+	@:extern static inline function get_POSITIVE_INFINITY():Single return FloatClass.POSITIVE_INFINITY;
+	public static var SIZE(get,never):Int;
+	@:extern static inline function get_SIZE():Int return FloatClass.SIZE;
+	public static var TYPE(get,set):Class<std.StdTypes.Float>;
+	@:extern static inline function get_TYPE():Class<std.StdTypes.Float> return FloatClass.TYPE;
+	@:extern static inline function set_TYPE(val:Class<std.StdTypes.Float>):Class<std.StdTypes.Float> return FloatClass.TYPE = val;
+	@:extern @:overload inline public static function compare(param1:Single, param2:Single):Int return FloatClass.compare(param1, param2);
+	@:extern @:overload inline public static function floatToIntBits(param1:Single):Int return FloatClass.floatToIntBits(param1);
+	@:extern @:overload inline public static function floatToRawIntBits(param1:Single):Int return FloatClass.floatToRawIntBits(param1);
+	@:extern @:overload inline public static function intBitsToFloat(param1:Int):Single return FloatClass.intBitsToFloat(param1);
+	@:extern @:overload inline public static function _isInfinite(param1:Single):Bool return FloatClass._isInfinite(param1);
+	@:extern @:overload inline public static function _isNaN(param1:Single):Bool return FloatClass._isNaN(param1);
+	@:extern @:overload inline public static function parseFloat(param1:String):Single return FloatClass.parseFloat(param1);
+	@:extern @:overload inline public static function toHexString(param1:Single):String return FloatClass.toHexString(param1);
+	@:extern @:overload inline public static function _toString(param1:Single):String return FloatClass._toString(param1);
+	@:extern @:overload inline public static function valueOf(param1:String):Float return FloatClass.valueOf(param1);
 }
 
 @:native("java.lang.Float") extern class FloatClass extends Number implements Comparable<Float>

+ 30 - 0
std/java/lang/Integer.hx

@@ -1,11 +1,41 @@
 package java.lang;
 
+@:native("") // make sure the generator won't see this
 @:forward abstract Integer(IntegerClass) from IntegerClass to IntegerClass
 {
 	@:to @:extern inline public function toInt():Int
 		return this.intValue();
 	@:from @:extern inline public static function fromInt(b:Int):Integer
 		return IntegerClass.valueOf(b);
+
+	public static var MAX_VALUE(get,never):Int;
+	@:extern static inline function get_MAX_VALUE():Int return IntegerClass.MAX_VALUE;
+	public static var MIN_VALUE(get,never):Int;
+	@:extern static inline function get_MIN_VALUE():Int return IntegerClass.MIN_VALUE;
+	public static var SIZE(get,never):Int;
+	@:extern static inline function get_SIZE():Int return IntegerClass.SIZE;
+	public static var TYPE(get,set):Class<java.lang.Integer>;
+	@:extern static inline function get_TYPE():Class<java.lang.Integer> return IntegerClass.TYPE;
+	@:extern static inline function set_TYPE(val:Class<java.lang.Integer>):Class<java.lang.Integer> return IntegerClass.TYPE = val;
+	@:extern @:overload inline public static function bitCount(param1:Int):Int return IntegerClass.bitCount(param1);
+	@:extern @:overload inline public static function compare(param1:Int, param2:Int):Int return IntegerClass.compare(param1, param2);
+	@:extern @:overload inline public static function decode(param1:String):Integer return IntegerClass.decode(param1);
+	@:extern @:overload inline public static function getInteger(param1:String):Integer return IntegerClass.getInteger(param1);
+	@:extern @:overload inline public static function highestOneBit(param1:Int):Int return IntegerClass.highestOneBit(param1);
+	@:extern @:overload inline public static function lowestOneBit(param1:Int):Int return IntegerClass.lowestOneBit(param1);
+	@:extern @:overload inline public static function numberOfLeadingZeros(param1:Int):Int return IntegerClass.numberOfLeadingZeros(param1);
+	@:extern @:overload inline public static function numberOfTrailingZeros(param1:Int):Int return IntegerClass.numberOfTrailingZeros(param1);
+	@:extern @:overload inline public static function parseInt(param1:String, param2:Int):Int return IntegerClass.parseInt(param1, param2);
+	@:extern @:overload inline public static function reverse(param1:Int):Int return IntegerClass.reverse(param1);
+	@:extern @:overload inline public static function reverseBytes(param1:Int):Int return IntegerClass.reverseBytes(param1);
+	@:extern @:overload inline public static function rotateLeft(param1:Int, param2:Int):Int return IntegerClass.rotateLeft(param1, param2);
+	@:extern @:overload inline public static function rotateRight(param1:Int, param2:Int):Int return IntegerClass.rotateRight(param1, param2);
+	@:extern @:overload inline public static function signum(param1:Int):Int return IntegerClass.signum(param1);
+	@:extern @:overload inline public static function toBinaryString(param1:Int):String return IntegerClass.toBinaryString(param1);
+	@:extern @:overload inline public static function toHexString(param1:Int):String return IntegerClass.toHexString(param1);
+	@:extern @:overload inline public static function toOctalString(param1:Int):String return IntegerClass.toOctalString(param1);
+	@:extern @:overload inline public static function _toString(param1:Int, param2:Int):String return IntegerClass._toString(param1, param2);
+	@:extern @:overload inline public static function valueOf(param1:String, param2:Int):Integer return IntegerClass.valueOf(param1, param2);
 }
 
 @:native("java.lang.Integer") extern class IntegerClass extends Number implements Comparable<Integer>

+ 30 - 0
std/java/lang/Long.hx

@@ -1,11 +1,41 @@
 package java.lang;
 
+@:native("") // make sure the generator won't see this
 @:forward abstract Long(LongClass) from LongClass to LongClass
 {
 	@:to @:extern inline public function toLong():haxe.Int64
 		return this.longValue();
 	@:from @:extern inline public static function fromLong(b:haxe.Int64):Long
 		return LongClass.valueOf(b);
+
+	public static var MAX_VALUE(get,never):haxe.Int64;
+	@:extern static inline function get_MAX_VALUE():haxe.Int64 return LongClass.MAX_VALUE;
+	public static var MIN_VALUE(get,never):haxe.Int64;
+	@:extern static inline function get_MIN_VALUE():haxe.Int64 return LongClass.MIN_VALUE;
+	public static var SIZE(get,never):Int;
+	@:extern static inline function get_SIZE():Int return LongClass.SIZE;
+	public static var TYPE(get,set):Class<java.lang.Long>;
+	@:extern static inline function get_TYPE():Class<java.lang.Long> return LongClass.TYPE;
+	@:extern static inline function set_TYPE(val:Class<java.lang.Long>):Class<java.lang.Long> return LongClass.TYPE = val;
+	@:extern @:overload inline public static function bitCount(param1:haxe.Int64):Int return LongClass.bitCount(param1);
+	@:extern @:overload inline public static function compare(param1:haxe.Int64, param2:haxe.Int64):Int return LongClass.compare(param1, param2);
+	@:extern @:overload inline public static function decode(param1:String):Long return LongClass.decode(param1);
+	@:extern @:overload inline public static function getLong(param1:String, param2:Long):Long return LongClass.getLong(param1, param2);
+	@:extern @:overload inline public static function highestOneBit(param1:haxe.Int64):haxe.Int64 return LongClass.highestOneBit(param1);
+	@:extern @:overload inline public static function lowestOneBit(param1:haxe.Int64):haxe.Int64 return LongClass.lowestOneBit(param1);
+	@:extern @:overload inline public static function numberOfLeadingZeros(param1:haxe.Int64):Int return LongClass.numberOfLeadingZeros(param1);
+	@:extern @:overload inline public static function numberOfTrailingZeros(param1:haxe.Int64):Int return LongClass.numberOfTrailingZeros(param1);
+	@:extern @:overload inline public static function parseLong(param1:String):haxe.Int64 return LongClass.parseLong(param1);
+	@:extern @:overload inline public static function reverse(param1:haxe.Int64):haxe.Int64 return LongClass.reverse(param1);
+	@:extern @:overload inline public static function reverseBytes(param1:haxe.Int64):haxe.Int64 return LongClass.reverseBytes(param1);
+	@:extern @:overload inline public static function rotateLeft(param1:haxe.Int64, param2:Int):haxe.Int64 return LongClass.rotateLeft(param1, param2);
+	@:extern @:overload inline public static function rotateRight(param1:haxe.Int64, param2:Int):haxe.Int64 return LongClass.rotateRight(param1, param2);
+	@:extern @:overload inline public static function signum(param1:haxe.Int64):Int return LongClass.signum(param1);
+	@:extern @:overload inline public static function toBinaryString(param1:haxe.Int64):String return LongClass.toBinaryString(param1);
+	@:extern @:overload inline public static function toHexString(param1:haxe.Int64):String return LongClass.toHexString(param1);
+	@:extern @:overload inline public static function toOctalString(param1:haxe.Int64):String return LongClass.toOctalString(param1);
+	@:extern @:overload inline public static function _toString(param1:haxe.Int64):String return LongClass._toString(param1);
+	@:extern @:overload inline public static function valueOf(param1:haxe.Int64):Long return LongClass.valueOf(param1);
 }
 
 @:native("java.lang.Long") extern class LongClass extends Number implements Comparable<Long>

+ 17 - 0
std/java/lang/Short.hx

@@ -1,11 +1,28 @@
 package java.lang;
 
+@:native("") // make sure the generator won't see this
 @:forward abstract Short(ShortClass) from ShortClass to ShortClass
 {
 	@:to @:extern inline public function toShort():java.types.Int16
 		return this.shortValue();
 	@:from @:extern inline public static function fromShort(b:java.types.Int16):Short
 		return ShortClass.valueOf(b);
+
+	public static var MAX_VALUE(get,never):java.types.Int16;
+	@:extern static inline function get_MAX_VALUE():java.types.Int16 return ShortClass.MAX_VALUE;
+	public static var MIN_VALUE(get,never):java.types.Int16;
+	@:extern static inline function get_MIN_VALUE():java.types.Int16 return ShortClass.MIN_VALUE;
+	public static var SIZE(get,never):Int;
+	@:extern static inline function get_SIZE():Int return ShortClass.SIZE;
+	public static var TYPE(get,set):Class<java.lang.Short>;
+	@:extern static inline function get_TYPE():Class<java.lang.Short> return ShortClass.TYPE;
+	@:extern static inline function set_TYPE(val:Class<java.lang.Short>):Class<java.lang.Short> return ShortClass.TYPE = val;
+	@:extern @:overload inline public static function compare(param1:java.types.Int16, param2:java.types.Int16):Int return ShortClass.compare(param1, param2);
+	@:extern @:overload inline public static function decode(param1:String):Short return ShortClass.decode(param1);
+	@:extern @:overload inline public static function parseShort(param1:String, param2:Int):java.types.Int16 return ShortClass.parseShort(param1, param2);
+	@:extern @:overload inline public static function reverseBytes(param1:java.types.Int16):java.types.Int16 return ShortClass.reverseBytes(param1);
+	@:extern @:overload inline public static function _toString(param1:java.types.Int16):String return ShortClass._toString(param1);
+	@:extern @:overload inline public static function valueOf(param1:String, param2:Int):Short return ShortClass.valueOf(param1, param2);
 }
 
 @:native("java.lang.Short") extern class ShortClass extends Number implements Comparable<Short>

+ 7 - 9
std/js/Boot.hx

@@ -25,10 +25,11 @@ private class HaxeError extends js.Error {
 
 	var val:Dynamic;
 
-	public function new(val:Dynamic) {
+	public function new(val:Dynamic) untyped {
 		super();
-		this.val = untyped __define_feature__("js.Boot.HaxeError", val);
-		untyped if (js.Error.captureStackTrace) js.Error.captureStackTrace(this, HaxeError);
+		this.val = __define_feature__("js.Boot.HaxeError", val);
+		this.message = String(val);
+		if (js.Error.captureStackTrace) js.Error.captureStackTrace(this, HaxeError);
 	}
 }
 
@@ -93,7 +94,7 @@ class Boot {
 		}
 	}
 
-	@:ifFeature("may_print_enum")
+	@:ifFeature("has_enum")
 	private static function __string_rec(o,s:String) {
 		untyped {
 			if( o == null )
@@ -241,12 +242,9 @@ class Boot {
 		return __nativeClassName(o) != null;
 	}
 
-	// resolve native JS class (with window or global):
+	// resolve native JS class in the global scope:
 	static function __resolveNativeClass(name:String) untyped {
-		if (__js__("typeof window") != "undefined")
-			return window[name];
-		else
-			return global[name];
+		return untyped Function('return typeof $name != "undefined" ? $name : null')();
 	}
 
 }

+ 2 - 1
std/js/_std/haxe/io/Bytes.hx

@@ -34,6 +34,7 @@ class Bytes {
 		this.length = data.byteLength;
 		this.b = new js.html.Uint8Array(data);
 		untyped {
+			b.bufferValue = data; // some impl does not return the same instance in .buffer
 			data.hxBytes = this;
 			data.bytes = this.b;
 		}
@@ -183,7 +184,7 @@ class Bytes {
 	}
 
 	public inline function getData() : BytesData {
-		return b.buffer;
+		return untyped b.bufferValue;
 	}
 
 	public static function alloc( length : Int ) : Bytes {

+ 1 - 0
std/js/_std/haxe/io/Float32Array.hx

@@ -80,6 +80,7 @@ abstract Float32Array(Float32ArrayData) {
 	}
 
 	public static function fromBytes( bytes : haxe.io.Bytes, bytePos : Int = 0, ?length : Int ) : Float32Array {
+		if( length == null ) length = (bytes.length - bytePos) >> 2;
 		return fromData(new Float32ArrayData(bytes.getData(), bytePos, length));
 	}
 }

+ 1 - 0
std/js/_std/haxe/io/Float64Array.hx

@@ -80,6 +80,7 @@ abstract Float64Array(Float64ArrayData) {
 	}
 
 	public static function fromBytes( bytes : haxe.io.Bytes, bytePos : Int = 0, ?length : Int ) : Float64Array {
+		if( length == null ) length = (bytes.length - bytePos) >> 3;
 		return fromData(new Float64ArrayData(bytes.getData(), bytePos, length));
 	}
 }

+ 1 - 0
std/js/_std/haxe/io/Int32Array.hx

@@ -78,6 +78,7 @@ abstract Int32Array(Int32ArrayData) {
 	}
 
 	public static function fromBytes( bytes : haxe.io.Bytes, bytePos : Int = 0, ?length : Int ) : Int32Array {
+		if( length == null ) length = (bytes.length - bytePos) >> 2;
 		return fromData(new Int32ArrayData(bytes.getData(), bytePos, length));
 	}
 

+ 1 - 0
std/js/_std/haxe/io/UInt16Array.hx

@@ -78,6 +78,7 @@ abstract UInt16Array(UInt16ArrayData) {
 	}
 
 	public static function fromBytes( bytes : haxe.io.Bytes, bytePos : Int = 0, ?length : Int ) : UInt16Array {
+		if( length == null ) length = (bytes.length - bytePos) >> 1;
 		return fromData(new UInt16ArrayData(bytes.getData(), bytePos, length));
 	}
 

+ 1 - 0
std/js/_std/haxe/io/UInt32Array.hx

@@ -78,6 +78,7 @@ abstract UInt32Array(UInt32ArrayData) {
 	}
 
 	public static function fromBytes( bytes : haxe.io.Bytes, bytePos : Int = 0, ?length : Int ) : UInt32Array {
+		if( length == null ) length = (bytes.length - bytePos) >> 2;
 		return fromData(new UInt32ArrayData(bytes.getData(), bytePos, length));
 	}
 

+ 1 - 0
std/js/_std/haxe/io/UInt8Array.hx

@@ -78,6 +78,7 @@ abstract UInt8Array(UInt8ArrayData) {
 	}
 
 	public static function fromBytes( bytes : haxe.io.Bytes, bytePos : Int = 0, ?length : Int ) : UInt8Array {
+		if( length == null ) length = bytes.length - bytePos;
 		return fromData(new UInt8ArrayData(bytes.getData(), bytePos, length));
 	}
 

+ 1 - 1
std/js/html/Animation.hx

@@ -28,6 +28,6 @@ package js.html;
 extern class Animation
 {
 	var effect(default,null) : AnimationEffect;
-	var target(default,null) : DOMElement;
+	var target(default,null) : Element;
 	
 }

+ 1 - 1
std/js/html/ApplicationCache.hx

@@ -25,7 +25,7 @@
 package js.html;
 
 @:native("ApplicationCache")
-extern class ApplicationCache extends EventTarget
+extern class ApplicationCache extends EventTarget implements ArrayAccess<String>
 {
 	static inline var UNCACHED : Int = 0;
 	static inline var IDLE : Int = 1;

+ 1 - 1
std/js/html/Attr.hx

@@ -30,6 +30,6 @@ extern class Attr extends Node
 	var value : String;
 	var name(default,null) : String;
 	var specified(default,null) : Bool;
-	var ownerElement(default,null) : DOMElement;
+	var ownerElement(default,null) : Element;
 	
 }

+ 1 - 1
std/js/html/AudioTrackList.hx

@@ -25,7 +25,7 @@
 package js.html;
 
 @:native("AudioTrackList")
-extern class AudioTrackList extends EventTarget
+extern class AudioTrackList extends EventTarget implements ArrayAccess<AudioTrack>
 {
 	var length(default,null) : Int;
 	var onchange : haxe.Constraints.Function;

+ 2 - 2
std/js/html/CanvasRenderingContext2D.hx

@@ -74,8 +74,8 @@ extern class CanvasRenderingContext2D
 	function fill( path : Path2D, ?winding : CanvasWindingRule = "nonzero" ) : Void;
 	@:overload( function() : Void {} )
 	function stroke( path : Path2D ) : Void;
-	function drawFocusIfNeeded( element : DOMElement ) : Void;
-	function drawCustomFocusRing( element : DOMElement ) : Bool;
+	function drawFocusIfNeeded( element : Element ) : Void;
+	function drawCustomFocusRing( element : Element ) : Bool;
 	@:overload( function( ?winding : CanvasWindingRule = "nonzero" ) : Void {} )
 	function clip( path : Path2D, ?winding : CanvasWindingRule = "nonzero" ) : Void;
 	@:overload( function( x : Float, y : Float, ?winding : CanvasWindingRule = "nonzero" ) : Bool {} )

+ 2 - 2
std/js/html/CharacterData.hx

@@ -29,8 +29,8 @@ extern class CharacterData extends Node
 {
 	var data : String;
 	var length(default,null) : Int;
-	var previousElementSibling(default,null) : DOMElement;
-	var nextElementSibling(default,null) : DOMElement;
+	var previousElementSibling(default,null) : Element;
+	var nextElementSibling(default,null) : Element;
 	
 	/** @throws DOMError */
 	function substringData( offset : Int, count : Int ) : String;

+ 16 - 15
std/js/html/Console.hx

@@ -27,22 +27,23 @@ package js.html;
 @:native("Console")
 extern class Console
 {
-	function log( ?data : Dynamic ) : Void;
-	function info( ?data : Dynamic ) : Void;
-	function warn( ?data : Dynamic ) : Void;
-	function error( ?data : Dynamic ) : Void;
-	function exception( ?data : Dynamic ) : Void;
-	function debug( ?data : Dynamic ) : Void;
-	function table( ?data : Dynamic ) : Void;
+	function log( data : haxe.extern.Rest<Dynamic> ) : Void;
+	function info( data : haxe.extern.Rest<Dynamic> ) : Void;
+	function warn( data : haxe.extern.Rest<Dynamic> ) : Void;
+	function error( data : haxe.extern.Rest<Dynamic> ) : Void;
+	function exception( data : haxe.extern.Rest<Dynamic> ) : Void;
+	function debug( data : haxe.extern.Rest<Dynamic> ) : Void;
+	function table( data : haxe.extern.Rest<Dynamic> ) : Void;
 	function trace() : Void;
-	function dir( ?data : Dynamic ) : Void;
-	function group( ?data : Dynamic ) : Void;
-	function groupCollapsed( ?data : Dynamic ) : Void;
-	function groupEnd( ?data : Dynamic ) : Void;
+	function dir( data : haxe.extern.Rest<Dynamic> ) : Void;
+	function group( data : haxe.extern.Rest<Dynamic> ) : Void;
+	function groupCollapsed( data : haxe.extern.Rest<Dynamic> ) : Void;
+	function groupEnd( data : haxe.extern.Rest<Dynamic> ) : Void;
 	function time( ?time : Dynamic ) : Void;
 	function timeEnd( ?time : Dynamic ) : Void;
-	function profile( ?data : Dynamic ) : Void;
-	function profileEnd( ?data : Dynamic ) : Void;
-	function assert( condition : Bool, ?data : Dynamic ) : Void;
-	function count( ?data : Dynamic ) : Void;
+	function profile( data : haxe.extern.Rest<Dynamic> ) : Void;
+	function profileEnd( data : haxe.extern.Rest<Dynamic> ) : Void;
+	function assert( condition : Bool, data : haxe.extern.Rest<Dynamic> ) : Void;
+	function count( data : haxe.extern.Rest<Dynamic> ) : Void;
+	function clear() : Void;
 }

+ 11 - 10
std/js/html/DOMElement.hx

@@ -57,7 +57,8 @@ extern class DOMElement extends Node
 	var oncopy : haxe.Constraints.Function;
 	var oncut : haxe.Constraints.Function;
 	var onpaste : haxe.Constraints.Function;
-	var offsetParent(default,null) : DOMElement;
+	var innerText : String;
+	var offsetParent(default,null) : Element;
 	var offsetTop(default,null) : Int;
 	var offsetLeft(default,null) : Int;
 	var offsetWidth(default,null) : Int;
@@ -139,12 +140,12 @@ extern class DOMElement extends Node
 	var onlostpointercapture : haxe.Constraints.Function;
 	var onpointerlockchange : haxe.Constraints.Function;
 	var onpointerlockerror : haxe.Constraints.Function;
-	var previousElementSibling(default,null) : DOMElement;
-	var nextElementSibling(default,null) : DOMElement;
+	var previousElementSibling(default,null) : Element;
+	var nextElementSibling(default,null) : Element;
 	var onerror : haxe.Constraints.Function;
 	var children(default,null) : HTMLCollection;
-	var firstElementChild(default,null) : DOMElement;
-	var lastElementChild(default,null) : DOMElement;
+	var firstElementChild(default,null) : Element;
+	var lastElementChild(default,null) : Element;
 	var childElementCount(default,null) : Int;
 	var ontouchstart : haxe.Constraints.Function;
 	var ontouchend : haxe.Constraints.Function;
@@ -165,7 +166,7 @@ extern class DOMElement extends Node
 	function hasAttributeNS( namespace_ : String, localName : String ) : Bool;
 	function hasAttributes() : Bool;
 	/** @throws DOMError */
-	function closest( selector : String ) : DOMElement;
+	function closest( selector : String ) : Element;
 	/** @throws DOMError */
 	function matches( selector : String ) : Bool;
 	function getElementsByTagName( localName : String ) : HTMLCollection;
@@ -206,7 +207,7 @@ extern class DOMElement extends Node
 	/** @throws DOMError */
 	function insertAdjacentHTML( position : String, text : String ) : Void;
 	/** @throws DOMError */
-	function querySelector( selectors : String ) : DOMElement;
+	function querySelector( selectors : String ) : Element;
 	/** @throws DOMError */
 	function querySelectorAll( selectors : String ) : NodeList;
 	/** @throws DOMError */
@@ -215,9 +216,9 @@ extern class DOMElement extends Node
 	function getAnimationPlayers() : Array<AnimationPlayer>;
 	function remove() : Void;
 	/** @throws DOMError */
-	function convertQuadFromNode( quad : DOMQuad, from : haxe.extern.EitherType<Text,haxe.extern.EitherType<DOMElement,Document>>, ?options : ConvertCoordinateOptions ) : DOMQuad;
+	function convertQuadFromNode( quad : DOMQuad, from : haxe.extern.EitherType<Text,haxe.extern.EitherType<Element,HTMLDocument>>, ?options : ConvertCoordinateOptions ) : DOMQuad;
 	/** @throws DOMError */
-	function convertRectFromNode( rect : DOMRectReadOnly, from : haxe.extern.EitherType<Text,haxe.extern.EitherType<DOMElement,Document>>, ?options : ConvertCoordinateOptions ) : DOMQuad;
+	function convertRectFromNode( rect : DOMRectReadOnly, from : haxe.extern.EitherType<Text,haxe.extern.EitherType<Element,HTMLDocument>>, ?options : ConvertCoordinateOptions ) : DOMQuad;
 	/** @throws DOMError */
-	function convertPointFromNode( point : DOMPointInit, from : haxe.extern.EitherType<Text,haxe.extern.EitherType<DOMElement,Document>>, ?options : ConvertCoordinateOptions ) : DOMPoint;
+	function convertPointFromNode( point : DOMPointInit, from : haxe.extern.EitherType<Text,haxe.extern.EitherType<Element,HTMLDocument>>, ?options : ConvertCoordinateOptions ) : DOMPoint;
 }

+ 2 - 2
std/js/html/DOMImplementation.hx

@@ -31,7 +31,7 @@ extern class DOMImplementation
 	/** @throws DOMError */
 	function createDocumentType( qualifiedName : String, publicId : String, systemId : String ) : DocumentType;
 	/** @throws DOMError */
-	function createDocument( namespace_ : String, qualifiedName : String, ?doctype : DocumentType ) : Document;
+	function createDocument( namespace_ : String, qualifiedName : String, ?doctype : DocumentType ) : HTMLDocument;
 	/** @throws DOMError */
-	function createHTMLDocument( ?title : String ) : Document;
+	function createHTMLDocument( ?title : String ) : HTMLDocument;
 }

+ 1 - 1
std/js/html/DOMParser.hx

@@ -31,5 +31,5 @@ extern class DOMParser
 	@:overload( function() : Void {} )
 	function new( prin : Dynamic/*MISSING Principal*/, ?documentURI : Dynamic/*MISSING URI*/, ?baseURI : Dynamic/*MISSING URI*/ ) : Void;
 	/** @throws DOMError */
-	function parseFromString( str : String, type : SupportedType ) : Document;
+	function parseFromString( str : String, type : SupportedType ) : HTMLDocument;
 }

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio