Browse Source

[lua] properly escape reserved lua keywords when used as field names. Close #5041

Justin Donaldson 9 năm trước cách đây
mục cha
commit
35662673ae
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      src/generators/genlua.ml

+ 1 - 1
src/generators/genlua.ml

@@ -1315,7 +1315,7 @@ let gen_class_field ctx c f predelimit =
 	if predelimit then sprln ctx ",";
 	if predelimit then sprln ctx ",";
 	match f.cf_expr with
 	match f.cf_expr with
 	| None ->
 	| None ->
-		print ctx "'%s', nil" (anon_field f.cf_name);
+		print ctx "'%s', nil" f.cf_name;
 	| Some e ->
 	| Some e ->
 		ctx.id_counter <- 0;
 		ctx.id_counter <- 0;
 		(match e.eexpr with
 		(match e.eexpr with