Properly implement static class fields. (#4221)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -51,3 +51,33 @@ check_property(C1, 23, 11)
|
||||
check_property(C1, "a b", undefined)
|
||||
assert(res === "msg")
|
||||
assert(counter === 2)
|
||||
|
||||
counter = 0
|
||||
class C2 {
|
||||
static a = (assert(++counter === 6), "x")
|
||||
static [(assert(++counter === 1), "b")]
|
||||
static [(assert(++counter === 2), "f")]() {}
|
||||
static [(assert(++counter === 3), "c")] = (assert(++counter === 7), this);
|
||||
[(assert(++counter === 4), "a")]
|
||||
static [(assert(++counter === 5), "d")];static e = (assert(++counter === 8), C2)
|
||||
}
|
||||
|
||||
assert(counter === 8)
|
||||
check_property(C2, "a", "x")
|
||||
check_property(C2, "b", undefined)
|
||||
check_property(C2, "c", C2)
|
||||
check_property(C2, "d", undefined)
|
||||
check_property(C2, "e", C2)
|
||||
|
||||
res = new C2
|
||||
check_property(res, "a", undefined)
|
||||
|
||||
let C3 = class C4 {
|
||||
static f() {}
|
||||
static xx = C4
|
||||
static yy = this
|
||||
}
|
||||
|
||||
assert(Reflect.ownKeys(C3).toString() === "length,prototype,f,name,xx,yy")
|
||||
check_property(C3, "xx", C3)
|
||||
check_property(C3, "yy", C3)
|
||||
|
||||
Reference in New Issue
Block a user