support computed property name in object literal (#4268)

This commit is contained in:
Alex Lam S.L
2020-11-08 15:38:32 +00:00
committed by GitHub
parent 810cd40356
commit 91fc1c82b5
10 changed files with 166 additions and 139 deletions

View File

@@ -115,9 +115,6 @@
value : from_moz(M.value)
};
if (M.kind == "init") return new AST_ObjectKeyVal(args);
args.key = new AST_SymbolAccessor({
name: args.key
});
args.value = new AST_Accessor(args.value);
if (M.kind == "get") return new AST_ObjectGetter(args);
if (M.kind == "set") return new AST_ObjectSetter(args);
@@ -385,7 +382,7 @@
def_to_moz(AST_ObjectProperty, function To_Moz_Property(M) {
var key = {
type: "Literal",
value: M.key instanceof AST_SymbolAccessor ? M.key.name : M.key
value: M.key
};
var kind;
if (M instanceof AST_ObjectKeyVal) {