Kaynağa Gözat

pull various changes from hxb branch

Simon Krajewski 1 yıl önce
ebeveyn
işleme
c475a5159b

+ 6 - 2
src/core/tFunctions.ml

@@ -58,9 +58,9 @@ let has_var_flag v (flag : flag_tvar) =
 
 (* ======= General utility ======= *)
 
-let alloc_var =
+let alloc_var' =
 	let uid = ref 0 in
-	(fun kind n t p ->
+	uid,(fun kind n t p ->
 		incr uid;
 		{
 			v_kind = kind;
@@ -74,6 +74,10 @@ let alloc_var =
 		}
 	)
 
+let alloc_var =
+	let _,alloc_var = alloc_var' in
+	alloc_var
+
 let alloc_mid =
 	let mid = ref 0 in
 	(fun() -> incr mid; !mid)

+ 2 - 2
src/typing/typeloadModule.ml

@@ -774,7 +774,7 @@ let type_module ctx mpath file ?(dont_check_path=false) ?(is_extern=false) tdecl
 
 let type_module_hook = ref (fun _ _ _ -> None)
 
-let load_module' ctx g m p =
+let load_module' ctx m p =
 	try
 		(* Check current context *)
 		ctx.com.module_lut#find m
@@ -810,7 +810,7 @@ let load_module' ctx g m p =
 			type_module ctx m file ~is_extern decls p
 
 let load_module ctx m p =
-	let m2 = load_module' ctx ctx.g m p in
+	let m2 = load_module' ctx m p in
 	add_dependency ~skip_postprocess:true ctx.m.curmod m2;
 	if ctx.pass = PTypeField then flush_pass ctx PConnectField ("load_module",fst m @ [snd m]);
 	m2

+ 2 - 0
std/jvm/Jvm.hx

@@ -40,6 +40,8 @@ import jvm.annotation.EnumValueReflectionInformation;
 @:keep
 @:native('haxe.jvm.Jvm')
 class Jvm {
+	extern static final init:java.Init;
+
 	extern static public function instanceof<S, T>(obj:S, type:T):Bool;
 
 	extern static public function referenceEquals<T>(v1:T, v2:T):Bool;

+ 4 - 2
tests/runci/targets/Jvm.hx

@@ -10,12 +10,14 @@ class Jvm {
 		deleteDirectoryRecursively("bin/jvm");
 		Java.getJavaDependencies();
 
+		runCommand("haxe", ["compile-java-native.hxml"]);
+
 		for (level in 0...3) {
 			final args = args.concat(["-D", "jvm.dynamic-level=" + level]);
-			runCommand("haxe", ["compile-jvm.hxml"].concat(args));
+			runCommand("haxe", ["compile-jvm-only.hxml", "--times"].concat(args));
 			runCommand("java", ["-jar", "bin/unit.jar"]);
 
-			runCommand("haxe", ["compile-jvm.hxml","-dce","no"].concat(args));
+			runCommand("haxe", ["compile-jvm-only.hxml","-dce","no"].concat(args));
 			runCommand("java", ["-jar", "bin/unit.jar"]);
 		}
 

+ 26 - 0
tests/server/src/cases/issues/Issue11480.hx

@@ -0,0 +1,26 @@
+package cases.issues;
+
+import haxe.io.Path;
+
+class Issue11480 extends TestCase {
+	function test(_) {
+		vfs.putContent("Main.hx", "function main() {}");
+		var args = [
+			"-main",
+			"Main",
+			"-hl",
+			"bin/out.hl",
+			"-D",
+			"no-compilation"
+		];
+		runHaxe(args);
+		assertSuccess();
+
+		var std = Path.removeTrailingSlashes(utils.macro.BuildHub.getStd());
+		runHaxeJsonCb(args, DisplayMethods.Hover, {file: new FsPath('${std}/StdTypes.hx'), offset: 0}, (res) -> {
+			// If we don't use the cb version, assertSuccess() below will pass even when request fails..
+			Assert.isNull(res);
+		});
+		assertSuccess();
+	}
+}

+ 7 - 0
tests/server/src/utils/macro/BuildHub.hx

@@ -0,0 +1,7 @@
+package utils.macro;
+
+class BuildHub {
+	macro static public function build();
+	macro static public function getStd();
+}
+

+ 5 - 0
tests/server/src/utils/macro/BuildHub.macro.hx

@@ -19,6 +19,11 @@ class BuildHub {
 		return TestBuilder.build(fields);
 	}
 
+	macro static public function getStd() {
+		var std = haxe.macro.Compiler.getConfiguration().stdPath;
+		return macro $v{std.shift()};
+	}
+
 	static function isDisplayTest(cls:ClassType):Bool {
 		if(cls.pack.length == 0 && cls.name == "DisplayTestCase") {
 			return true;

+ 2 - 0
tests/unit/compile-java-native.hxml

@@ -0,0 +1,2 @@
+#java native build
+-cmd "haxelib run hxjava native_java/hxjava_build.txt --out native_java/native"

+ 1 - 2
tests/unit/compile-java.hxml

@@ -1,5 +1,4 @@
-#java native build
--cmd "haxelib run hxjava native_java/hxjava_build.txt --out native_java/native"
+compile-java-native.hxml
 
 --next
 

+ 1 - 2
tests/unit/compile-jvm.hxml

@@ -1,5 +1,4 @@
-#java native build
--cmd "haxelib run hxjava native_java/hxjava_build.txt --out native_java/native"
+compile-java-native.hxml
 
 --next