소스 검색

Merge branch 'development' of github.com:HaxeFoundation/haxe into genpy

frabbit 11 년 전
부모
커밋
b06b315a0f
6개의 변경된 파일45개의 추가작업 그리고 23개의 파일을 삭제
  1. 0 1
      .travis.yml
  2. 12 7
      codegen.ml
  3. 15 10
      filters.ml
  4. 1 1
      libs
  5. 7 4
      std/haxe/macro/Compiler.hx
  6. 10 0
      tests/unit/issues/Issue2917.hx

+ 0 - 1
.travis.yml

@@ -14,7 +14,6 @@ matrix:
   fast_finish: true
   allow_failures:
     - env: TARGET=flash8
-    - env: TARGET=flixel-demos
 
 before_install:
   - travis_retry sudo apt-get update

+ 12 - 7
codegen.ml

@@ -690,15 +690,20 @@ module Abstract = struct
 		in
 		let find a tl f =
 			let tcf,cfo = f() in
+			let mk_cast () =
+				let tcf = apply_params a.a_types tl tcf in
+				if type_iseq tcf tleft then
+					eright
+				else
+					(* TODO: causes Java overload issues *)
+					(* let eright = mk (TCast(eright,None)) tleft p in *)
+					do_check_cast ctx tcf eright p
+			in
 			match cfo,a.a_impl with
 				| None,_ ->
-					let tcf = apply_params a.a_types tl tcf in
-					if type_iseq tcf tleft then
-						eright
-					else
-						(* TODO: causes Java overload issues *)
-						(* let eright = mk (TCast(eright,None)) tleft p in *)
-						do_check_cast ctx tcf eright p
+					mk_cast();
+				| Some cf,_ when Meta.has Meta.MultiType a.a_meta ->
+					mk_cast();
 				| Some cf,Some c ->
 					recurse cf (fun () -> make_static_call ctx c cf a tl [eright] tleft p)
 				| _ ->

+ 15 - 10
filters.ml

@@ -101,6 +101,10 @@ let handle_side_effects com gen_temp e =
 			in
 			let e2 = loop e2 in
 			{e with eexpr = TBinop(op,e1,e2)}
+		| TBinop((OpAssign | OpAssignOp _) as op,e1,e2) ->
+			let e1 = loop e1 in
+			let e2 = loop e2 in
+			{e with eexpr = TBinop(op,e1,e2)}
  		| TBinop(op,e1,e2) ->
 			begin match ordered_list [e1;e2] with
 				| [e1;e2] ->
@@ -127,16 +131,17 @@ let handle_side_effects com gen_temp e =
 		| _ ->
 			Type.map_expr loop e
 	and ordered_list el =
-		let bind e =
-			declare_temp e.etype (Some (loop e)) e.epos
-		in
-		let rec no_side_effect e =
-			if Optimizer.has_side_effect e then
-				bind e
-			else
-				e
-		in
-		List.map no_side_effect el
+		match el with
+			| [e] ->
+				el
+			| _ ->
+				let bind e =
+					declare_temp e.etype (Some (loop e)) e.epos
+				in
+				if (List.exists Optimizer.has_side_effect) el then
+					List.map bind el
+				else
+					el
 	in
 	let e = loop e in
 	match close_block() with

+ 1 - 1
libs

@@ -1 +1 @@
-Subproject commit 7c8941a5567ff0b705ffa2748795072bc9844d84
+Subproject commit 0da911f4d0d9d2dc2972cf21db3b0b7d6e1e6bf4

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

@@ -261,14 +261,17 @@ class Compiler {
 			paths.push(path);
 		for (path in paths) {
 			var found:Bool = false;
+			var moduleFirstCharacter:String = ((path.indexOf(".") < 0)?path:path.substring(path.lastIndexOf(".")+1)).charAt(0);
+			var startsWithUpperCase:Bool = (moduleFirstCharacter == moduleFirstCharacter.toUpperCase());//needed because FileSystem is not case sensitive
 			var moduleRoot = (path.indexOf(".") < 0)?"":path.substring(0, path.lastIndexOf("."));
-
+			var moduleRootFirstCharacter:String = ((moduleRoot.indexOf(".") < 0)?moduleRoot:moduleRoot.substring(moduleRoot.lastIndexOf(".")+1)).charAt(0);
+			var rootStartsWithUpperCase:Bool = (moduleRootFirstCharacter == moduleRootFirstCharacter.toUpperCase());//needed because FileSystem is not case sensitive
 			for ( classPath in Context.getClassPath() ) {
 				var moduleRootPath = (moduleRoot == "")?"":(classPath + moduleRoot.split(".").join("/") + ".hx");
 				var fullPath = classPath + path.split(".").join("/");
-				var isValidDirectory:Bool = (sys.FileSystem.exists(fullPath) && sys.FileSystem.isDirectory(fullPath));
-				var isValidModule:Bool = !isValidDirectory && sys.FileSystem.exists(fullPath + ".hx");
-				var isValidSubType:Bool = !isValidModule && (moduleRootPath != "" && sys.FileSystem.exists(moduleRootPath));
+				var isValidModule:Bool = startsWithUpperCase && sys.FileSystem.exists(fullPath + ".hx");
+				var isValidSubType:Bool = !isValidModule && moduleRootPath != "" && rootStartsWithUpperCase && sys.FileSystem.exists(moduleRootPath);
+				var isValidDirectory:Bool = !isValidSubType && sys.FileSystem.exists(fullPath) && sys.FileSystem.isDirectory(fullPath);
 				if ( !isValidDirectory && !isValidModule && !isValidSubType)
 					continue;
 				else

+ 10 - 0
tests/unit/issues/Issue2917.hx

@@ -0,0 +1,10 @@
+package unit.issues;
+
+class Issue2917 extends Test {
+	function test() {
+		var m = new Map<String, Int>();
+		eq(0, Lambda.count(m));
+		m.set("foo", 12);
+		eq(1, Lambda.count(m));
+	}
+}