瀏覽代碼

disable auto inclusion in display mode + fixed bug when the classpath is the current directory

Nicolas Cannasse 12 年之前
父節點
當前提交
66a6c0be4d
共有 1 個文件被更改,包括 14 次插入8 次删除
  1. 14 8
      std/haxe/macro/Compiler.hx

+ 14 - 8
std/haxe/macro/Compiler.hx

@@ -84,19 +84,25 @@ class Compiler {
 		Include for compilation all classes defined in the given package excluding the ones referenced in the ignore list.
 		Include for compilation all classes defined in the given package excluding the ones referenced in the ignore list.
 	**/
 	**/
 	public static function include( pack : String, ?rec = true, ?ignore : Array<String>, ?classPaths : Array<String> ) {
 	public static function include( pack : String, ?rec = true, ?ignore : Array<String>, ?classPaths : Array<String> ) {
-		var skip = if(null == ignore) {
+		var skip = if( ignore == null ) {
 			function(c) return false;
 			function(c) return false;
 		} else {
 		} else {
 			function(c) return Lambda.has(ignore, c);
 			function(c) return Lambda.has(ignore, c);
 		}
 		}
-		if(null == classPaths)
+		if( classPaths == null ) {
 			classPaths = Context.getClassPath();
 			classPaths = Context.getClassPath();
-		// normalize class path
-		for( i in 0...classPaths.length ) {
-			var cp = StringTools.replace(classPaths[i], "\\", "/");
-			if(StringTools.endsWith(cp, "/"))
-				cp = cp.substr(0, -1);
-			classPaths[i] = cp;
+			// do not force inclusion when using completion
+			if( Context.defined("display") )
+				return;
+			// normalize class path
+			for( i in 0...classPaths.length ) {
+				var cp = StringTools.replace(classPaths[i], "\\", "/");
+				if(StringTools.endsWith(cp, "/"))
+					cp = cp.substr(0, -1);
+				if( cp == "" )
+					cp = ".";
+				classPaths[i] = cp;
+			}
 		}
 		}
 		var prefix = pack == '' ? '' : pack + '.';
 		var prefix = pack == '' ? '' : pack + '.';
 		for( cp in classPaths ) {
 		for( cp in classPaths ) {