소스 검색

fix Compiler.keep not including private subtypes and subtypes in modules in the root package.

Dan Korostelev 11 년 전
부모
커밋
dfc7a6b58a
1개의 변경된 파일7개의 추가작업 그리고 9개의 파일을 삭제
  1. 7 9
      std/haxe/macro/Compiler.hx

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

@@ -304,16 +304,14 @@ class Compiler {
 	private static function keepSubType( path : String )
 	{
 		var module = path.substring(0, path.lastIndexOf("."));
-		var subType = module.substring(0, module.lastIndexOf(".")) + "." + path.substring(path.lastIndexOf(".") + 1);
-		var types = Context.getModule(module);
-		var found:Bool = false;
-		for (type in types) {
+		var typeName = path.substring(path.lastIndexOf(".") + 1);
+		var found = false;
+		for (type in Context.getModule(module)) {
 			switch(type) {
-				case TInst(cls, _):
-					if (cls.toString() == subType) {
-						found = true;
-						cls.get().meta.add(":keep", [], cls.get().pos);
-					}
+				case TInst(_.get() => cls, _) if (cls.name == typeName):
+					cls.meta.add(":keep", [], cls.pos);
+					found = true;
+					break;
 				default:
 					//
 			}