浏览代码

[lua] fix object declaration field escaping (see #5000)

Simon Krajewski 9 年之前
父节点
当前提交
9c41b87800
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/generators/genlua.ml

+ 1 - 1
src/generators/genlua.ml

@@ -97,7 +97,7 @@ let valid_lua_ident s =
 let field s = if Hashtbl.mem kwds s || not (valid_lua_ident s) then "[\"" ^ s ^ "\"]" else "." ^ s
 let ident s = if Hashtbl.mem kwds s then "_" ^ s else s
 
-let anon_field s = if Hashtbl.mem kwds s || not (valid_lua_ident s) then "['" ^ s ^ "']" else s
+let anon_field s = if Hashtbl.mem kwds s || not (valid_lua_ident s) then "['" ^ (Ast.s_escape s) ^ "']" else s
 
 let has_feature ctx = Common.has_feature ctx.com
 let add_feature ctx = Common.add_feature ctx.com