diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/js1_8_5/reflect-parse/computedPropNames.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/js1_8_5/reflect-parse/computedPropNames.js')
-rw-r--r-- | js/src/tests/js1_8_5/reflect-parse/computedPropNames.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/js/src/tests/js1_8_5/reflect-parse/computedPropNames.js b/js/src/tests/js1_8_5/reflect-parse/computedPropNames.js new file mode 100644 index 000000000..d96e73152 --- /dev/null +++ b/js/src/tests/js1_8_5/reflect-parse/computedPropNames.js @@ -0,0 +1,45 @@ +// |reftest| skip-if(!xulRuntime.shell) +function test() { + +// Bug 924688: computed property names +assertExpr('a= {[field1]: "a", [field2=1]: "b"}', + aExpr("=", ident("a"), + objExpr([{ key: computedName(ident("field1")), value: lit("a")}, + { key: computedName(aExpr("=", ident("field2"), lit(1))), + value: lit("b")}]))); + +assertExpr('a= {["field1"]: "a", field2 : "b"}', + aExpr("=", ident("a"), + objExpr([{ key: computedName(lit("field1")), value: lit("a") }, + { key: ident("field2"), value: lit("b") }]))); + +assertExpr('a= {[1]: 1, 2 : 2}', + aExpr("=", ident("a"), + objExpr([{ key: computedName(lit(1)), value: lit(1) }, + { key: lit(2), value: lit(2) }]))); + +// Bug 924688: computed property names - location information +var node = Reflect.parse("a = {[field1]: 5}"); +Pattern({ body: [ { expression: { right: { properties: [ {key: { loc: + { start: { line: 1, column: 5 }, end: { line: 1, column: 13 }}}}]}}}]}).match(node); + +// Bug 1048384 - Getter/setter syntax with computed names +assertExpr("b = { get [meth]() { } }", aExpr("=", ident("b"), + objExpr([{ key: computedName(ident("meth")), value: funExpr(null, [], blockStmt([])), + method: false, kind: "get"}]))); +assertExpr("b = { set [meth](a) { } }", aExpr("=", ident("b"), + objExpr([{ key: computedName(ident("meth")), value: funExpr(null, [ident("a")], + blockStmt([])), method: false, kind: "set"}]))); + +// Bug 1220702 - If it's not written as a method, `.method` should be false. +assertExpr("({[x]: function () {}})", + objExpr([{ + key: computedName(ident("x")), + value: funExpr(null, [], blockStmt([])), + method: false, + kind: "init" + }])); + +} + +runtest(test); |