Просмотр исходного кода

[php7] dont print positions for blocks in generated code

Alexander Kuzmenko 8 лет назад
Родитель
Сommit
5a9e7ceaa8
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      src/generators/genphp7.ml

+ 6 - 1
src/generators/genphp7.ml

@@ -656,6 +656,11 @@ let is_concatenation expr =
 		| TBinop (OpAdd, expr1, expr2) -> (is_string expr1) || (is_string expr2)
 		| _ -> false
 
+(**
+	Check if provided expression is a block of expressions
+*)
+let is_block expr = match expr.eexpr with TBlock _ -> true | _ -> false
+
 (**
 	Check if provided expression is a binary operation
 *)
@@ -1990,7 +1995,7 @@ class virtual type_builder ctx wrapper =
 			and exprs = match expr.eexpr with TBlock exprs -> exprs | _ -> [expr] in
 			let write_body () =
 				let write_expr expr =
-					if not !skip_line_directives then begin
+					if not !skip_line_directives && not (is_block expr) then begin
 						self#write_pos expr;
 						self#write_indentation
 					end;