uint8_t is_const : 1;
uint8_t is_lexical : 1;
uint8_t is_captured : 1;
+ uint8_t is_static_private : 1; /* only used during private class field parsing */
uint8_t var_kind : 4; /* see JSVarKindEnum */
/* only used during compilation: function pool index for lexical
variables with var_kind =
/* add a private field variable in the current scope */
static int add_private_class_field(JSParseState *s, JSFunctionDef *fd,
- JSAtom name, JSVarKindEnum var_kind)
+ JSAtom name, JSVarKindEnum var_kind, BOOL is_static)
{
JSContext *ctx = s->ctx;
JSVarDef *vd;
vd = &fd->vars[idx];
vd->is_lexical = 1;
vd->is_const = 1;
+ vd->is_static_private = is_static;
return idx;
}
JSFunctionDef *method_fd;
if (is_private) {
- int idx, var_kind;
+ int idx, var_kind, is_static1;
idx = find_private_class_field(ctx, fd, name, fd->scope_level);
if (idx >= 0) {
var_kind = fd->vars[idx].var_kind;
+ is_static1 = fd->vars[idx].is_static_private;
if (var_kind == JS_VAR_PRIVATE_FIELD ||
var_kind == JS_VAR_PRIVATE_METHOD ||
var_kind == JS_VAR_PRIVATE_GETTER_SETTER ||
- var_kind == (JS_VAR_PRIVATE_GETTER + is_set)) {
+ var_kind == (JS_VAR_PRIVATE_GETTER + is_set) ||
+ (var_kind == (JS_VAR_PRIVATE_GETTER + 1 - is_set) &&
+ is_static != is_static1)) {
goto private_field_already_defined;
}
fd->vars[idx].var_kind = JS_VAR_PRIVATE_GETTER_SETTER;
} else {
if (add_private_class_field(s, fd, name,
- JS_VAR_PRIVATE_GETTER + is_set) < 0)
+ JS_VAR_PRIVATE_GETTER + is_set, is_static) < 0)
goto fail;
}
if (add_brand(s, &class_fields[is_static]) < 0)
goto fail;
emit_atom(s, setter_name);
ret = add_private_class_field(s, fd, setter_name,
- JS_VAR_PRIVATE_SETTER);
+ JS_VAR_PRIVATE_SETTER, is_static);
JS_FreeAtom(ctx, setter_name);
if (ret < 0)
goto fail;
goto private_field_already_defined;
}
if (add_private_class_field(s, fd, name,
- JS_VAR_PRIVATE_FIELD) < 0)
+ JS_VAR_PRIVATE_FIELD, is_static) < 0)
goto fail;
emit_op(s, OP_private_symbol);
emit_atom(s, name);
goto fail;
}
if (add_private_class_field(s, fd, name,
- JS_VAR_PRIVATE_METHOD) < 0)
+ JS_VAR_PRIVATE_METHOD, is_static) < 0)
goto fail;
emit_op(s, OP_set_home_object);
emit_op(s, OP_set_name);
test262/test/language/statements/class/elements/private-method-double-initialisation-set.js:32: strict mode: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all
test262/test/language/statements/class/elements/private-method-double-initialisation.js:32: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all
test262/test/language/statements/class/elements/private-method-double-initialisation.js:32: strict mode: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all
-test262/test/language/statements/class/private-non-static-getter-static-setter-early-error.js:13: unexpected error type: Test262: This statement should not be evaluated.
-test262/test/language/statements/class/private-non-static-getter-static-setter-early-error.js:13: strict mode: unexpected error type: Test262: This statement should not be evaluated.
-test262/test/language/statements/class/private-non-static-setter-static-getter-early-error.js:13: unexpected error type: Test262: This statement should not be evaluated.
-test262/test/language/statements/class/private-non-static-setter-static-getter-early-error.js:13: strict mode: unexpected error type: Test262: This statement should not be evaluated.
-test262/test/language/statements/class/private-static-getter-non-static-setter-early-error.js:13: unexpected error type: Test262: This statement should not be evaluated.
-test262/test/language/statements/class/private-static-getter-non-static-setter-early-error.js:13: strict mode: unexpected error type: Test262: This statement should not be evaluated.
-test262/test/language/statements/class/private-static-setter-non-static-getter-early-error.js:13: unexpected error type: Test262: This statement should not be evaluated.
-test262/test/language/statements/class/private-static-setter-non-static-getter-early-error.js:13: strict mode: unexpected error type: Test262: This statement should not be evaluated.
test262/test/language/statements/for-of/head-lhs-async-invalid.js:14: unexpected error type: Test262: This statement should not be evaluated.
test262/test/language/statements/for-of/head-lhs-async-invalid.js:14: strict mode: unexpected error type: Test262: This statement should not be evaluated.