Forráskód Böngészése

LuaJIT semicolons fully fixed for current test suite!

So for now, our generator creates LuaJIT-compatible output!
PeyTy 10 éve
szülő
commit
9a00bfc3b3
1 módosított fájl, 7 hozzáadás és 2 törlés
  1. 7 2
      genlua.ml

+ 7 - 2
genlua.ml

@@ -646,7 +646,7 @@ and gen_expr ctx e =
 		print ctx "while( %s.hasNext() ) do" it;
 		let bend = open_block ctx in
 		newline ctx;
-		print ctx "local %s = %s.next()" (ident v.v_name) it;
+		print ctx "local %s = %s.next();" (ident v.v_name) it;
 		gen_block_element ctx e;
 		bend();
 		newline ctx;
@@ -783,6 +783,10 @@ and gen_block_element ?(after=false) ctx e =
 	| TArray (e1,e2) ->
 		gen_block_element ctx e1;
 		gen_block_element ctx e2;
+	| TSwitch (e,[],def) ->
+		(match def with
+		| None -> ()
+		| Some e -> gen_block_element ctx e)
 	| TField _ ->
 		let f () = gen_expr ctx e in
 		gen_iife_assign ctx f;
@@ -802,6 +806,8 @@ and gen_block_element ?(after=false) ctx e =
 	| TVar (v,eo) ->
 		if not after then newline ctx;
 		gen_expr ctx e; (* these already generate semicolons*)
+	| TMeta (_,e) ->
+		gen_block_element ctx e
 	| _ ->
 		if not after then newline ctx;
 		spr ctx (debug_expression e);
@@ -916,7 +922,6 @@ and gen_value ctx e =
 			gen_cond ctx cond3;
 			spr ctx " then ";
 			gen_block_element ctx (assign e3);
-			semicolon ctx;
 			gen_elseif ctx eo3;
 		    | _ ->
 			spr ctx " else ";