Browse Source

[as3] do not generate TObjectDecl at block-level here as well (closes #3440)

Simon Krajewski 11 years ago
parent
commit
a7a7cc287c
1 changed files with 8 additions and 1 deletions
  1. 8 1
      genas3.ml

+ 8 - 1
genas3.ml

@@ -666,7 +666,7 @@ and gen_expr ctx e =
 			(fun() -> print ctx "}")
 		end) in
 		(match ctx.block_inits with None -> () | Some i -> i());
-		List.iter (fun e -> block_newline ctx; gen_expr ctx e) el;
+		List.iter (fun e -> gen_block_element ctx e) el;
 		bend();
 		newline ctx;
 		cb();
@@ -793,6 +793,13 @@ and gen_expr ctx e =
 	| TCast (e1,Some t) ->
 		gen_expr ctx (Codegen.default_cast ctx.inf.com e1 t e.etype e.epos)
 
+and gen_block_element ctx e = match e.eexpr with
+	| TObjectDecl fl ->
+		List.iter (fun (_,e) -> gen_block_element ctx e) fl
+	| _ ->
+		block_newline ctx;
+		gen_expr ctx e
+
 and gen_block ctx e =
 	newline ctx;
 	match e.eexpr with