Browse Source

fixed Xml usage

Nicolas Cannasse 14 years ago
parent
commit
2e4ae07d3d
1 changed files with 11 additions and 1 deletions
  1. 11 1
      genas3.ml

+ 11 - 1
genas3.ml

@@ -66,6 +66,10 @@ let s_path ctx stat path p =
 		"XML"
 		"XML"
 	| (["flash";"xml"],"XMLList") ->
 	| (["flash";"xml"],"XMLList") ->
 		"XMLList"
 		"XMLList"
+	| ["flash";"utils"],"QName" ->
+		"QName"
+	| ["flash";"utils"],"Namespace" ->
+		"Namespace"
 	| (["haxe"],"Int32") when not stat ->
 	| (["haxe"],"Int32") when not stat ->
 		"int"
 		"int"
 	| (pack,name) ->
 	| (pack,name) ->
@@ -430,6 +434,8 @@ and gen_field_access ctx t s =
 			print ctx "[\"toStringHX\"]"
 			print ctx "[\"toStringHX\"]"
 		| [], "String", "cca" ->
 		| [], "String", "cca" ->
 			print ctx ".charCodeAt"
 			print ctx ".charCodeAt"
+		| ["flash";"xml"], "XML", "namespace" ->
+			print ctx ".namespace"
 		| _ ->
 		| _ ->
 			print ctx ".%s" (s_ident s)
 			print ctx ".%s" (s_ident s)
 	in
 	in
@@ -965,13 +971,17 @@ let generate_class ctx c =
 let generate_main ctx inits =
 let generate_main ctx inits =
 	ctx.curclass <- { null_class with cl_path = [],"__main__" };
 	ctx.curclass <- { null_class with cl_path = [],"__main__" };
 	let pack = open_block ctx in
 	let pack = open_block ctx in
-	print ctx "\tpublic class __main__ extends %s {" (s_path ctx true (["flash"],"Boot") Ast.null_pos);
+	print ctx "\timport flash.Lib";
+	newline ctx;
+	print ctx "public class __main__ extends %s {" (s_path ctx true (["flash"],"Boot") Ast.null_pos);
 	let cl = open_block ctx in
 	let cl = open_block ctx in
 	newline ctx;
 	newline ctx;
 	spr ctx "public function __main__() {";
 	spr ctx "public function __main__() {";
 	let fl = open_block ctx in
 	let fl = open_block ctx in
 	newline ctx;
 	newline ctx;
 	spr ctx "super()";
 	spr ctx "super()";
+	newline ctx;
+	spr ctx "flash.Lib.current = this";
 	List.iter (fun e -> newline ctx; gen_expr ctx e) inits;
 	List.iter (fun e -> newline ctx; gen_expr ctx e) inits;
 	fl();
 	fl();
 	newline ctx;
 	newline ctx;