Переглянути джерело

fixed bugs in as3 generation

Nicolas Cannasse 16 роки тому
батько
коміт
5d63bc048f
1 змінених файлів з 7 додано та 1 видалено
  1. 7 1
      genas3.ml

+ 7 - 1
genas3.ml

@@ -81,7 +81,7 @@ let reserved =
 	(* these ones are defined in order to prevent recursion in some Std functions *)
 	["is";"as";"int";"uint";"const";"getTimer";"typeof";"parseInt";"parseFloat";
 	(* AS3 keywords which are not haXe ones *)
-	"each";"label";"finally";"with";"final";"internal";"native";"const";"namespace";"include";
+	"each";"label";"finally";"with";"final";"internal";"native";"const";"namespace";"include";"delete";
 	(* we don't include get+set since they are not 'real' keywords, but they can't be used as method names *)
 	];
 	h
@@ -615,6 +615,9 @@ and gen_expr ctx e =
 			b();
 		) catchs;
 	| TMatch (e,_,cases,def) ->
+		print ctx "{";
+		let bend = open_block ctx in
+		newline ctx;
 		let b = save_locals ctx in
 		let tmp = define_local ctx "$e" in
 		print ctx "var %s : enum = " tmp;
@@ -656,6 +659,9 @@ and gen_expr ctx e =
 			newline ctx;
 		);
 		spr ctx "}";
+		bend();
+		newline ctx;
+		spr ctx "}";
 		b()
 	| TSwitch (e,cases,def) ->
 		spr ctx "switch";