소스 검색

set all private+protected names from SWF lib to public (allow override+reflect)

Nicolas Cannasse 17 년 전
부모
커밋
059da5e48c
2개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      doc/CHANGES.txt
  2. 10 0
      genswf.ml

+ 1 - 0
doc/CHANGES.txt

@@ -14,6 +14,7 @@ TODO inlining : substitute class+function type parameters in order to have fully
 	renamed NekoSocketConnection to SyncSocketConnection (php support)
 	fixes in genAs3
 	fix for flash9 : always coerce call return type
+	set all private+protected names from SWF lib to public (allow override+reflect)
 
 2008-07-17: 2.0-RC1
 	genneko : remove big array error (fixed in neko 1.7.1)

+ 10 - 0
genswf.ml

@@ -130,6 +130,16 @@ let movieclip_exists types inits path =
 	) types || 	List.exists (fun i -> loop i (Array.length i.hls_fields - 1)) inits
 
 let add_as3_code ctx data types =
+	(* set all protected+private fields to public - this will enable overriding/reflection in haXe classes *)
+	let data = { data with as3_namespaces = Array.map (fun ns ->
+		match ns with
+		| A3NPrivate i | A3NInternal i -> A3NPublic i
+		| A3NProtected i -> A3NPublic (Some i)
+		| A3NPublic _
+		| A3NNamespace _
+		| A3NExplicit _
+		| A3NStaticProtected _ -> ns
+	) data.as3_namespaces } in
 	(* only keep classes that are not redefined in HX code *)
 	let inits = As3hlparse.parse data in
 	let inits = List.filter (fun i ->